Camera not working during Registration

patientimage
registration
Tags: #<Tag:0x00007f88c95e0368> #<Tag:0x00007f88c95e0228>

(sameer gije) #1

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.


(Juliet Wamalwa) #2

Kindly share the output for easy identification of the problem.


(sameer gije) #3

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.


(Juliet Wamalwa) #4

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


(sameer gije) #5

The error is shown in the image above


(Juliet Wamalwa) #6

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


(Dimitri R) #7

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:

navigator.getUserMedia(
  ...
  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


(Angshuman Sarkar) #8

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;
                        captureDialogElement.dialog('open');
                    }).catch(function (e) { 
                        console.log(e.name + ": " + e.message); 
                        alert(e.name + ": " + 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?


(Ivange Larry Ndumbe) #9

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.


(Ivange Larry Ndumbe) #10

Don’t. There is one already https://bahmni.atlassian.net/browse/BAH-738


(Himabindu Akkinepalli) #11

Please follow below talk thread for more details on patch.