Last active
December 12, 2017 16:08
-
-
Save adamabernathy/814ea10a65adbb5f1ba9849d0f682f33 to your computer and use it in GitHub Desktop.
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> | |
<style> | |
h1 { | |
text-align: center; | |
} | |
.container { | |
padding: 0 5em 5em 5em; | |
text-align: center; | |
} | |
.camera-display { | |
width: 75%; | |
height: 75%; | |
background-color: black; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>I can see you</h1> | |
<div id="container" class="container"> | |
<video autoplay="true" id="camera-display" class="camera-display"> | |
</video> | |
</div> | |
</body> | |
<script> | |
const video = document.getElementById("camera-display"); | |
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia; | |
if (navigator.getUserMedia) { | |
navigator.getUserMedia({ video: true }, stream => { | |
video.src = window.URL.createObjectURL(stream); | |
}, err => { | |
alert('I can\'t spy on you!!'); | |
console.warn(err); | |
}); | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment