Skip to content

[Bug] YouTube Provider: TypeError: K.Wp.o1 is not a function when attempting to programmatically seek to 0 #1714

@Gilsz

Description

@Gilsz

Current Behavior:
When attempting to programmatically restart a YouTube video (by setting player.currentTime = 0 or using remote.seek(0)), the player throws an Uncaught TypeError: K.Wp.o1 is not a function.

This error originates from the YouTube iframe's internal base.js and appears to happen when the player is in a paused, buffering, or ended state. The player gets "stuck" and cannot be restarted.

Expected Behavior:
When a user clicks a custom control (like an "Replay" overlay), the player should:

Seek to the beginning (currentTime = 0).

Unmute (muted = false).

Begin playback (play()).

Steps To Reproduce:
Initialize a with a YouTube provider (e.g., ).

Allow the video to play, then manually pause it.

From an external click handler (like a custom button or overlay), try to restart and unmute the video.

The following code, which attempts to fix the race condition from issue #1605, still fails:

JavaScript

// This code runs inside an async click handler
try {
// 1. Tell the player to pause.
console.log('[DEBUG] 1. Calling player.pause()');
await player.pause();

// 2. Wait for the 'pause' event to confirm it's done.
console.log('[DEBUG] 2. Waiting for "pause" event to complete...');
await new Promise(resolve => {
const onPause = () => {
player.removeEventListener('pause', onPause);
resolve();
};
player.addEventListener('pause', onPause);
});

// 3. This line triggers the error
console.log('[DEBUG] 3. "pause" event complete. Setting currentTime = 0');
player.currentTime = 0;

// 4. Unmute and play
player.muted = false;
player.volume = 1;
await player.play();

} catch (e) {
console.error("Error during 'Pause-Wait-Seek' process:", e);
}
Observe the console for the Uncaught TypeError: K.Wp.o1 is not a function error as soon as player.currentTime = 0 is set.

Error Log:
Uncaught TypeError: K.Wp.o1 is not a function
at uW.Y (base.js:11477:140)
at R82 (base.js:6122:276)
at g.H.TL (base.js:11655:255)
...
What We've Tried (Workarounds):
This appears to be a deep state issue in the YouTube provider, as all logical approaches fail:

Direct player.currentTime = 0: Causes the K.Wp.o1 error.

remote.seek(0): This request is dispatched but is ignored by the provider (no restart, no error).

remote.startLoading(): This also seems to have no effect. It does not reload the media or restart playback.

Play-then-Seek (player.play() -> listen for 'started' -> remote.seek(0)): The seek command is ignored.

Seek-then-Play (remote.seek(0) -> listen for 'seeked' -> player.play()): The initial seek command is ignored, so the 'seeked' event never fires.

It seems the YouTube provider is in a state where it will not accept any seek command (either direct or remote) when it is not actively playing. This makes it impossible to implement a custom "replay" button.

Environment:
Framework: Web Components (via CDN)

Browser: Chromium-based browsers (Chrome, Edge)

Vidstack: latest (from https://cdn.vidstack.io/player)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions