Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <script type="text/javascript">
- navigator.getMedia = ( navigator.getUserMedia ||
- navigator.webkitGetUserMedia ||
- navigator.mozGetUserMedia ||
- navigator.msGetUserMedia);
- navigator.getMedia (
- // permissoes
- {
- video: true,
- audio: true
- },
- // callbackSucesso
- function(localMediaStream) {
- var video = document.querySelector('video');
- // video.src = window.URL.createObjectURL(localMediaStream);
- video.srcObject=localMediaStream;
- video.play();
- video.onloadedmetadata = function(e) {
- // Faz algo com o vídeo aqui.
- };
- },
- // callbackErro
- function(err) {
- console.log("O seguinte erro ocorreu: " + err);
- }
- );
- </script>
- </head>
- <body>
- <video autoplay></video>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement