diff options
Diffstat (limited to 'src/client/views/nodes/RecordingBox/RecordingView.tsx')
-rw-r--r-- | src/client/views/nodes/RecordingBox/RecordingView.tsx | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/client/views/nodes/RecordingBox/RecordingView.tsx b/src/client/views/nodes/RecordingBox/RecordingView.tsx index 0d24f3c74..3a79f790f 100644 --- a/src/client/views/nodes/RecordingBox/RecordingView.tsx +++ b/src/client/views/nodes/RecordingBox/RecordingView.tsx @@ -27,7 +27,6 @@ interface IRecordingViewProps { const MAXTIME = 1000; export function RecordingView(props: IRecordingViewProps) { - const { setResult } = props const [recording, setRecording] = useState(false); const recordingTimerRef = useRef<number>(0); @@ -52,11 +51,11 @@ export function RecordingView(props: IRecordingViewProps) { width: 1280, height: 720, }, - audio: { - echoCancellation: true, - noiseSuppression: true, - sampleRate: 44100 - } + // audio: { + // echoCancellation: true, + // noiseSuppression: true, + // sampleRate: 44100 + // } } useEffect(() => { @@ -75,7 +74,7 @@ export function RecordingView(props: IRecordingViewProps) { type: 'video/webm' }) const blobUrl = URL.createObjectURL(blob) - const videoFile = new File([blob], "video", { lastModified: new Date().getDate() }); + const videoFile = new File(allVideoChunks, "video", { type: allVideoChunks[0].type, lastModified: Date.now() }); videoElementRef.current!.srcObject = null videoElementRef.current!.src = blobUrl @@ -89,12 +88,20 @@ export function RecordingView(props: IRecordingViewProps) { // } // } - Networking.UploadFilesToServer(allVideoChunks) + Networking.UploadFilesToServer(videoFile) .then((data) => { - console.log(data) + const result = data[0].result + if (!(result instanceof Error)) { // convert this screenshotBox into normal videoBox + props.setResult(result) + } else { + alert("video conversion failed"); + } }) // uploadVideo() + // this.dataDoc[this.fieldKey + "-duration"] = (new Date().getTime() - this.recordingStart!) / 1000; + + // change to one recording box } @@ -150,6 +157,8 @@ export function RecordingView(props: IRecordingViewProps) { } const startShowingStream = async (mediaConstraints = DEFAULT_MEDIA_CONSTRAINTS) => { const stream = await navigator.mediaDevices.getUserMedia(mediaConstraints) + // const stream = await navigator.mediaDevices.getUserMedia({ video: true }); + videoElementRef.current!.src = "" videoElementRef.current!.srcObject = stream |