Skip to content

Fix YouTube seek resetting native playback speed to 1x#1532

Open
ColtonIdle wants to merge 1 commit into
igrigorik:masterfrom
ColtonIdle:patch-1
Open

Fix YouTube seek resetting native playback speed to 1x#1532
ColtonIdle wants to merge 1 commit into
igrigorik:masterfrom
ColtonIdle:patch-1

Conversation

@ColtonIdle

Copy link
Copy Markdown

Note: I verified the fix myself, but this change was done completely by AI, as well as the following description. This was mostly done to start a conversation with a possible solution. I'm an android dev so this chrome extension code goes over my head =)

Summary

Fixes YouTube/native-player speed changes being lost after seeking or unpausing.

The extension previously treated any unhandled click/key as possible native speed-control intent. On YouTube, seeking can trigger a playbackRate reset to 1x right after a progress-bar click, so the extension accepted that reset as the user's chosen speed.

This change narrows gesture tracking to likely native speed controls and known native speed shortcuts (< / >), so generic seek clicks continue to fight back to the selected speed.

Also allows a native speed-menu change to establish in-session lastSpeed even before the extension has set a speed itself.

Fixes #1521.

Tests

  • npm test -- tests/unit/utils/event-manager.test.js
  • npm run test:unit
  • npm run lint -- src/utils/event-manager.js tests/unit/utils/event-manager.test.js
  • npm run build

Note: I verified the fix myself, but this change was done completely by AI, as well as the following description. This was mostly done to start a conversation with a possible solution. I'm an android dev so this chrome extension code goes over my head =)

## Summary

Fixes YouTube/native-player speed changes being lost after seeking or unpausing.

The extension previously treated any unhandled click/key as possible native speed-control intent. On YouTube, seeking can trigger a playbackRate reset to `1x` right after a progress-bar click, so the extension accepted that reset as the user's chosen speed.

This change narrows gesture tracking to likely native speed controls and known native speed shortcuts (`<` / `>`), so generic seek clicks continue to fight back to the selected speed.

Also allows a native speed-menu change to establish in-session `lastSpeed` even before the extension has set a speed itself.

Fixes igrigorik#1521.

## Tests

- `npm test -- tests/unit/utils/event-manager.test.js`
- `npm run test:unit`
- `npm run lint -- src/utils/event-manager.js tests/unit/utils/event-manager.test.js`
- `npm run build`
@lucascehn

Copy link
Copy Markdown

I ran into this bug, realized this extension was the one causing the issue, tried the fix and it worked :-)

@lucascehn

Copy link
Copy Markdown

Found another bug:

  1. Play vid at 2x speed
  2. Pause it
  3. Go to a diff tab
  4. Return back to vid
  5. Unpause it
    It'll play at 1x speed again

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.

Speed resets to default when unpausing or seeking

2 participants