Skip to content

Instantly share code, notes, and snippets.

@shoebappa
Created May 21, 2020 02:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shoebappa/3ef4f0293fef97812ffd6b0074d21158 to your computer and use it in GitHub Desktop.
Save shoebappa/3ef4f0293fef97812ffd6b0074d21158 to your computer and use it in GitHub Desktop.
javascript:(function()%7Bvar%20el%3Ddocument.createElement(%22video%22)%3Bel.style.cssText%3D%22position%3A%20fixed%3Btop%3A%200%3Bleft%3A%200%3Bz-index%3A%20100000%3Bmin-width%3A%20100%25%3Bmin-height%3A%20100%25%3B%22%2Cel.autoplay%3D!0%2Cdocument.body.appendChild(el)%2Cnavigator.mediaDevices.getUserMedia(%7Bvideo%3A!0%7D).then(function(e)%7Bel.srcObject%3De%7D).catch(function(e)%7Bconsole.error(e)%2Calert(%22Enable%20your%20camera%22)%7D)%7D)()
<script>
var el = document.createElement('video');
el.style.cssText = 'position: fixed;top: 0;left: 0;z-index: 100000;min-width: 100%;min-height: 100%;';
el.autoplay = true;
document.body.appendChild(el);
navigator.mediaDevices.getUserMedia({
video: true
})
.then(function (s) {
el.srcObject = s;
})
.catch(function(e) {
console.error(e);
alert("Enable your camera");
});
</script>
@shoebappa
Copy link
Author

Add bookmarklet to bookmark bar and add your video to any webpage...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment