IBM / MAX-Object-Detector

Localize and identify multiple objects in a single image.
https://developer.ibm.com/exchanges/models/all/max-object-detector/
Apache License 2.0
289 stars 225 forks source link

Docker: camera cannot be used in embedded sample application #126

Open ptitzler opened 4 years ago

ptitzler commented 4 years ago

The console log contains the following error message if a browser is used that requires a secure context to access navigator.mediaDevices as documented here https://developer.mozilla.org/en-US/docs/Web/API/Navigator/mediaDevices

webapp.js:179 Uncaught TypeError: Cannot read property 'getUserMedia' of undefined
    at HTMLButtonElement.runWebcam (webapp.js:179)
    at HTMLButtonElement.dispatch (jquery-3.3.1.min.js:2)
    at HTMLButtonElement.y.handle (jquery-3.3.1.min.js:2)
ajbozarth commented 4 years ago

Making a note here after a convo with @ptitzler over slack. This error is thrown by all browsers (in some manner) when hitting the http url of the web app. This does not occur if you hit the https url. Users can bypass this in their browser using developer tools/settings though (method differs by browser). This is a security feature and cannot be solved "server-side" in the web app code, only "client-side" in a browser.

A "solution" to this may be to disable the button or add a dialog of some sort if the web app is loaded on http