html5 - JQuery - loadedmetadata listener within for loop -
I am trying to create a loop in jQuery to get the duration of different audio tracks taken from an array. It appears that an event within the loop overrides another statement to add the listener, due to the looping indefinitely and crashing the browser.
Here is the code:
var TrackSources = new array (); Track source [0] = "music / haken.mp3"; Track source [1] = "music / drive home.mp3"; Track source [2] = "music / luminol.mp3"; Var audio playlist = document.createElement ("audio"); Audio playlist. Preload = "metadata"; Function getDurations () {var max = trackSources.length; (Var i = 0; i & lt; max;) {audioPlaylist.src = track source [i]; Audio playlist.Advent Listener ('LoadedMedataData', function () {trackdusion = audio playlistdruck; warning (trackedjan); i ++;}, false); }} Is there any way to do this work? Thanks!
You can try:
Note one side: You've mentioned jQuery but your question code is plain JS.
Comments
Post a Comment