Skip to content

fix: prevent ~1s autoplay flash when autoplay is disabled (#1461)#3936

Open
jiangyj545 wants to merge 1 commit into
code-charity:masterfrom
jiangyj545:fix/autoplay-immediate-pause-1461
Open

fix: prevent ~1s autoplay flash when autoplay is disabled (#1461)#3936
jiangyj545 wants to merge 1 commit into
code-charity:masterfrom
jiangyj545:fix/autoplay-immediate-pause-1461

Conversation

@jiangyj545

@jiangyj545 jiangyj545 commented Jun 7, 2026

Copy link
Copy Markdown

(Text assumed to be LLM spam removed)

…ty#1461)

When player_autoplay_disable is active and a video URL is opened in a
new tab, YouTube's player API (pauseVideo) has inherent latency because
it must wait for the yt-player wrapper to initialize. During this gap the
video plays for about 1 second, which is enough for YouTube to register
the view in watch history.

Fix: call the native HTML5 video.pause() on the underlying <video>
element BEFORE calling the YouTube player API. The HTML5 pause is
near-instant (no wrapper latency), so playback stops immediately
instead of after ~1 second. The YouTube API call is kept as a
synchronisation fallback.
@ImprovedTube2

Copy link
Copy Markdown
Collaborator

Hi and thanks! @jiangyj545 please let clear how serious each of your contributions is. We might appreciate LLM experiments too, yet not knowing what we are looking at is an unnecessary loss of efficiency and respectful workflow.

the raw HTML5 video.pause() is near-instant.

let's find out more?

1461 might not be fully uptodate?

6 years ago the following was replaced with .pauseVideo()

args.autoplay = '0';
args.suppress_autoplay_on_watch = true;
args.fflags = args.fflags.replace(/html5_new_autoplay_redux=true/g, 'html5_new_autoplay_redux=false');
args.fflags = args.fflags.replace(/allow_live_autoplay=true/g, 'allow_live_autoplay=false');
args.fflags = args.fflags.replace(/mweb_muted_autoplay=true/g, 'mweb_muted_autoplay=false');
args.fflags = args.fflags.replace(/web_player_kaios_autoplay=true/g, 'web_player_kaios_autoplay=false');
args.fflags = args.fflags.replace(/autoplay_time=8000/g, 'autoplay_time=0');
args.fflags = args.fflags.replace(/legacy_autoplay_flag=true/g, 'legacy_autoplay_flag=false');

3d8b9e8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Expert Wanted (or experiments / testing) Domain knowledge wanted untested please test. (also applies to proactively merged pull requests.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants