this.id = ""; // init ID
},
- loadSong: function(id){
- var player = $('#player').val();
- var sourceOgg = $('#player').val();
- var sourceMp3 = $('#player').val();
- for (var i=0; i<this.playlists.length; i++){
- if (this.playlists[i].id == id){
- // for resource in playlist.resources
- // if ID of the item then
- /*
- sourceOgg.src = this.playlists[i].sound;
- sourceMp3.src = this.playlists[i].sound;
- */
- }
- }
- player.load(); //just start buffering (preload)
- //player.play() doesn't work -> TODO: find another way
- //player.play(); //start playing
+ loadSong: function(resElem){
+ alert(resElem);
+ var audio = new Audio(resElem);
+ audio.play();
},
/**
</td>
<td align="center" style="vertical-align:middle;">
{% if resource.element.file or resource.element.has_mediafile %}
- <!-- Coding: the simple player -->
- <!-- TODO: find the way to pass item's ID when clicked -->
- <!-- Problème with player, have to do it without but have to define "player"
- <audio id="player" controls="controls">
- <source id="sourceOgg" src="" type="audio/ogg" />
- <source id="sourceMp3" src="" type="audio/mp3" />
- Your browser does not support the audio element.
- </audio>-->
- <a id="{{playlist.playlist.public_id}}" onclick="playlistUtils.loadSong(this.id)">
+ <a id="{{resource.element.file}}" onclick="playlistUtils.loadSong(this.id)">
<span class="glyphicon glyphicon-volume-up" style="font-size: 1.3em;"><p style="opacity:0;font-size:0">d</p></span>
</a>
{% endif %}