Skip to content

Commit

Permalink
fix(player): 0-9 key seeking stopped working
Browse files Browse the repository at this point in the history
  • Loading branch information
mihar-22 committed Feb 3, 2024
1 parent 2c51d76 commit 79636c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/vidstack/src/core/keyboard/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,15 @@ export class MediaKeyboardController extends MediaPlayerController {
return;
}

let { method, value } = this._getMatchingMethod(event);
let { method, value } = this._getMatchingMethod(event),
isNumberPress = !event.metaKey && /[0-9]/.test(event.key);

if (!isString(value) && !isArray(value)) {
if (!isString(value) && !isArray(value) && !isNumberPress) {
value?.callback(event);
return;
}

if (!method && !event.metaKey && /[0-9]/.test(event.key)) {
if (!method && isNumberPress) {
event.preventDefault();
event.stopPropagation();
this._media.remote.seek((this.$state.duration() / 10) * Number(event.key), event);
Expand Down

0 comments on commit 79636c1

Please sign in to comment.