From dcd7595c07ba0132a4e316d5dcda90b9a7a14eef Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Thu, 5 May 2022 11:06:47 +1000 Subject: [PATCH] Change playback rates and fix rates after seeking (#2550) --- ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx b/ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx index 50decfa13..5308faaaf 100644 --- a/ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx +++ b/ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx @@ -147,7 +147,7 @@ export const ScenePlayer: React.FC = ({ chaptersButton: false, }, nativeControlsForTouch: false, - playbackRates: [0.75, 1, 1.5, 2, 3, 4], + playbackRates: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2], inactivityTimeout: 2000, preload: "none", userActions: { @@ -351,6 +351,12 @@ export const ScenePlayer: React.FC = ({ handleError(true); }); + // changing source (eg when seeking) resets the playback rate + // so set the default in addition to the current rate + player.on("ratechange", function (this: VideoJsPlayer) { + this.defaultPlaybackRate(this.playbackRate()); + }); + player.on("loadedmetadata", () => { if (!player.videoWidth() && !player.videoHeight()) { // Occurs during preload when videos with supported audio/unsupported video are preloaded.