From bcd3d50b4209a4f66a259b8a3f6ea5ffd908471f Mon Sep 17 00:00:00 2001 From: Levente Kiss Date: Wed, 12 Feb 2025 11:35:46 +0100 Subject: [PATCH] feat: vod display (#686) * feat: preview for html5 supported videos * fix: handle out of limit tags * feat: support preview on the donwload screen * refactor: rework meta and preview handling to be more general * fix: missing meta * fix: do not allow maybe or probably types * fix: make the media check more strict --------- Co-authored-by: Levente Kiss --- src/components/FitVideo.tsx | 29 ++++++++++++++++++ src/constants.ts | 3 +- src/pages/files/AssetPreview.tsx | 47 +++++++++++++++++++---------- src/pages/files/AssetSyncing.tsx | 21 ++++++++----- src/pages/files/Share.tsx | 51 +++++++++++++++----------------- src/pages/files/Upload.tsx | 24 +++------------ src/providers/File.tsx | 22 ++++++++++---- src/react-app-env.d.ts | 6 ++-- src/utils/file.ts | 9 ++++-- src/utils/image.ts | 33 ++++++++++++++------- src/utils/manifest.ts | 10 +++++-- src/utils/video.ts | 8 +++++ 12 files changed, 170 insertions(+), 93 deletions(-) create mode 100644 src/components/FitVideo.tsx create mode 100644 src/utils/video.ts diff --git a/src/components/FitVideo.tsx b/src/components/FitVideo.tsx new file mode 100644 index 0000000..1c55fcc --- /dev/null +++ b/src/components/FitVideo.tsx @@ -0,0 +1,29 @@ +import { createStyles, makeStyles } from '@material-ui/core' +import { ReactElement } from 'react' + +const useStyles = makeStyles(() => + createStyles({ + video: { + width: '100%', + height: '100%', + objectFit: 'cover', + }, + }), +) + +interface VideoProps { + src: string | undefined + maxHeight?: string + maxWidth?: string +} + +export function FitVideo(props: VideoProps): ReactElement { + const classes = useStyles() + + const inlineStyles: Record = {} + + props.maxHeight && (inlineStyles.maxHeight = props.maxHeight) + props.maxWidth && (inlineStyles.maxWidth = props.maxWidth) + + return