Skip to content

Conversation

@pzanella
Copy link

Related:

Closes: #1714

Description:

Fix YouTube Provider Seek Issues by adding allowSeekAhead parameter

This PR fixes a critical issue in the YouTube provider where seeking operations (especially currentTime = 0) would cause the player to get stuck in a "waiting" state or throw Uncaught TypeError: K.Wp.o1 is not a function errors.

Root Cause:
The YouTube iframe API's seekTo() method requires two parameters: seekTo(seconds, allowSeekAhead). Passing the first parameter, causing YouTube to reject seeks to unbuffered content and leading to corrupted internal state.
Here the YouTube documentation.

Changes Made:

  1. Updated YouTube provider's setCurrentTime() method to pass allowSeekAhead: true
  2. Modified command type definitions to support multiple arguments for seekTo
  3. Enhanced #remote() method to handle seekTo specially without double-wrapping arguments
  4. Added proper YouTube API compliance by passing both required parameters

Key Fix:

// Before (broken):
this.#remote('seekTo', time);

// After (fixed):
this.#remote('seekTo', [time, true]); // enables allowSeekAhead

This ensures YouTube receives player.seekTo(time, true); with the correct parameters, allowing seeks to any position regardless of buffer state.

Ready?

Yes - This PR is ready for review. The fix has been tested and resolves the YouTube seeking issues.

Anything Else?

  • All existing functionality preserved
  • Only affects YouTube provider behavior
  • Backward compatible with current API

@pzanella pzanella changed the title fix: youtube seekTo fix(youtube): add allowSeekAhead parameter to seekTo command Nov 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant