Skip to content

Instantly share code, notes, and snippets.

@voltrevo
Last active September 21, 2017 03:36
Show Gist options
  • Save voltrevo/031d2feae691eb62c6b8e57ba860629f to your computer and use it in GitHub Desktop.
Save voltrevo/031d2feae691eb62c6b8e57ba860629f to your computer and use it in GitHub Desktop.
'use strict';
(async () => {
const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true });
const vid = document.createElement('video');
vid.srcObject = stream;
document.body.appendChild(vid);
vid.style.position = 'absolute';
vid.style.left = '0px';
vid.style.top = '0px';
vid.style.width = '100vw';
vid.style.height = '100vh';
vid.style.objectFit = 'cover';
vid.style.transform = 'scaleX(-1)';
await vid.play();
})()
.catch(err => console.error(err))
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment