Resume cued YouTube videos on play sync
This commit is contained in:
+8
-3
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user