Copyright © 2013 Muaz Khan<@muazkh>.
Screens Preview |
Allow web pages to request access to the screen contents via the getUserMedia() API. #enable-usermedia-screen-capture
You must enable this flag via "chrome://flags"
<script src="https://www.webrtc-experiment.com/screen-sharing/screen.js"></script>
var screen = new Screen('screen-unique-id'); // get shared screens screen.onaddstream = function(e) { document.body.appendChild(e.video); }; // custom signaling channel // you can use each and every signaling channel // any websocket, socket.io, or XHR implementation // any SIP server // anything! etc. screen.openSignalingChannel = function(callback) { return io.connect().on('message', callback); }; // check pre-shared screens // it is useful to auto-view // or search pre-shared screens screen.check(); document.getElementById('share-screen').onclick = function() { screen.share('screen name'); }; // to stop sharing screen screen.leave();
Chrome Canary denies "screen capturing" request automatically if:
mandatory: {chromeMediaSource: 'screen'}
Remember, recursive cascade images or blurred screen is chrome's implementation issue. It will be solved soon.
mandatory: {chromeMediaSource: 'tab'} can only be useful in chrome extensions. See Tab sharing using tabCapture APIs.
Obviously, it is one of the most requested features; however not supported yet. Chrome WebRTC team is planning to support it in near future.
These screen sharing APIs (i.e. { chromeMediaSource: 'screen' }
) allows
only state-less (non-interactive) screen sharing.