Skip to content

Instantly share code, notes, and snippets.

@sbouafif
Created December 22, 2011 15:10
Show Gist options
  • Save sbouafif/1510627 to your computer and use it in GitHub Desktop.
Save sbouafif/1510627 to your computer and use it in GitHub Desktop.
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height:100%;
<head>
<title>Device Test</title>
<script type="text/javascript">
window.onload = function () {
var videoDevice = document.getElementById("capture");
if (!videoDevice) {
console.log("unable to find device element");
return;
}
videoDevice.onchange = function (evt) {
var videoStream = this.data;
var video = document.getElementById("video");
video.src = videoStream.url;
video.play();
};
}
</script>
</head>
<body>
<h2>Device Test</h2>
<input type="file" accept="video/*" capture="camera" id="capture">
<br>
<video width="320" height="240" id="video" controls></video>
</body>
</html>
{"view":"split","prefixfree":"1","page":"html"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment