mirror of
https://github.com/iv-org/invidious.git
synced 2026-01-28 15:58:30 -06:00
Merge c3ee8a5d90df83d6e53b78b6d6e9669729b391aa into d51a7a44ad91d2fa7d1330970a15a0d8f365f250
This commit is contained in:
commit
c4beaebb56
@ -117,24 +117,10 @@ function addCurrentTimeToURL(url, base) {
|
||||
return urlUsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Global variable to save the last timestamp (in full seconds) at which the external
|
||||
* links were updated by the 'timeupdate' callback below.
|
||||
*
|
||||
* It is initialized to 5s so that the video will always restart from the beginning
|
||||
* if the user hasn't really started watching before switching to the other website.
|
||||
*/
|
||||
var timeupdate_last_ts = 5;
|
||||
|
||||
/**
|
||||
* Callback that updates the timestamp on all external links
|
||||
*/
|
||||
player.on('timeupdate', function () {
|
||||
// Only update once every second
|
||||
let current_ts = Math.floor(player.currentTime());
|
||||
if (current_ts > timeupdate_last_ts) timeupdate_last_ts = current_ts;
|
||||
else return;
|
||||
|
||||
// YouTube links
|
||||
|
||||
if (!video_data.live_now) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user