From 0f5162bd68c5d91f9b59678af80511c593e8113d Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 31 Jan 2023 20:15:16 -0800 Subject: [PATCH] video: allow setting default quality (fix #364) --- lib/Controller/PageController.php | 1 + src/components/viewer/PsVideo.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index df9e17d6..fb500503 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -132,6 +132,7 @@ class PageController extends Controller // Video configuration $initialState->provideInitialState('notranscode', $config->getSystemValue('memories.no_transcode', 'UNSET')); + $initialState->provideInitialState('video_default_quality', $config->getSystemValue('memories.video_default_quality', '0')); } /** diff --git a/src/components/viewer/PsVideo.ts b/src/components/viewer/PsVideo.ts index 8196a0bd..812407e4 100644 --- a/src/components/viewer/PsVideo.ts +++ b/src/components/viewer/PsVideo.ts @@ -14,6 +14,10 @@ const config_noTranscode = loadState( "UNSET" ) as boolean | string; +const config_video_default_quality = Number( + loadState("memories", "video_default_quality", "0") as string +); + /** * Check if slide has video content * @@ -309,7 +313,7 @@ class VideoContentSetup { if (qualityNums) { opts.quality = { - default: 0, + default: config_video_default_quality, options: qualityNums, forced: true, onChange: (quality: number) => {