The Media Capture API allows authorized web applications to access the streams from the device's audio and video capturing interfaces, i.e. to use the data available from the camera and the microphone. The streams exposed by the API can be bound directly to the HTML
<video> elements or read and manipulated in the code, including further more specific processing via Image Capture API, Media Recorder API or Real-Time Communication.
<file type="input" accept="image/*"> element allows launching any application that provides an image file, including camera.
- Prompts user for an access to the media interface specified by the
constraintsand returns a
Promisethat is resolved with the interface's stream handler.
- Returns a collection of audio tracks objects being provided by the device's microphone.
- Returns a collection of video tracks objects being provided by the device's camera.
mediaElement.srcObject = stream
- Sets a stream to be rendered into the provided
Previous version of the standard, supported with vendor prefixes, contained the callback-based
getUserMedia method directly within the
navigator.webkitGetUserMedia(constraints, successCallback, errorCallback)