From 79636c1f568c8137f934ea3eb2bed29114b24f3f Mon Sep 17 00:00:00 2001 From: Rahim Alwer Date: Sat, 3 Feb 2024 20:23:49 +1100 Subject: [PATCH] fix(player): 0-9 key seeking stopped working --- packages/vidstack/src/core/keyboard/controller.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/vidstack/src/core/keyboard/controller.ts b/packages/vidstack/src/core/keyboard/controller.ts index de8b4607a..61ae00fb7 100644 --- a/packages/vidstack/src/core/keyboard/controller.ts +++ b/packages/vidstack/src/core/keyboard/controller.ts @@ -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);