Merge pull request #108 from thecodingmachine/bugFixes
fixed a game crash on firefox on http
This commit is contained in:
commit
4cd2141785
@ -115,23 +115,29 @@ export class MediaManager {
|
|||||||
|
|
||||||
//get camera
|
//get camera
|
||||||
getCamera() {
|
getCamera() {
|
||||||
return this.getCameraPromise = navigator.mediaDevices.getUserMedia(this.constraintsMedia)
|
let promise = null;
|
||||||
.then((stream: MediaStream) => {
|
try {
|
||||||
this.localStream = stream;
|
promise = navigator.mediaDevices.getUserMedia(this.constraintsMedia)
|
||||||
this.myCamVideo.srcObject = this.localStream;
|
.then((stream: MediaStream) => {
|
||||||
|
this.localStream = stream;
|
||||||
|
this.myCamVideo.srcObject = this.localStream;
|
||||||
|
|
||||||
//TODO resize remote cam
|
//TODO resize remote cam
|
||||||
/*console.log(this.localStream.getTracks());
|
/*console.log(this.localStream.getTracks());
|
||||||
let videoMediaStreamTrack = this.localStream.getTracks().find((media : MediaStreamTrack) => media.kind === "video");
|
let videoMediaStreamTrack = this.localStream.getTracks().find((media : MediaStreamTrack) => media.kind === "video");
|
||||||
let {width, height} = videoMediaStreamTrack.getSettings();
|
let {width, height} = videoMediaStreamTrack.getSettings();
|
||||||
console.info(`${width}x${height}`); // 6*/
|
console.info(`${width}x${height}`); // 6*/
|
||||||
|
|
||||||
return stream;
|
return stream;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
this.localStream = null;
|
this.localStream = null;
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
} catch (e) {
|
||||||
|
promise = Promise.reject(false);
|
||||||
|
}
|
||||||
|
return this.getCameraPromise = promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user