Skip to content

Instantly share code, notes, and snippets.

@lfender6445
Created April 27, 2014 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfender6445/11357060 to your computer and use it in GitHub Desktop.
Save lfender6445/11357060 to your computer and use it in GitHub Desktop.
<template name='video'>
<p align="center"><input type="button" id="share_screen" value="Share screen"/></p>
<p align="center"><video id="video" autoplay='autoplay'></video></p>
<script language="javascript">
navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.getUserMedia;
$('#share_screen').click(function() {
navigator.getUserMedia({
audio: false,
video: {
mandatory: {
chromeMediaSource: 'screen',
maxWidth: 1280,
maxHeight: 720
},
optional: []
}
}, function(stream) {
document.getElementById('video').src = window.URL.createObjectURL(stream);;
$('#share_screen').hide();
}, function(e) {
console.log(e);
alert('Error, my friend. Screen stream is not available. Try in latest Chrome with Screen sharing enabled in about:flags.');
}
)
})
</script>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment