From 932949fdf1bdf3fcd62fcaa30257786d6bb9b92e Mon Sep 17 00:00:00 2001 From: rahim Date: Mon, 6 Apr 2026 22:25:44 -0700 Subject: [PATCH] fix(core): use 0.2 and 0.7 for default playback rates (#1236) --- .../tests/playback-rate-button-core.test.ts | 8 ++++---- packages/core/src/dom/store/features/playback-rate.ts | 2 +- site/src/content/docs/reference/playback-rate-button.mdx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/src/core/ui/playback-rate-button/tests/playback-rate-button-core.test.ts b/packages/core/src/core/ui/playback-rate-button/tests/playback-rate-button-core.test.ts index 192137c8..ded4620e 100644 --- a/packages/core/src/core/ui/playback-rate-button/tests/playback-rate-button-core.test.ts +++ b/packages/core/src/core/ui/playback-rate-button/tests/playback-rate-button-core.test.ts @@ -6,7 +6,7 @@ import { PlaybackRateButtonCore } from '../playback-rate-button-core'; function createMediaState(overrides: Partial = {}): MediaPlaybackRateState { return { - playbackRates: [0.25, 0.5, 0.75, 1, 1.2, 1.5, 1.7, 2], + playbackRates: [0.2, 0.5, 0.7, 1, 1.2, 1.5, 1.7, 2], playbackRate: 1, setPlaybackRate: vi.fn(), ...overrides, @@ -96,7 +96,7 @@ describe('PlaybackRateButtonCore', () => { const core = new PlaybackRateButtonCore(); const media = createMediaState({ playbackRate: 2 }); core.cycle(media); - expect(media.setPlaybackRate).toHaveBeenCalledWith(0.25); + expect(media.setPlaybackRate).toHaveBeenCalledWith(0.2); }); it('advances through the middle of the list', () => { @@ -124,12 +124,12 @@ describe('PlaybackRateButtonCore', () => { const core = new PlaybackRateButtonCore(); const media = createMediaState({ playbackRate: 3 }); core.cycle(media); - expect(media.setPlaybackRate).toHaveBeenCalledWith(0.25); + expect(media.setPlaybackRate).toHaveBeenCalledWith(0.2); }); it('cycles through sub-1x rates', () => { const core = new PlaybackRateButtonCore(); - const media = createMediaState({ playbackRate: 0.25 }); + const media = createMediaState({ playbackRate: 0.2 }); core.cycle(media); expect(media.setPlaybackRate).toHaveBeenCalledWith(0.5); }); diff --git a/packages/core/src/dom/store/features/playback-rate.ts b/packages/core/src/dom/store/features/playback-rate.ts index 6bb5a01f..164ef9d1 100644 --- a/packages/core/src/dom/store/features/playback-rate.ts +++ b/packages/core/src/dom/store/features/playback-rate.ts @@ -3,7 +3,7 @@ import { listen } from '@videojs/utils/dom'; import type { MediaPlaybackRateState } from '../../../core/media/state'; import { definePlayerFeature } from '../../feature'; -const DEFAULT_RATES: readonly number[] = [0.25, 0.5, 0.75, 1, 1.2, 1.5, 1.7, 2]; +const DEFAULT_RATES: readonly number[] = [0.2, 0.5, 0.7, 1, 1.2, 1.5, 1.7, 2]; export const playbackRateFeature = definePlayerFeature({ name: 'playbackRate', diff --git a/site/src/content/docs/reference/playback-rate-button.mdx b/site/src/content/docs/reference/playback-rate-button.mdx index e785a8d1..5095c60b 100644 --- a/site/src/content/docs/reference/playback-rate-button.mdx +++ b/site/src/content/docs/reference/playback-rate-button.mdx @@ -37,7 +37,7 @@ import basicUsageHtmlTs from "@/components/docs/demos/playback-rate-button/html/ ## Behavior -Cycles through playback rates on click. The default rate list is `[1, 1.2, 1.5, 1.7, 2]`. After the last rate, it wraps back to the first. If the current rate isn't in the list (e.g., set programmatically), the button jumps to the next rate greater than the current one. +Cycles through playback rates on click. The default rate list is `[0.2, 0.5, 0.7, 1, 1.2, 1.5, 1.7, 2]`. After the last rate, it wraps back to the first. If the current rate isn't in the list (e.g., set programmatically), the button jumps to the next rate greater than the current one. ## Styling