Skip to content

Instantly share code, notes, and snippets.

@mlakkadshaw
Forked from anonymous/An-Anonymous-Pen.markdown
Last active December 24, 2015 21:19
Show Gist options
  • Save mlakkadshaw/6864200 to your computer and use it in GitHub Desktop.
Save mlakkadshaw/6864200 to your computer and use it in GitHub Desktop.

Screensharing using chromecast

Download this package

open terminal cd into this directory and run node app.js

<video src=""></video>
navigator.getMedia = ( navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia);
navigator.getMedia (
// constraints
{
video: {
mandatory: {
chromeMediaSource: 'screen',
maxWidth: 1280,
maxHeight: 800
}
},
// successCallback
function(localMediaStream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(localMediaStream);
video.onloadedmetadata = function(e) {
// Do something with the video here.
};
},
// errorCallback
function(err) {
console.log("The following error occured: " + err);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment