Merge pull request #108 from thecodingmachine/bugFixes

fixed a game crash on firefox on http
This commit is contained in:
David Négrier 2020-05-13 21:48:09 +02:00 committed by GitHub
commit 4cd2141785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,23 +115,29 @@ export class MediaManager {
//get camera
getCamera() {
return this.getCameraPromise = navigator.mediaDevices.getUserMedia(this.constraintsMedia)
.then((stream: MediaStream) => {
this.localStream = stream;
this.myCamVideo.srcObject = this.localStream;
let promise = null;
try {
promise = navigator.mediaDevices.getUserMedia(this.constraintsMedia)
.then((stream: MediaStream) => {
this.localStream = stream;
this.myCamVideo.srcObject = this.localStream;
//TODO resize remote cam
/*console.log(this.localStream.getTracks());
let videoMediaStreamTrack = this.localStream.getTracks().find((media : MediaStreamTrack) => media.kind === "video");
let {width, height} = videoMediaStreamTrack.getSettings();
console.info(`${width}x${height}`); // 6*/
//TODO resize remote cam
/*console.log(this.localStream.getTracks());
let videoMediaStreamTrack = this.localStream.getTracks().find((media : MediaStreamTrack) => media.kind === "video");
let {width, height} = videoMediaStreamTrack.getSettings();
console.info(`${width}x${height}`); // 6*/
return stream;
}).catch((err) => {
console.error(err);
this.localStream = null;
throw err;
});
return stream;
}).catch((err) => {
console.error(err);
this.localStream = null;
throw err;
});
} catch (e) {
promise = Promise.reject(false);
}
return this.getCameraPromise = promise;
}
/**