input 实现调用本地摄像头 金沙官网线上实现拍照

<meta name="HandheldFriendly" content="true" />

input 实现调用本地摄像头 实现拍照 和拍视频,input摄像头

<!DOCTYPE HTML> <html>
<head> <meta charset="utf-8"> <!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">--> <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="HandheldFriendly" content="true" /> <meta name="MobileOptimized" content="320" /> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <title>input视频测试</title> </head>
<body> <!--拍照 <input id="myfile" type="file" name="file" accept="image/*" capture="camera"> --> //拍视频 <input type="file" name="video" id="video-input" accept="video/*" capture="user" onchange="videoChange()" /> <p style="font-size: 14px">附: <br>只允许调起摄像头,不允许选择文件 <br>活体的视频大小不能超8Mb,时长不能超6秒 <br><span id='info'></span> </p> <video id="video" width='300' height="300" controls autoplay></video>
<script type="text/javascript"> function videoChange() { var file = document.getElementById('video-input').files[0]; var fileSize = (Math.round(file.size / 1024)).toFixed(); document.getElementById('info').innerHTML += "所录视频大小约为:" + (fileSize / 1024).toFixed(2) + "Mb";
var url = URL.createObjectURL(file); console.log(url); document.getElementById("video").src = url; } </script> </body>
</html>

http://www.bkjia.com/HTML5/1309374.htmlwww.bkjia.comtruehttp://www.bkjia.com/HTML5/1309374.htmlTechArticleinput 实现调用本地摄像头 实现拍照 和拍视频,input摄像头 !DOCTYPE HTMLhtml head meta charset="utf-8" !--meta name="viewport" content="width=device-width, initia...

<!DOCTYPE HTML>

</script>

<title>input视频测试</title>

<!--拍照 <input id="myfile" type="file" name="file" accept="image/*" capture="camera"> -->

</p>

<br>只允许调起摄像头,不允许选择文件

</html>

//拍视频

<video id="video" width='300' height="300" controls autoplay></video>

</head>

<html>

<head>

<input type="file" name="video" id="video-input" accept="video/*" capture="user" onchange="videoChange()" />

<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">-->

var fileSize = (Math.round(file.size / 1024)).toFixed();

<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

本文由金沙官网线上发布于Web前端,转载请注明出处:input 实现调用本地摄像头 金沙官网线上实现拍照

您可能还会对下面的文章感兴趣: