Firefox 22 mozGetUserMedia using the โ€œscreenโ€ as the device source

There was some hype in the WebRTC browser in Firefox 22. This is for those who know about the development of Firefox: is there any support in Firefox for writing to the desktop screen?

The technology exists for Chrome 26+, which provides experimental support for screen capture (using the "screen" as the source of the device); code (snippet) for this:

// select any supported getUserMedia function navigator.getMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia); // if getUserMedia is not supported, do nothing if( !navigator.getMedia ) return; // request for user media navigator.getMedia( { video : { mandatory : { // request 'screen' as a source media chromeMediaSource : 'screen' } } }, // success function( localMediaStream ) { // process local media stream... }, // failure function( error ) { // error handling }); 

Looking at W3C documents, the MediaSourceConstraints, MediaTrackConstraints, MediaTrackConstraintsSet are not yet standardized. It may just be that the API is too foggy for this feature to appear in Firefox production. It would be nice to know the current state of support.

+7
javascript html5 firefox webrtc getusermedia
source share
2 answers

This is now possible in Firefox, however, due to security issues, support is hidden behind some preferences. In particular, the preferences of media.getusermedia.* In the about:config section.

This comment in the Mozilla bug report illustrates some of these issues:

Now that we have reworked <input type="file"> so as not to draw the full path on the screen, everything will be better. We still have problems with things like drawing crosshairs and <iframe> s.

Even if the user refuses, I will worry about situations such as โ€œthe user loads the application page A on one tab and the application page B on another tab, page B asks for permission to share the page on page A, which looks good, the user accepts, then the application changes the <iframe> FB or gmail or something on page A and captures the content.

Although media.getusermedia.screensharing.enabled is currently true by default in the release channel, only domains that are whitelisted under media.getusermedia.screensharing.allowed_domains allowed.

If your domain is on the allowed list, you can use it using the following keys in the video property.

 video: { mozMediaSource: "screen", mediaSource: "screen" } 

Mozilla hosts the getUserMedia test page in the domain marked by the white browser Firefox Nightly and Firefox Developer Edition. If you are using one of these versions of Firefox, you can see it in action. Alternatively, you can add the domain to the white list under about:config and use it in the release and beta channels.

+4
source share

No, Firefox has not yet added escaping as Chrome: https://bugzilla.mozilla.org/show_bug.cgi?id=742832

+4
source share

All Articles