Created
March 27, 2025 04:33
-
-
Save Hans5958/2914a41cf21629cee2ef1320fd8a5cdc to your computer and use it in GitHub Desktop.
A concept/prototype to simulate a real-time video/live stream from a static video using an Invidious embed. Try it by opening the embed URL and running the script.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Try it on https://inv.nadeko.net/embed/JRMOMjCoR58 | |
function getTime() { | |
const date = new Date() | |
return (date.getMilliseconds() / 1000) + date.getSeconds() + date.getMinutes() * 60 | |
} | |
var toSync = true | |
player.on(['canplay'], e => { | |
if (Math.abs(player.currentTime() - getTime()) > 0.1) { | |
player.currentTime(getTime()) | |
return | |
} | |
toSync = false | |
}) | |
player.currentTime(getTime()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment