Capture the users screen, application, audio or video and share over a WebRTC PeerConnection. This simple demo consists of a presenter who shares their screen or applications and an attendee who views that share video on a web page or a chrome extension. The attendee can be either a Chrome extension or Firefox browser. The presenter must be using Chrome or a Chrome extension. So right now this is a two user demo, one presentor and one attendee only.
This repo has three pieces.
- Chrome packaged app to share screen applications and audio\video. Can be used both peers being presentor or attendee depending who shares first.
- Server application using node.js and web socket to relay messages between peers.
- Attendee: Web page that receives and displays the shared video stream (Chrome or Firefox).
- Presenter and Attendee packaged apps only work using Google Chrome, (Stable, Canary or Chromium).
- No need for a Web Server, it uses node.js which does both the WebRTC signaling and serves up the presentor web page.
function onAccessApproved(id) {
if (!id) {
console.log("Access rejected");
return;
}
navigator.webkitGetUserMedia({
audio: false,
video: { mandatory: { chromeMediaSource: "desktop",
chromeMediaSourceId: id,
maxWidth: screen.width,
maxHeight: screen.height,
minFrameRate: 1,
maxFrameRate: 5 }}
}, gotStream, getUserMediaError);
}
document.querySelector('#share').addEventListener('click', function(e) {
pending_request_id = chrome.desktopCapture.chooseDesktopMedia(
["screen", "window"], onAccessApproved);
});
- Install Node.js and websocket (sudo npm install websocket)
- clone this repo to your machine, does not need to be to a web server.
- Edit packaged_app/app.js (insert this machines ip address for WebSocket connection). Or use configure button when running.
- run 'node app.js' or 'sudo node app.js' depending on your user, try both.
- Install packaged app in chrome
- i.e. open 'chrome://extensions'
- click 'Developer Mode' check box.
- Click button 'Load unpacked extension'
- Navigate to the packaged_app folder of this repo
- Launch app by clicking 'launch' link in chrome://extensions
- Or use Chrome App Launcher to launch it.
- Start Chrome or Firefox browser
- Point browser to e.g. http://<your node.js ip address>:1337
- You can test this on the same machine or across the network over two machines.