W3C home > Mailing lists > Public > public-webrtc-logs@w3.org > December 2019

Re: [mediacapture-record] Add method MediaRecorder.restart considering this use case. (#178)

From: Jean-Yves Avenard via GitHub <sysbot+gh@w3.org>
Date: Tue, 17 Dec 2019 22:02:59 +0000
To: public-webrtc-logs@w3.org
Message-ID: <issue_comment.created-566769157-1576620178-sysbot+gh@w3.org>
Few issues in your code.
First, you must ensure that the format coming out of the recorder is a container supported by MSE (Firefox only supports mp4 and webm). Ogg isn't a supported type with MSE (that's by spec)

Second, your code will call sendToAnotherClient whenever new data is available, which will ultimately call sourceBuffer.appendBuffer(). This will likely error too after the 2nd call to sendToAnotherClient.

Per spec, appendBuffer is an asynchronous operation and the events update, updateend will be fired on the source buffer once the operation is complete.
You *must* wait for that event to have been fired before you can call appendBuffer again, otherwise you will cause an error to be thrown.
https://w3c.github.io/media-source/#sourcebuffer-prepare-append
"If the updating attribute equals true, then throw an InvalidStateError exception and abort these steps."
the updating attribute is set to true when you call appendBuffer and it goes back to being false once the updateend event is fired.

-- 
GitHub Notification of comment by jyavenard
Please view or discuss this issue at https://github.com/w3c/mediacapture-record/issues/178#issuecomment-566769157 using your GitHub account
Received on Tuesday, 17 December 2019 22:03:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:22:35 UTC