AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
[TOC] ## 配置参数 ``` var constraints = { video: { width: 640, height: 480, frameRate: 15,//30, // 帧率 // facingMode: "enviroment" // 摄像头 deviceId: deviceId ? deviceId : undefined // 视频设备id // 设置之后可以在手机上切换摄像头 前置后置切换 }, audio: { noiseSuppression: true, //降噪 echoCancellation: true // 回音消除 } } ``` ## 指定设备 > [参考](https://webrtc.github.io/samples/src/content/devices/input-output/) 通过 deviceid 获取流 ``` // 查询媒体 navigator.mediaDevices.enumerateDevices() .then((devices) => { devices.forEach((device) => { console.log(`${device.kind}: ${device.label} id = ${device.deviceId}`); }); }) .catch((err) => { console.error(`${err.name}: ${err.message}`); }); // 指定流 const constraints = { audio: {deviceId: audioSource ? {exact: audioSource} : undefined}, video: {deviceId: videoSource ? {exact: videoSource} : undefined} }; navigator.mediaDevices.getUserMedia(constraints).then(gotStream).then(gotDevices).catch(handleError); ```