AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
[TOC] ## 捕获摄像头 <details> <summary>index.html</summary> ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <div> <button id="start">开始录制</button> <button id="stop">停止录制</button> </div> <div> <video autoplay controls id="stream"></video> </div> <script> // 只获取视频 let constraints = {audio: false, video: true}; let startBtn = document.getElementById('start') let stopBtn = document.getElementById('stop') let video = document.getElementById('stream') startBtn.onclick = function() { navigator.mediaDevices.getUserMedia(constraints, function(stream) { video.srcObject = stream; window.stream = stream; }, function(err) { console.log(err) }) } stopBtn.onclick = function() { video.pause(); } </script> </body> </html> ``` </details> <br/>