cladera / videojs-offset

VideoJS plugin for play a segment of a video.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

image

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

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);

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

Yeah, stumbled here too