Camera not working during Registration

Bahmni Demo Site

Google Chrome is up to date - Version 71.0.3578.98 (Official Build) (64-bit)

In spite of allowing camera and restarting the browser, re-login to Bahmni, the patient registration is not allowing photo capture through camera.

Kindly share the output for easy identification of the problem.

Well there is no output (photo) in this case! Instead of capturing the photo it shows those browser error messages.

Suggest, try it on Bhmni demo site and take a photo on registration page.

Kindly, copy the error message in pastebin and share the link

The error is shown in the image above

Am seeing camera allowed. What happens when you click done?

Thanks for reporting this @sameergije.

Here is the error that pops up:

Uncaught TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
    at registration.min.53478a3a.js:5
(anonymous) @ registration.min.53478a3a.js:5

So basically this happens here:

  function (localMediaStream) {
    captureVideo.src = $window.URL.createObjectURL(localMediaStream);

Looks like localMediaStream is not set how it should be. I haven’t looked closer but I can see that Navigator.getUserMedia() is deprecated, see here. I’m afraid that some Chrome upgrade might have brought us across the line… I’m reporting all this on 71.0.3578.98, haven’t tried another browser yet.

Cc: @angshuonline @binduak @swathivarkala @arjun

Yep, same for me on Chrome (I have the latest).

To fix, you will need to modify your code a bit. Right after this line, add a little bit of code like below.

if (navigator.mediaDevices) {
        navigator.mediaDevices.getUserMedia({video: true, audio: false})
                  .then(function (localMediaStream) {
                        captureVideo.srcObject = localMediaStream;
                        captureActiveStream = localMediaStream;
                    }).catch(function (e) { 
                        console.log( + ": " + e.message); 
                        alert( + ": " + e.message); 
  } else if (navigator.getUserMedia) {
                    ..... //old code
                    .... //old code

btw, I have not extensively tested this out - works on latest Chrome, FF, Safari.

@sameergije, can you create a JIRA card for this please?

URL.createObjectURL has been deprecated since 2013 and Google decided to remove it in Chrome version 71. See Deprecate and Remove URL.createObjectURL for MediaStream (removed). That is what was causing the error since we were using that method. A fix has already been made for this and it’s under review.

Don’t. There is one already


Please follow below talk thread for more details on patch.