cladera / videojs-offset

VideoJS plugin for play a segment of a video.
MIT License
64 stars 43 forks source link

RangeError when used with videojs-youtube and videojs-vimeo #17

Open Yi-Zhou opened 8 years ago

Yi-Zhou commented 8 years ago

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:

image

Please let me know if anyone could help me solve this problem.

bjmrey commented 5 years ago

This is an infinite loop issue: this.currentTime(0) calls the function setCurrentTimein 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);
cladera commented 5 years ago

Thank you @Yi-Zhou and @bjmrey I'll take a look ASAP.

dy commented 3 years ago

Yeah, stumbled here too