javascript - Play event is going to infinite loop in videojs - Stack Overflow

I just did a small example of videojs, which has a log on event play, and i am using APIs like play(),p

I just did a small example of videojs, which has a log on event play, and i am using APIs like play(),pause().

var myplayer;
var playCount = 0;
videojs("example_video_1").ready(function(){

      myplayer = this;

      myplayer.on("play", function(){
        playCount++;
        $("#count").text(playCount)

      });

});
$("#test").click(function (){  
    myplayer.pause();
    myplayer.play();
});

The issue is that while executing the APIs the play event will go to an infinite loop.

I can found this issue in touch devices if I enable the controls even while seeking the bar, do play pause etc. So if I didnt use the bination also I can found this issues. Internally the library is using these APIs in seek, or other controls ?

Link in jsfiddle LIVE BUG:

I just did a small example of videojs, which has a log on event play, and i am using APIs like play(),pause().

var myplayer;
var playCount = 0;
videojs("example_video_1").ready(function(){

      myplayer = this;

      myplayer.on("play", function(){
        playCount++;
        $("#count").text(playCount)

      });

});
$("#test").click(function (){  
    myplayer.pause();
    myplayer.play();
});

The issue is that while executing the APIs the play event will go to an infinite loop.

I can found this issue in touch devices if I enable the controls even while seeking the bar, do play pause etc. So if I didnt use the bination also I can found this issues. Internally the library is using these APIs in seek, or other controls ?

Link in jsfiddle LIVE BUG:

Share Improve this question edited Jul 15, 2013 at 13:30 Sarath asked Jul 15, 2013 at 10:32 SarathSarath 9,16612 gold badges54 silver badges86 bronze badges 1
  • Has this problem re-emerged in 4.3, at least in Firefox?? I'm getting looping in Firefox (but no other browsers) in my own projects, and an updated version of the above fiddle is, I believe, not working correctly: jsfiddle/vN28W/3 ?? – Jim Miller Commented Jan 13, 2014 at 20:12
Add a ment  | 

2 Answers 2

Reset to default 3

This is a bug in video js event handling:

https://github./videojs/video.js/issues/573 <-- original bug

https://github./videojs/video.js/issues/620 <-- best info on 'why' here

In the meantime, one workaround is to put any play/pause toggles in timeouts.

$("#test").click(function (){
    myplayer.pause();
    window.setTimeout(function() {myplayer.play();}, 10);
});

This is the fix forthis issue... https://github./cameront/video.js/mit/ff0b443c285691074f7f01e8d0326ade0f0a6609 for issues/620

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744790825a4593903.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信