Media Capture and Streams

Summary

Usage

The MediaStream interface is used to represent streams of media data, typically (but not necessarily) of audio and/or video content, e.g. from a local camera. Each MediaStream object can contain zero or more tracks, in particular audio and video tracks. And each track in a MediaStream object has a corresponding MediaStreamTrack object.

A MediaStreamTrack represents content comprising one or more channels, where the channels have a defined well known relationship to each other (such as a stereo or 5.1 audio signal).

A new MediaStream object can be created from accessible media sources using the MediaStream() constructor, or generated by a getUserMedia() call. After calling navigator.getUserMedia the user is asked for permission to let the browser access the camera or the microphone.