我无法同时指定视频质量和面对镜头的限制。
有没有办法结合以下约束?

{
  audio: true,
  video: { width: 1280, height: 720 }
}

{ audio: true, video: { facingMode: "user" } }

最佳答案

navigator.mediaDevices.getUserMedia({audio:true,video:getConstraints(1280,720)})

function getConstraints(videowidth, videoheight) {
constraints = {
              facingMode: { exact: "environment" },
              width: { min: videowidth, ideal: videowidth, max: videowidth},
              height: { min: videoheight, ideal: videoheight, max:
              frameRate : {min: 5, max: 8 }
              };

return constraints;
}

关于javascript - navigator.mediaDevices.getUserMedia视频质量和面临的模式限制,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45875971/

10-08 23:12