From ed407ad0447ec44bc368c82e306cf8d7a45ddc05 Mon Sep 17 00:00:00 2001 From: pajowu Date: Sun, 10 Dec 2023 00:50:48 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Play=20original=20file=20if=20it's?= =?UTF-8?q?=20the=20only=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/editor/player.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/editor/player.tsx b/frontend/src/editor/player.tsx index 8fb4f3f0..44413e53 100644 --- a/frontend/src/editor/player.tsx +++ b/frontend/src/editor/player.tsx @@ -45,9 +45,18 @@ export function PlayerBar({ const { videoSources, audioSources, hasVideo } = useMemo(() => { // do not play the original file, it may be large - const relevantMediaFiles = + let relevantMediaFiles = data?.media_files.filter((media) => !media.tags.includes('original')) || []; + // but if the original is all we have, better play this than nothing at all + if ( + relevantMediaFiles.length == 0 && + data?.media_files !== undefined && + data?.media_files.length > 0 + ) { + relevantMediaFiles = data.media_files; + } + const videoFiles = relevantMediaFiles.filter((media) => media.tags.includes('video')); const audioFiles = relevantMediaFiles.filter((media) => !media.tags.includes('video'));