From 0e08a5e7492498a8c43c94277e6c3f311da8fa53 Mon Sep 17 00:00:00 2001 From: kontrollanten <6680299+kontrollanten@users.noreply.github.com> Date: Wed, 28 Dec 2022 20:59:02 +0100 Subject: feat(player/playbackRate): set rate with url param --- client/src/app/+videos/+video-watch/video-watch.component.ts | 2 ++ client/src/assets/player/peertube-player-manager.ts | 4 ++++ client/src/assets/player/types/manager-options.ts | 2 ++ 3 files changed, 8 insertions(+) (limited to 'client') diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index 94853423b..fa0417832 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -295,6 +295,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { subtitle: queryParams.subtitle, playerMode: queryParams.mode, + playbackRate: queryParams.playbackRate, peertubeLink: false } @@ -657,6 +658,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { muted: urlOptions.muted, loop: urlOptions.loop, subtitle: urlOptions.subtitle, + playbackRate: urlOptions.playbackRate, peertubeLink: urlOptions.peertubeLink, diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts index 710c9dc87..413ec2b80 100644 --- a/client/src/assets/player/peertube-player-manager.ts +++ b/client/src/assets/player/peertube-player-manager.ts @@ -97,6 +97,10 @@ export class PeertubePlayerManager { videojs(options.common.playerElement, videojsOptions, function (this: videojs.Player) { const player = this + if (!isNaN(+options.common.playbackRate)) { + player.playbackRate(+options.common.playbackRate) + } + let alreadyFallback = false const handleError = () => { diff --git a/client/src/assets/player/types/manager-options.ts b/client/src/assets/player/types/manager-options.ts index 3057a5adb..78b2e30f4 100644 --- a/client/src/assets/player/types/manager-options.ts +++ b/client/src/assets/player/types/manager-options.ts @@ -29,6 +29,8 @@ export interface CustomizationOptions { resume?: string peertubeLink: boolean + + playbackRate: number | string } export interface CommonOptions extends CustomizationOptions { -- cgit v1.2.3