I want to understand the Web API a bit better, specifically how the media recording works. I know I can record the media using the MediaRecorder
, but that’s a pretty high level.
<code>navigator.mediaDevices.getUserMedia({ audio: true }).then((mediaStream) => {
// How do I tap into the actual data stream from the microphone?
// Without using the MediaRecorder as illustrated bellow
const mediaRecorder = new MediaRecorder(mediaStream);
mediaRecorder.start();
mediaRecorder.ondataavailable = (e) => { /*...*/ }
});
</code>
<code>navigator.mediaDevices.getUserMedia({ audio: true }).then((mediaStream) => {
// How do I tap into the actual data stream from the microphone?
// Without using the MediaRecorder as illustrated bellow
const mediaRecorder = new MediaRecorder(mediaStream);
mediaRecorder.start();
mediaRecorder.ondataavailable = (e) => { /*...*/ }
});
</code>
navigator.mediaDevices.getUserMedia({ audio: true }).then((mediaStream) => {
// How do I tap into the actual data stream from the microphone?
// Without using the MediaRecorder as illustrated bellow
const mediaRecorder = new MediaRecorder(mediaStream);
mediaRecorder.start();
mediaRecorder.ondataavailable = (e) => { /*...*/ }
});
I thought I could tap into the mic data stream myself, but after exploring the MediaStreamTrack API, I don’t see any indication of how to do this. It seems that MediaStreamTrack
only contains metadata, not the actual data stream or any onDataAvailable
event.