My app stopped working this month and it took me a while to identify the root cause. I’m posting here in the hope of saving others time.
onWebcamConnectFailure event every time I started the app. It wouldn’t display the webcam stream or return any results. The browser didn’t return any kind of error or warning message.
It seems this is due to the fact that the JS code that executes
navigator.mediaDevices.getUserMedia() was loaded from Affectiva’s webserver, rather than the web server that the main page and iframe content was hosted on. This kind of cross-domain access is apparently rejected silently.
To fix this, I wrote my own code to display the webcam stream (using
getUserMedia()), then used Affectia’s
FrameDetector interface, instead of the
CameraDetector one. This works in both a parent frame and an iframe.