Skip to content

Commit

Permalink
✨ Play original file if it's the only source
Browse files Browse the repository at this point in the history
  • Loading branch information
pajowu committed Dec 10, 2023
1 parent b7fa640 commit ed407ad
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion frontend/src/editor/player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand Down

0 comments on commit ed407ad

Please sign in to comment.