我在sqlfiddle for this schema here使用webcam.js 在移动设备中,前置摄像头默认打开。我想将默认值更改为后置摄像头。 有没有办法改变相机设备?
答案 0 :(得分:1)
<script src="/js/webcamjs/webcam.js"></script>
<div id="my_camera" style="width:320px; height:240px;"></div>
<div id="my_result"></div>
<script language="JavaScript">
Webcam.set('constraints',{
facingMode: "environment"
});
Webcam.attach( '#my_camera' );
function take_snapshot() {
Webcam.snap( function(data_uri) {
document.getElementById('my_result').innerHTML = '<img src="'+data_uri+'"/>';
} );
}
</script>
<a href="javascript:void(take_snapshot())">Take Snapshot</a>
答案 1 :(得分:0)
var constraints = {
video: true,
facingMode: "environment"
};