Skip to content

Instantly share code, notes, and snippets.

@thesabbir
Created January 11, 2015 04:58
Show Gist options
  • Save thesabbir/64e8a984ec71bd90dd39 to your computer and use it in GitHub Desktop.
Save thesabbir/64e8a984ec71bd90dd39 to your computer and use it in GitHub Desktop.
WebRTC example by LLC // source http://jsbin.com/galoxu
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="WebRTC example by LLC" />
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<h3>You Will Appear Here If you allow this page to use your camera.</h3>
<video>
</video>
<script id="jsbin-javascript">
// Settings
var settings = {
video: true,
audio: false
};
//Success callback
var success = function (localMediaStream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(localMediaStream);
video.play();
};
//Error callback
var error = function (err) {
console.log("[Error] : " + err);
};
//Determining getUserMedia by Browser Vendor
navigator.getUserMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.moz);
//Calling Navigator
navigator.getUserMedia(settings, success, error);
</script>
<script id="jsbin-source-javascript" type="text/javascript">// Settings
var settings = {
video: true,
audio: false
};
//Success callback
var success = function (localMediaStream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(localMediaStream);
video.play();
};
//Error callback
var error = function (err) {
console.log("[Error] : " + err);
};
//Determining getUserMedia by Browser Vendor
navigator.getUserMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.moz);
//Calling Navigator
navigator.getUserMedia(settings, success, error);</script></body>
</html>
// Settings
var settings = {
video: true,
audio: false
};
//Success callback
var success = function (localMediaStream) {
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(localMediaStream);
video.play();
};
//Error callback
var error = function (err) {
console.log("[Error] : " + err);
};
//Determining getUserMedia by Browser Vendor
navigator.getUserMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.moz);
//Calling Navigator
navigator.getUserMedia(settings, success, error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment