From 3e6a94ae2e3130b7a6efa95ad65cbc20c664b40d Mon Sep 17 00:00:00 2001 From: codex Date: Wed, 10 Jun 2026 15:58:13 +0200 Subject: [PATCH] Resume cued YouTube videos on play sync --- public/app.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/public/app.js b/public/app.js index a50cf85..fa014e7 100644 --- a/public/app.js +++ b/public/app.js @@ -383,12 +383,17 @@ async function applyWatchState(state) { if (youtubeReady) { if (state.playing) { - if (player.getVideoData?.().video_id !== currentYoutubeVideoId) { - player.loadVideoById(currentYoutubeVideoId, position); - } else { + const sameVideo = player.getVideoData?.().video_id === currentYoutubeVideoId; + const playerState = player.getPlayerState?.(); + if (sameVideo && playerState === YT.PlayerState.PLAYING) { player.seekTo(position, true); + } else { + player.loadVideoById(currentYoutubeVideoId, position); } player.playVideo(); + setTimeout(() => { + player.playVideo(); + }, 150); } else { if (player.getVideoData?.().video_id !== currentYoutubeVideoId) { player.cueVideoById(currentYoutubeVideoId, position);