ruby on rails - Javascript audio with playlist -


sup, i'm using audio.js plugin in rails app. know, api of audio.js allows make playlists, didn't find documentation of it. so, how can implement playlist audio.js or other js audio plugin? there example of using audio.js playlist, don't understand how implemented. http://kolber.github.io/audiojs/demos/test6.html

if view source of page inside script tag's @ top there

<script>       $(function() {          // setup player autoplay next track         var = audiojs.createall({           trackended: function() {             var next = $('ol li.playing').next();             if (!next.length) next = $('ol li').first();             next.addclass('playing').siblings().removeclass('playing');             audio.load($('a', next).attr('data-src'));             audio.play();           }         });          // load in first track         var audio = a[0];             first = $('ol a').attr('data-src');         $('ol li').first().addclass('playing');         audio.load(first);          // load in track on click         $('ol li').click(function(e) {           e.preventdefault();           $(this).addclass('playing').siblings().removeclass('playing');           audio.load($('a', this).attr('data-src'));           audio.play();         });         // keyboard shortcuts         $(document).keydown(function(e) {           var unicode = e.charcode ? e.charcode : e.keycode;              // right arrow           if (unicode == 39) {             var next = $('li.playing').next();             if (!next.length) next = $('ol li').first();             next.click();             // arrow           } else if (unicode == 37) {             var prev = $('li.playing').prev();             if (!prev.length) prev = $('ol li').last();             prev.click();             // spacebar           } else if (unicode == 32) {             audio.playpause();           }         })       });     </script> 

as can see loads url data-src in url

<li><a href="#" data-src="http://s3.amazonaws.com/audiojs/01-dead-wrong-intro.mp3">dead wrong intro</a></li> 

so similar


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -