pupunzi / jquery.mb.YTPlayer

use a custom yutube player for a video as background on jQuery framework
https://pupunzi.com/mb.components/mb.YTPlayer/demo/demo.html
1.34k stars 427 forks source link

When looping, video restarts at t=1 second, and startAt==0 is ignored #501

Open guillerodriguez opened 4 months ago

guillerodriguez commented 4 months ago

When looping, the default startAt time is 1s instead of 0, and setting startAt=0 explicitly does not help. This is due to the following line:

https://github.com/pupunzi/jquery.mb.YTPlayer/blob/6fc1ce6d6e294ef8fd9e26142ed495f122a9d583/src/jquery.mb.YTPlayer.src.js#L2321

where a 0 value for startAt is falsey and thus get replaced with 1.

Perhaps change this to:

YTPlayer.opt.startAt = (YTPlayer.opt.startAt !== undefined) ? YTPlayer.opt.startAt : 1;

?