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


i did small example of videojs, has log on event play, , using apis 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 while executing apis play event go infinite loop.

i can found issue in touch devices if enable controls while seeking bar, play pause etc. if didnt use combination can found issues. internally library using these apis in seek, or other controls ?

link in jsfiddle live bug:

this bug in video js event handling:

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

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

in meantime, 1 workaround put play/pause toggles in timeouts.

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

Comments