[Webkit-unassigned] [Bug 232981] New: MediaRecorder API onstop callback doesn't get called

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 10 20:06:28 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=232981

            Bug ID: 232981
           Summary: MediaRecorder API onstop callback doesn't get called
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: iPhone / iPad
                OS: iOS 15
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebRTC
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: rajaaluri66 at gmail.com
                CC: youennf at gmail.com

Hi,

I'm using MediaRecorder for screen recording of canvas , along with audio.

simplified code to implement screen recorder
/* code starts here */
//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;
}

/* code ends here */
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

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211111/786b03a8/attachment-0001.htm>


More information about the webkit-unassigned mailing list