阅读量:0
调用摄像头并展示视频
代码如下:
<!doctype html> <html class="no-js" lang=""> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title>Lookie Lookie!</title> <meta name="description" content="A website that learns to predict where you are looking at. Written in TensorFlow.js"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> </head> <body> <video id="webcam" width="400" height="300" autoplay></video> </body> <script> var video = document.querySelector("#webcam"); if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { navigator.mediaDevices.getUserMedia({ video: true }) .then(