javascript - Which jPlayer event designates the ability to start playing? -
i have basic jplayer set plays (150mb) audio file aws s3. setup looks this.
jquery(function() { var $player, jplayerdefaults, progresscount; $player = $('<div>'); progresscount = 0; jplayerdefaults = { ready: function(e) { console.log("player ready"); $player.jplayer('setmedia', { mp3: 'http://s3-eu-west-1.amazonaws.com/some/file.mp3' }); return $player.jplayer('play', 1234); }, seeking: function(e) { return console.log("seeking"); }, seeked: function(e) { return console.log("seeked"); }, canplay: function(e) { console.log('canplay'); }, progress: function(e) { return console.log("progress", progresscount += 1); }, playing: function(e) { return console.log("playing"); }, error: function(e) { return console.log("error loading audio.", e); }, supplied: 'mp3', preload: 'auto' }; $player.jplayer(jplayerdefaults); });
my understanding html5 audio spec , this question canplay
event designates point @ audio should start playing.
however, when run code above (with empty browser cache), following log.
player ready progress 1 progress 2 progress 3 progress 4 canplay seeking playing progress 5 ... progress 888 seeked progress 889 ... progress 896
i hear audio playing after seeked
event. event happens long time (minutes) after canplay
event.
is expected behavior or doing wrong? also, jplayer following html5 <audio>
tag spec faithfully here?
edit: incase wondering, aws s3 accept byte-range requests.
i think problem might be: return $player.jplayer('play', 1234);
asking player begin play once media seekable point try
return $player.jplayer('play');
or return $player.jplayer('play', 5);
more details here http://www.jplayer.org/latest/developer-guide/#jplayer-play small note under parameter, wasn't easy find it
Comments
Post a Comment