After configuring and running jPlayer 2.0.0 in Firefox 3.6.13, where everthing runs smooth, the same code doesn't run in Safari 5.0.3. What i am doing is creating the jPlayer, listen for the "ended"-event to restart it. Here's the code:
$(document).ready(function(){
$("#loopplayer").jPlayer({
ready: function () {$(this).jPlayer("setMedia", {mp3: "/static/audio/brokentech.mp3"});
},
swfPath: "/static/swf",
supplied: "mp3",开发者_高级运维
preload: true,
});
$("#loopplayer").bind($.jPlayer.event.ended, function(){
$(this).jPlayer("play" );
});
});
Whats happening in Safari is: the progress bar shows NaN as length of the track, and it stops after running once. When i remove the event listener and reload the page, i can run the jPlayer once (again with NaN as tracklength), after it has run once i am not able to restart it. Anything wrong with my code or a bug in jP2?
Look here:
http://groups.google.com/group/jplayer/tree/browse_frm/month/2010-05/bb4306c1850108b1?rnum=71&_done=/group/jplayer/browse_frm/month/2010-05%3F
There are some mp3s that have problems with jPlayer due to the way files are served. The browser doesn't retrieve metadata correctly on gzipped response.
Try to re-set the media in the ended
event.
This works in Safari 7.0, which only plays the sound once and mutes for subsequent replay attempts without the hack.
$(function() {
$('#jp').jPlayer({
ready: function() {
// Set the media when jPlayer is ready.
$(this).jPlayer("setMedia", {mp3: "/audio/demo.mp3"});
},
ended: function() {
// Do it again after it finishes playing.
$(this).jPlayer("setMedia", {mp3: "/audio/demo.mp3"});
},
});
});
you give the swfpath as follow or use full domain path { swfPath: "[http://localhost/jplayer/js/]", supplied: "webmv, ogv, m4v, oga, mp3" }
精彩评论