diff options
author | lonkaars <loek@pipeframe.xyz> | 2021-07-24 16:55:07 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2021-07-24 16:55:07 +0200 |
commit | def71ea56c99873af04dadc1c0e801d42c406826 (patch) | |
tree | a083576cf451f6370c273d5d4586ac02aaa10998 /components | |
parent | ff0609458ab50dd627b13b604f7c8c42af9a67b3 (diff) |
import net video saves in the cool new file format :tada:
Diffstat (limited to 'components')
-rw-r--r-- | components/videosourcesettings.tsx | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/components/videosourcesettings.tsx b/components/videosourcesettings.tsx index ae7f75b..f4cea9e 100644 --- a/components/videosourcesettings.tsx +++ b/components/videosourcesettings.tsx @@ -1,12 +1,18 @@ import { useRef } from 'react'; -import { LocalVideo } from '../project'; +import { TimedVideoPlayer } from '../pages/present'; +import { arrayBufferToBase64, LocalVideo } from '../project'; import Button from '@material-ui/core/Button'; import Switch from '@material-ui/core/Switch'; import { UploadRoundedIcon } from './icons'; -export function LocalVideoSettings(props: { settings: LocalVideo; }) { +type VideoSourceSettings = { + settings: LocalVideo; + player: TimedVideoPlayer; +}; + +export function LocalVideoSettings(props: VideoSourceSettings) { var fileUploadRef = useRef(null); return <> @@ -20,7 +26,10 @@ export function LocalVideoSettings(props: { settings: LocalVideo; }) { if (!file) return; var reader = new FileReader(); reader.addEventListener('load', async ev => { - props.settings.load(ev.target.result as ArrayBuffer); + var video = ev.target.result as ArrayBuffer; + props.settings.load(video); + props.settings.mimetype = file.type; + props.player.loadVideo(arrayBufferToBase64(video, file.type)); }); reader.readAsArrayBuffer(file); }} |