问题
when i initialize the player like this:
$("#jquery_jplayer").jPlayer({
ready: function () {
this.element.jPlayer("setFile", "/previews/cancion.mp3", "/previews/horse.ogg").jPlayer("play");
},
volume: 50,
oggSupport: true
})
is there any way to disable the autoplay?
回答1:
Remove .jPlayer("play")
回答2:
how about reading the manual:
http://www.happyworm.com/jquery/jplayer/latest/developer-guide.htm
to disable looping (repeat) i would try:
$("#jpId").jPlayer("onSoundComplete", function() {
// Directly access this instance's jPlayer methods. (Does not support chaining.)
this.stop();
});
回答3:
.jPlayer("pause");
That's it. It worked for my project. Put that at the end of the function that plays the song. Not the function that loads the jplayer, but the track selecting function.
Cheers to those looking at this 6-7 years later. :) The others did help me come to this simple conclusive solution.
来源:https://stackoverflow.com/questions/2692430/how-to-disable-jquery-jplayer-autoplay