Resume cued YouTube videos on play sync

This commit is contained in:
codex
2026-06-10 15:58:13 +02:00
parent 4bd6998d16
commit 3e6a94ae2e
+8 -3
View File
@@ -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);