Skip to content

Instantly share code, notes, and snippets.

@Hans5958
Created March 27, 2025 04:33
Show Gist options
  • Save Hans5958/2914a41cf21629cee2ef1320fd8a5cdc to your computer and use it in GitHub Desktop.
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.
// 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