From 018f01e8780b65a2c728999f100cb29f6d68bf0f Mon Sep 17 00:00:00 2001 From: Gregoire Parant Date: Thu, 7 Jan 2021 11:02:00 +0100 Subject: [PATCH] Increase stability camera and microphone permission --- front/src/WebRtc/MediaManager.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/front/src/WebRtc/MediaManager.ts b/front/src/WebRtc/MediaManager.ts index 18a15ab6..09378642 100644 --- a/front/src/WebRtc/MediaManager.ts +++ b/front/src/WebRtc/MediaManager.ts @@ -212,8 +212,16 @@ export class MediaManager { this.constraintsMedia.video = videoConstraint; this.getCamera().then((stream: MediaStream) => { + //TODO show error message tooltip upper of camera button + //TODO message : please check camera permission of your navigator + if(stream.getVideoTracks().length === 0) { + throw Error('Video track is empty, please check camera permission of your navigator') + } this.enableCameraStyle(); this.triggerUpdatedLocalStreamCallbacks(stream); + }).catch((err) => { + console.error(err); + this.disableCameraStyle(); }); } @@ -232,8 +240,16 @@ export class MediaManager { this.constraintsMedia.audio = true; this.getCamera().then((stream) => { + //TODO show error message tooltip upper of camera button + //TODO message : please check microphone permission of your navigator + if(stream.getAudioTracks().length === 0) { + throw Error('Audio track is empty, please check microphone permission of your navigator') + } this.enableMicrophoneStyle(); this.triggerUpdatedLocalStreamCallbacks(stream); + }).catch((err) => { + console.error(err); + this.disableMicrophoneStyle(); }); }