如何在iOS 11 Safari上使用mediaDevices.enumerateDevices()识别前后摄像头

时间:2017-11-21 17:41:18

标签: javascript ios html5 mobile-safari getusermedia

我使用getUserMedia()在iOS 11的Safari上捕获相机流。当我使用MediaDevices API获取相机列表时,标签为空白。有没有办法可靠地确定哪个摄像头指向哪个方向?

navigator.mediaDevices.enumerateDevices().then(function(devices) {
    devices.forEach(function(device) {
        if(device.kind === 'videoinput') {
            console.log(device);
            // Labels for both cameras are blank:
            // MediaDeviceInfo { deviceId: "123ABC", groupId: "", kind: "videoinput", label: "" }
        }
    });
});

0 个答案:

没有答案
相关问题