Posted in HTML / CSS onJune 01, 2016
XML/HTML Code复制内容到剪贴板
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <title>GetUserMedia实例</title>
- </head>
- <body>
- <video id="video" autoplay><ideo>
- </body>
- <script type="text/javascript">
- var getUserMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
- getUserMedia.call(navigator, {
- video: true,
- audio: true
- }, function(localMediaStream) {
- var video = document.getElementById('video');
- video.src = window.URL.createObjectURL(localMediaStream);
- video.onloadedmetadata = function(e) {
- console.log("Label: " + localMediaStream.label);
- console.log("AudioTracks" , localMediaStream.getAudioTracks());
- console.log("VideoTracks" , localMediaStream.getVideoTracks());
- };
- }, function(e) {
- console.log('Reeeejected!', e);
- });
- </script>
- <html>
以上这篇h5调用摄像头的实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持三水点靠木。
h5调用摄像头的实现方法
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@