RangeError when used with videojs-youtube and videojs-vimeo
Yi-Zhou opened this issue · comments
Hi there.
It seems that this plugin only works if the source is a video file. I get this error when it's used with videos from YouTube or Vimeo, and sometimes the browser crashes:
VIDEOJS: RangeError: Maximum call stack size exceeded(…) videojs.js:19296 VIDEOJS: RangeError: Maximum call stack size exceeded(…)
The stack looks like this:
Please let me know if anyone could help me solve this problem.
This is an infinite loop issue: this.currentTime(0)
calls the function setCurrentTime
in videojs-youtube, which itself triggers a timeupdate
event. Since we are already in the onPlayerTimeUpdate
function, this leads to infinite function calls.
A workaround would be to switch timeupdate
off and on again:
this.off('timeupdate', onPlayerTimeUpdate);
this.currentTime(0);
this.on('timeupdate', onPlayerTimeUpdate);
Yeah, stumbled here too