fixed a game crash on firefox on http

This commit is contained in:
kharhamel 2020-05-13 16:56:22 +02:00
parent dd5a0c9933
commit e2531343d1

View file

@ -115,7 +115,9 @@ export class MediaManager {
//get camera
getCamera() {
return this.getCameraPromise = navigator.mediaDevices.getUserMedia(this.constraintsMedia)
let promise = null;
try {
promise = navigator.mediaDevices.getUserMedia(this.constraintsMedia)
.then((stream: MediaStream) => {
this.localStream = stream;
this.myCamVideo.srcObject = this.localStream;
@ -132,6 +134,10 @@ export class MediaManager {
this.localStream = null;
throw err;
});
} catch (e) {
promise = Promise.reject(false);
}
return this.getCameraPromise = promise;
}
/**