I'm working in an Angular PWA that allows the user to take a selfie and send it to a server. I've been debugging it in my computer and in current phone (That has Android 10) and it works just fine, but when I test it on a device with Android 11 the app just freezes with the camera open and it doesn't continue unless I minimize it and maximize it again. The funny thing about it it's that if I use the remote debug tools that Chrome has, it shows that the app succesfully continued the process as expected (IE. The PWA moves to the next screen in the remote debug tools but not in the actual device).
I use navigator.mediaDevices.getUserMedia
to be able to access the camera and it works just fine, and to stop the camera I use a function like the following:
stopCameras() {
var stream = this.video.srcObject;
var tracks = stream.getTracks();
for (var i = 0; i < tracks.length; i++) {
var track = tracks[i];
track.stop();
}
this.video.srcObject = null;
}