How to disable jQuery.jplayer autoplay?

只谈情不闲聊 提交于 2019-12-10 23:57:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!