Hi everybody,
I want to initialize the jPlayer plugin and directly play an audio file one after the other, however it somehow doesn't work. I've found a workaround, that if I wait aout 750ms (setTimeout) then playing the audio file works.
Example code of what doesn't work:
- // initialization
var jp = $('<div id="jplayer"></div>');
$('body').append(jp);
jp.jPlayer( { swfPath: "javascript" });
- jp.jPlayer('setFile', 'somefile.mp3').jPlayer('play');
That code would be called after a user clicks on a button.
If I put the second part in a setTimeout() and run it after about 750ms, then it works. This is strange, any idea how we can get this to work?
Thanks!