Media/getUserMedia: Difference between revisions

Jump to navigation Jump to search
Total rewrite; still needs more work
(Total rewrite; still needs more work)
Line 1: Line 1:
= getUserMedia Implementation Roadmap =
= getUserMedia =


== Goal ==
== Goal ==
* Need [https://wiki.mozilla.org/Media/getUserMedia/Desktop_gUM_UI UI for desktop] -- Done
* Define and implement navigator.getUserMedia 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]


* Implement getUserMedia on Desktop, then Android, then B2G -- Implemented on Desktop, defaults to enabled in FF20 and FF21
== Status ==
* Implement getUserMedia on Desktop, then Android, then B2G -- Implemented on Desktop (Windows, Mac and Linux), defaults to enabled in FF20 and FF21
** Currently prefixed as mozGetUserMedia() since the spec is still in flux
** For FF19 and FF18, you need to set <b><tt>media.navigator.enabled</tt></b> to true, or <tt><b> media.peerconnection.enabled</b></tt> to true.
* Permissions UI is supported, allowing selecting a device or rejecting permission, with notifications that a tab is using a mic or camera, and a global dropdown of all tabs using mics/cameras.
* Persistent permissions are not yet supported
* Explicit revocation of permission currently requires navigating away or closing the tab.
* Supports multiple tabs getting data from the same mic or camera (if the user allows)
* Capture resolution currently fixed to 640x480 for video; 16000Hz for audio
* No echo cancellation is turned on in getUserMedia, so connecting an captured audio stream to an audio element may cause feedback


* Needed to unblock WebRTC
* 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>


* Includes the following uses of getUserMedia:
Example use in FF:
<pre>
<pre>
   getUserMedia({picture: true}, onsuccess(Blob blob), onerror);
   mozGetUserMedia({picture: true}, onsuccess(Blob blob), onerror);


   getUserMedia({video: true, audio: true},  
   mozGetUserMedia({video: true, audio: true},  
              function (MediaStream stream) { video.mozSrcObject = stream; },
                  function (MediaStream stream) { video.mozSrcObject = stream; },
              function (err) { dump("mozGetUserMedia error: " + err); } );
                  function (err) { dump("mozGetUserMedia error: " + err); } );
</pre>
</pre>


* Appropriate permission, notification and status UIs. - done
Demos: [http://mozilla.github.com/webrtc-landing| WebRTC demos including mozGetUserMedia]
 
== Phase 1 ==
 
* Implement image capture {picture:true} API
** Android: {{bug|738528}} [Anant]
** B2G: {{bug|749886}} [Fabrice]
 
* Define common abstraction "MediaEngine" for device access across multiple platforms.
** Cross-platform: {{bug|750943}} [Suhas/Anant]
*** (crypt's version in {{bug|739566}})
 
* Define "chrome" extensions to MediaStreams for privileged JS code (and B2G's) use. This includes CameraControl features (https://wiki.mozilla.org/WebAPI/CameraControl).
** B2G: {{bug|752352}} [Fabrice]
 
* Implement a fallback backend for MediaEngine (when hardware support not available, returnMediaStream with white noise, for example).
** Cross-platform: {{bug|752351}} [Anant]
 
* Write DOM bindings for getUserMedia (backed with Fallback MediaEngine).
** Cross-platform: {{bug|752353}} [Anant]
*** (split code from {{bug|691234}} into this one)
*** Dependent on MediaStreams need Notify callbacks:
**** Cross-platform: {{bug|759908}}
 
* Implement MediaEngine backend
** B2G: {{bug|740997}} [Fabrice] (based on Gonk)
 
== Phase 2 ==
* Define "chrome" extensions to MediaStreams for privileged JS code use. This includes CameraControl features .
** Android and Desktop: bug(s) to be created
 
* Implement MediaEngine backends:
** Android: bug ??? (either based on Android NDK/SDK, or, webrtc.org code).
** Desktop: {{bug|691234}} [Anant] (based on webrtc.org code).
 
* Implement image capture {picture:true} API
** Desktop: {{bug|749887}} [???]
*** ({{bug|692955}} tracking <input> on Desktop, reuse possible. {{bug|748835}} tracking UI).
 
== Phase 3 ==
* Implement permissions, notification & status UI
** Android: {{bug|749881}}
** B2G: {{bug|749882}}
** Desktop: {{bug|729522}} and {{bug|748835}} -- since the camera/mic UI for WebRTC and Camera API are becoming almost the same, these bugs may now be duplicates [???]
 
Once UI lands, getUserMedia may be pref'ed on.


== Phase 4 and beyond ==
== Differences from Chrome webkitGetUserMedia() ==
* Implement file backend for MediaEngine.
Includes, but not limited to:
* Refactor getUserMedia{picture:true} implementations to use MediaEngine + privileged MediaStreams and CameraControl APIs.
* Name :-)
* Firefox leaves the mic/camera active (light on, etc) until the application explicitly calls mediastream.stop().  Chrome turns them on when assigned to a media element or PeerConnection, and off again when removed.
** Note that if an application drops all references to a MediaStream but does not call stop(), the camera will remain active for some period of time (or until you navigate to another page in the tab or close the tab).
** 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)
* **This list needs to be expanded**
Confirmed users
325

edits

Navigation menu