- Edited
I am a developer on a project that uses the MediaRecorder API to access the microphone through the browser. We start and stop the microphone multiple times to play audio feedback in between.
The MediaRecorder instance reports its status as "recording" while the microphone is active, and "inactive" when the microphone is not active.
This works fine in Orion the first time the MediaRecorder is created and started. Subsequent attempts to start the MediaRecorder within the same page load result in the MediaRecorder status being reported as "recording" and onStart
callbacks being triggered prematurely, before the microphone is actually recording audio. In Safari (and other browsers) this does not happen. Instead each subsequent invocation behaves the same as the first with regard to the status being reported and callbacks/events being triggered.
The impact of this is that it is not possible for us to synchronize the UI with the microphone recording state in Orion. We end up showing a recording indicator prematurely (by about 3 seconds), leading to the audio missing the first seconds of the clip. This is detrimental for our use case.
I have attached a video demonstrating this. In it there are two instances of a simple recorder component. They are identical, but their behavior will differ due to the described bug. On the first, you can see that it takes a few seconds for the MediaRecorder to start. Once stopped, the audio recorded is provided to an <audio> element where the duration is shown. The duration reflects the total time the recorder was reported as active. On the second attempt, you can see that the MediaRecorder reports its status as "recording" nearly instantly, and despite this, when I stop the recorder after approximately the same length of time as the first, the <audio> element shows a similar total length. The recorded audio files confirm this as well.
The MediaRecorder should report its status accurately on every invocation.
0.99.126.4.1-beta (WebKit 618.1.2)
Sonoma (14)