diff --git a/css/live-camera.css b/css/live-camera.css new file mode 100644 index 0000000..b67af5d --- /dev/null +++ b/css/live-camera.css @@ -0,0 +1,5 @@ +video { + position: absolute; + left: 0; + bottom: 0; +} \ No newline at end of file diff --git a/index.html b/index.html index a63853e..04cb1e9 100644 --- a/index.html +++ b/index.html @@ -11,6 +11,7 @@ + @@ -31,8 +32,11 @@

HTML5 Live Captioning

+ + + diff --git a/js/live-camera.js b/js/live-camera.js new file mode 100644 index 0000000..6710b6d --- /dev/null +++ b/js/live-camera.js @@ -0,0 +1,13 @@ +/* Based on https://davidwalsh.name/browser-camera */ + +// Grab elements, create settings, etc. +var video = document.getElementById('video'); + +// Get access to the camera! +if(navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { + // Not adding `{ audio: true }` since we only want video now + navigator.mediaDevices.getUserMedia({ video: true }).then(function(stream) { + video.srcObject = stream; + video.play(); + }); +} \ No newline at end of file