Change playback rates and fix rates after seeking (#2550)

This commit is contained in:
WithoutPants 2022-05-05 11:06:47 +10:00 committed by GitHub
parent ce175dcfc6
commit dcd7595c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -147,7 +147,7 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
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<IScenePlayerProps> = ({
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.