html5显示摄像头

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>显示摄像头</title>
</head>
<body>
    <video src="" id="video"></video>
</body>
<script>
    video = document.getElementById('video')
    navigator.mediaDevices.getUserMedia({
        video:true
    }).then(res=>{
        video.srcObject = res       //video显示视频流
        video.play()
    })
</script>
</html>
发布了34 篇原创文章 · 获赞 22 · 访问量 8722

猜你喜欢

转载自blog.csdn.net/qq_41247335/article/details/104514727