Show join YouTube prompt deterministically
This commit is contained in:
@@ -494,6 +494,15 @@ function handleYoutubeStateChange(event) {
|
||||
}
|
||||
if (event.data === YT.PlayerState.PLAYING) {
|
||||
setYoutubeStartPromptVisible(false);
|
||||
setTimeout(() => {
|
||||
if (
|
||||
Date.now() < youtubeStartPromptAllowedUntil &&
|
||||
desiredYoutubePlaying &&
|
||||
youtubePlayer?.getPlayerState?.() !== YT.PlayerState.PLAYING
|
||||
) {
|
||||
setYoutubeStartPromptVisible(true);
|
||||
}
|
||||
}, 700);
|
||||
}
|
||||
|
||||
if (![YT.PlayerState.PLAYING, YT.PlayerState.PAUSED, YT.PlayerState.ENDED].includes(event.data)) {
|
||||
@@ -598,6 +607,9 @@ async function applyWatchState(state, { suppressEvents = true, allowStartPrompt
|
||||
}
|
||||
|
||||
if (shouldPlay) {
|
||||
if (allowStartPrompt) {
|
||||
setYoutubeStartPromptVisible(true);
|
||||
}
|
||||
const sameVideo = player.getVideoData?.().video_id === currentYoutubeVideoId;
|
||||
const playerState = player.getPlayerState?.();
|
||||
if (sameVideo && ![YT.PlayerState.UNSTARTED, YT.PlayerState.CUED].includes(playerState)) {
|
||||
|
||||
Reference in New Issue
Block a user