Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between window.AudioContext and navigator.getUserMedia

I've searched and read a few articles found through Google search, but can't find a laid out answer.

Besides initiation what is the difference between window.AudioContext and navigator.getUserMedia?

Also I already know getUserMedia can be used to also get camera stream, but this is more in the scope of audio. Browser support info would also be very helpful.

like image 434
Gerardlamo Avatar asked Jun 09 '26 20:06

Gerardlamo


1 Answers

getUserMedia() gets input data from microphones, camera or other locations (screencaptures (which will include audio capture soon), etc). It creates a MediaStream (with one or more MediaStreamTracks). You can also create MediaStreams from media elements (element.captureStream()/etc) or canvases (canvas.captureStream(...) - obviously video only). Note that captureStream() is in the process of being incorporated into the specs for MediaStreams.

An AudioContext is the grouping construct for WebAudio graphs. It isn't a source or even a processing node, it's a context (graph) the WebAudio code works in. You can feed a MediaStream (the audio tracks thereof) into a WebAudio AudioContext, or use other recorded or synthetic inputs/generators.

Very different constructs.

like image 123
jesup Avatar answered Jun 11 '26 10:06

jesup