Last active
August 29, 2015 14:01
-
-
Save radermacher/037472757f5e84e63e1c to your computer and use it in GitHub Desktop.
WebRTC Sample - Demo: http://jsbin.com/goqes/1/watch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Web RTC</title> | |
<style type="text/css"> | |
video { | |
-webkit-transform: scaleX(-1); | |
transform: scaleX(-1); | |
} | |
video { | |
width: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<video autoplay></video> | |
<script type="text/javascript"> | |
navigator.getUserMedia = navigator.getUserMedia || | |
navigator.webkitGetUserMedia || | |
navigator.mozGetUserMedia || | |
navigator.msGetUserMedia || | |
false; | |
var video = document.querySelector('video'); | |
var hdConstraints = { | |
video : { | |
mandatory: { | |
minWidth: 1280, | |
minHeight: 720 | |
} | |
} | |
}; | |
var errorCallback = function(e) { | |
console.log('Rejected!', e); | |
}; | |
var successCallback = function(stream) { | |
video.src = window.URL.createObjectURL(stream); | |
video.width = hdConstraints.video.mandatory.minWidth; | |
video.height = hdConstraints.video.mandatory.minHeight; | |
} | |
if (navigator.getUserMedia) { | |
navigator.getUserMedia(hdConstraints, successCallback, errorCallback); | |
} | |
else { | |
console.log('not supported'); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment