Changes

Jump to: navigation, search

Media/getUserMedia

306 bytes added, 20:57, 2 April 2015
Updated information to present day.
== Goal ==
* Define and implement navigator.mediaDevices.getUserMedia () and associated functions with the W3C's WebRTC WG and Media Capture Task Force
* Current editor's draft: [http://dev.w3.org/2011/webrtc/editor/getusermedia.html W3 getUserMedia Editor's Draft]
* Scenarios: [https://dvcs.w3.org/hg/dap/raw-file/tip/media-stream-capture/scenarios.html W3 MediaStream Capture Scenarios]
== Status ==
* Implement Implemented getUserMedia on Desktop, then Android, then B2G -- Implemented on Desktop (Windows, Mac and Linux), defaults to enabled Android, and B2G. Enabled in FF20 and FF21+.** Currently Still prefixed as mozGetUserMedia() since the . The spec is still in fluxat Candidate Recommendation.** For FF19 and before, you need to set Can be turned off by setting <b><tt>media.navigator.enabled</tt></b> to true, or and <tt><b> media.peerconnection.enabled</b></tt> to truefalse.* Permissions UI is supported, allowing selecting a device devices or rejecting permission, with notifications that a tab is using a mic or camera, and a global dropdown of all indicator on the desktop to locate tabs using mics/cameras.* Persistent permissions are not yet supported.* Explicit revocation of permission currently requires navigating away or closing the tabis supported.
* Supports multiple tabs getting data from the same mic or camera (if the user allows)
* Capture resolution currently can be controlled with standard constraints for width, height, frameRate and (on mobile) facingMode can be used to choose between front/back camera. Supported in FF32+.* Audio rate is fixed to 640x480 for video; at 16000Hz for audio.* No echo Echo cancellation is turned on in getUserMediaby default, so but connecting an a captured audio stream directly to an audio element on the same system may still cause feedbackunless a headset is used.* Promise-based mediaDevices.getUserMedia API is supported in FF36+.* Input device enumeration through mediaDevices.enumerateDevices() is supported in FF39+.
* Minimal constraints supported: (Note: all of these booleans default to 'false')<pre> video: true/false audio: true/false fake: true/false picture: true/false</pre>== Examples ==
Example use in FF* See [https:<pre> mozGetUserMedia({picture: true}, onsuccess(Blob blob), onerror);//developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Frame_rate mediaDevices.getUserMedia on developer.mozilla.org] for examples.
mozGetUserMedia({video: true, audio: true}, function (MediaStream stream) { video.mozSrcObject = stream; }, function (err) { dump("mozGetUserMedia error: " + err); } );</pre>= Demos ==
Demos: * See [http://mozilla.github.io/webrtc-landing WebRTC demos including mozGetUserMedia]
== Differences from Chrome webkitGetUserMedia() ==
** This behavior may change in the future
* Both now support window.URL.createObjectURL(stream), though Mozilla recommends against using it unless you have to. We expect Chrome to support srcObject = stream soon (perhaps prefixed as we are currently)
* Firefox does not support Chrome's outdated constraints syntax.
* Firefox does not support MediaStreamTrack.getSources(), an outdated version of enumerateDevices.
* Use the [https://github.com/webrtc/adapter adapter.js] shim to bridge cross-browser differences (constraints polyfill should be forthcoming).
24
edits

Navigation menu