javascript - HTML 5 Audio with Playlist -
I started using the script from a jsfiddle link for a HTML5 audio player with a playlist, HTML and CSS There was no problem in importing parts / though I have been running hard to run javascript. The audio player only runs the file kept in the audio tag. When I click on a song from the playlist, then I take it to the second page (black background) where the audio file plays. My question is whether I import this script or I can copy it to the top of the html file I will keep on Also, what would be the correct tags to run the following script (shown below):
var audio; Var playlists; Var track; Var on; in this(); Function init () {current = 0; Audio = $ ('audio'); Playlist = $ ('# playlist'); Tracks = playlist.find ('li a'); Lane = track. Long - 1; Audio [0]. Volume = .10; Audio [0] .play (); Playlist.find ('a'). Click (function (e) {e.preventDefault (); link = $ (this); current = link.parent (). Index (); run (link, audio [0]);}); Audio [0] .addEventListener ('end', function (e) {current ++; if (current == lane) {current = 0; link = playlist.find ('a') [0];} and {link = Playlist} (player, player) {player.src = link.attr ('href) (run' (link), audio [0]);}); '); Par = link.parent (); Par.addClass ('active') siblings () removeClass ('active') .. Audio [0] .load (); Audio [0] .play ();
it starts working
$ ( Window) .load (function () {var audio; var playlist; var track; var current; init (); function init () {current = 0; audio = $ ('audio'); playlist = $ ('# playlist '); Tracks = playlist.find (' li a '); len = tracks.length; // - 1; Audio [0] .volume = .5; playlist.find (' a '). Click (function E) {E.preventDefault (); link = $ (this); current = link.parent (). Index (); run (link, audio [0]);}); audio [0] .addEventListener ('end ', (E) {and Current ++; if (current == lane) {current = 0; link = playlist.find ('a') [0];} and {link = playlist.find ('a') [current];} run ( $ (Link), audio [0]);})} function run (link, player) {player.src = link.attr ('href'); Par = link.parent (); par.addClass ('active ') Sister () removeClass (' Active ') .. Audio [0] .load (); Audio [0] .play (); }}
Comments
Post a Comment