From afc804b9b4d60d3907adc8170e3cc4c90c1155dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Roche?= Date: Fri, 11 Aug 2023 17:40:59 +0200 Subject: [PATCH] video format --- libs/webgl/components/content/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/webgl/components/content/index.js b/libs/webgl/components/content/index.js index 50ff5f2..0c0d530 100644 --- a/libs/webgl/components/content/index.js +++ b/libs/webgl/components/content/index.js @@ -51,7 +51,9 @@ export function Content() { .on('click', () => { const videoStream = gl.domElement.captureStream(60) - mediaRecorderRef.current = new MediaRecorder(videoStream) + mediaRecorderRef.current = new MediaRecorder(videoStream, { + mimeType: 'video/webm;codec=vp8', + }) let chunks = [] mediaRecorderRef.current.addEventListener('dataavailable', (e) => { @@ -61,11 +63,11 @@ export function Content() { mediaRecorderRef.current.start() mediaRecorderRef.current.addEventListener('stop', () => { - const blob = new Blob(chunks, { type: 'video/mp4' }) + const blob = new Blob(chunks, { type: 'video/webm;codec=vp8' }) const videoURL = URL.createObjectURL(blob) chunks = [] const link = document.createElement('a') - link.download = 'dithering.mp4' + link.download = 'dithering.webm' link.href = videoURL link.click() })