fix(youtube): add allowSeekAhead parameter to seekTo command
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:
- Updated YouTube provider's
setCurrentTime()method to passallowSeekAhead: true - Modified command type definitions to support multiple arguments for
seekTo - Enhanced
#remote()method to handleseekTospecially without double-wrapping arguments - 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