|
|
@ -13,21 +13,20 @@ class WebcamUtils { |
|
|
|
const isBrave = !!window.chrome.ipcRenderer |
|
|
|
const isBrave = !!window.chrome.ipcRenderer |
|
|
|
const isFirefoxOrBrave = isFirefox || isBrave |
|
|
|
const isFirefoxOrBrave = isFirefox || isBrave |
|
|
|
try { |
|
|
|
try { |
|
|
|
reject({type: 'NO_WEBCAM_FOUND'}) |
|
|
|
DetectRTC.load(_ => { |
|
|
|
// DetectRTC.load(_ => {
|
|
|
|
if (DetectRTC.hasWebcam) { |
|
|
|
// if (DetectRTC.hasWebcam) {
|
|
|
|
let environmentReady = true |
|
|
|
// let environmentReady = true
|
|
|
|
if ((isFirefoxOrBrave && isPopup) || (isPopup && !DetectRTC.isWebsiteHasWebcamPermissions)) { |
|
|
|
// if ((isFirefoxOrBrave && isPopup) || (isPopup && !DetectRTC.isWebsiteHasWebcamPermissions)) {
|
|
|
|
environmentReady = false |
|
|
|
// environmentReady = false
|
|
|
|
} |
|
|
|
// }
|
|
|
|
resolve({ |
|
|
|
// resolve({
|
|
|
|
permissions: DetectRTC.isWebsiteHasWebcamPermissions, |
|
|
|
// permissions: DetectRTC.isWebsiteHasWebcamPermissions,
|
|
|
|
environmentReady, |
|
|
|
// environmentReady,
|
|
|
|
}) |
|
|
|
// })
|
|
|
|
} else { |
|
|
|
// } else {
|
|
|
|
reject({type: 'NO_WEBCAM_FOUND'}) |
|
|
|
// reject({type: 'NO_WEBCAM_FOUND'})
|
|
|
|
} |
|
|
|
// }
|
|
|
|
}) |
|
|
|
// })
|
|
|
|
|
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
reject({type: 'UNKNOWN_ERROR'}) |
|
|
|
reject({type: 'UNKNOWN_ERROR'}) |
|
|
|
} |
|
|
|
} |
|
|
|