url-createobjecturl-no-longer-accepts-mediastream - after Chrome update on 14.12.2018

331 Views Asked by At

Explanation of the problem and scenario.

I have a web app, that use a AngularJS component to take picture. However, after the last update on Google Chrome in 14.12.2018, this component stopped to work. I did search about the issue and i found out that all of the components that can do that stopped to work too, probably, because all of them used the method with mediastream argument that was recently removed from the browsers

The code

Looking in the source code of the component, we can see that they still use the .createObjectURL method passing MediaStream as argument, but this no longer is acceptable by browsers.

scope.enableCamera = function () {
return navigator.getUserMedia({
    audio: false,
    video: true
},function (stream) {
    return scope.$apply(function () {
        scope.stream = stream;
        scope.isLoaded = true;

    // HERE IS THE PROBLEM !!!!!!!
    return scope.videoStream = $sce.trustAsResourceUrl(window.URL.createObjectURL(stream));
    });
},function (error) {
return scope.$apply(function () {
    scope.isLoaded = true;
    return scope.noCamera = true;
});
});

Objective

I would like to change the way the component works to get it working again, can someone help-me to do that?

Here is the link of the component on GitHub: https://github.com/onemightyroar/angular-camera

Obs: I opened a issue there, but did not get any answer yet.

0

There are 0 best solutions below