Post

Replies

Boosts

Views

Activity

MediaRecorder onstop callback doesn't get called in iOS15
Hi, I'm using MediaRecorder for screen recording of canvas , along with audio. simplified code to implement screen recorder //intialise stream const canvas = document.querySelector('.main-canvas'); const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); for (let track of canvas.captureStream().getTracks()) { stream.addTrack(track); } recorder = new MediaRecorder(stream); chunks = []; recorder.ondataavailable = ({ data }) => { if (data) chunks.push(data); }; recorder.start(); recorder.onstop = () => { const videoBlob = new Blob(chunks, { type: 'video/mp4' }); chunks = [] //stop mic access after use try{ for (let track of stream.getTracks()) { track?.stop(); } }catch(e){} return videoBlob; } so when i call recorder.stop() , the recorder.onstop method is not getting called sometimes randomly. And also in case when recorder.onstop is not called , recorder.ondataavailable is not called even a single time,So it returns empty Blob output. This only occurs in iOS 15 device's , it occurs randomly 40% of the times. Is there any workaround for this, or what is cause of this issue? Thanks in advance
6
2
2.2k
Nov ’21