-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Implement preview support for mp4 files (#1127)
- Loading branch information
1 parent
71d9941
commit 4696d3b
Showing
10 changed files
with
93 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { IFileBlob } from "../../../api/model"; | ||
|
||
type AllProps = { | ||
fileItem: IFileBlob; | ||
}; | ||
|
||
const VideoDisplay = (props: AllProps) => { | ||
const { fileItem } = props; | ||
const { blob, url, fileType } = fileItem; | ||
const urlToFetch = url | ||
? url | ||
: blob | ||
? window.URL.createObjectURL(new Blob([blob], { type: blob.type })) | ||
: ""; | ||
const sourceType = url ? fileType : blob ? blob.type : ""; | ||
|
||
return ( | ||
// biome-ignore lint/a11y/useMediaCaption: <explanation> | ||
<video controls width="90%" height="90%"> | ||
<source src={urlToFetch} type={`video/${sourceType}`} /> | ||
{/* Fallback message for browsers that do not support video playback */} | ||
Your browser does not support the video tag. | ||
</video> | ||
); | ||
}; | ||
|
||
export default VideoDisplay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters