]> git.parisson.com Git - telemeta.git/commitdiff
update
authorbalastegui <thomas.balastegui@gmail.com>
Tue, 17 May 2016 13:36:25 +0000 (15:36 +0200)
committerbalastegui <thomas.balastegui@gmail.com>
Tue, 17 May 2016 13:36:25 +0000 (15:36 +0200)
telemeta/static/telemeta/js/playlist.js
telemeta/templates/telemeta/lists.html

index 7f119dd52080c27f8a440667f18a47a60f63825e..2b11304faa69095831c566dacefc40af2c18fda2 100644 (file)
@@ -90,23 +90,10 @@ var playlistUtils = {
         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();
     },
 
     /**
index a8f7dcfb36e097810e31918e73c5b65181f6ac96..fce91cbfad04679f933089ab74119ed74e1336c7 100644 (file)
                 </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 %}