I'm capturing a video of a canvas using MediaRecorder:
(async () => {
const stream = recordingCanvasCtx.canvas.captureStream();
const chunks = [];
videoRecorder.ondataavailable = e => chunks.push(e.data);
videoRecorder.onstop = async () => {
transcode(new Uint8Array(await (new Blob(chunks)).arrayBuffer()));
stopRecording();
};
videoRecorder.start();
setTimeout(() => {
videoRecorder.stop();
}, videoRecordDuration);
})();
Then transcoding using ffmpeg wasm:
const transcode = async (webcamData) => {
const name = 'record.webm';
ffmpeg.FS('writeFile', name, await fetchFile(webcamData));
await ffmpeg.run('-i', name, '-codec', 'copy', '-preset', 'superfast', '-crf', '27', 'output.mp4');
const data = ffmpeg.FS('readFile', 'output.mp4');
const video = document.getElementById('vidpreview');
video.src = URL.createObjectURL(new Blob([data.buffer], { type: 'video/mp4' }));
document.getElementById('viddiv').classList.add("show");
vidpreview.onloadeddata = function () {
playBtn.addEventListener('click', playVidAgain);
}
}
This all works and displays when running on a Windows laptop, but when trying to display the video.src on Android I see the following error in chrome://inspect:
ERR_REQUEST_RANGE_NOT_SATISFIABLE
Any ideas how to get this working are much appreciated