From cf1de23629e2b92a54b049d4123cfa7b89a0ef01 Mon Sep 17 00:00:00 2001 From: Maxim Khlobystov <maxim.khlobystov@gmail.com> Date: Sun, 12 Aug 2018 18:39:39 -0400 Subject: [PATCH] Properly handling ice connection state errors. --- .../components/video-provider/component.jsx | 20 +++++++++++++++++++ bigbluebutton-html5/private/locales/en.json | 1 + 2 files changed, 21 insertions(+) diff --git a/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx b/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx index 4413146d8b..1de2bf8b00 100755 --- a/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/video-provider/component.jsx @@ -45,6 +45,10 @@ const intlClientErrors = defineMessages({ id: 'app.video.notReadableError', description: 'error message When the webcam is being used by other software', }, + iceConnectionStateError: { + id: 'app.video.iceConnectionStateError', + description: 'Error message for ice connection state being failed', + }, }); const intlSFUErrors = defineMessages({ @@ -453,6 +457,8 @@ class VideoProvider extends Component { peer.didSDPAnswered = true; }); }); + this.webRtcPeers[id].peerConnection.oniceconnectionstatechange = + this._getOnIceConnectionStateChangeCallback(id); } } @@ -538,6 +544,20 @@ class VideoProvider extends Component { }; } + _getOnIceConnectionStateChangeCallback(id) { + const { intl } = this.props; + const peer = this.webRtcPeers[id]; + + return (event) => { + const connectionState = peer.peerConnection.iceConnectionState; + if(connectionState === 'failed') { + this.logger('error', 'ICE connection state', id); + this.stopWebRTCPeer(id); + this.notifyError(intl.formatMessage(intlClientErrors.iceConnectionStateError)); + } + } + } + attachVideoStream(id) { const video = this.videoTags[id]; if (video == null) { diff --git a/bigbluebutton-html5/private/locales/en.json b/bigbluebutton-html5/private/locales/en.json index 38f3081962..f9700fb47d 100755 --- a/bigbluebutton-html5/private/locales/en.json +++ b/bigbluebutton-html5/private/locales/en.json @@ -320,6 +320,7 @@ "app.video.joinVideo": "Share Webcam", "app.video.leaveVideo": "Unshare Webcam", "app.video.iceCandidateError": "Error on adding ice candidate", + "app.video.iceConnectionStateError": "Error on ice connection state", "app.video.permissionError": "Error on sharing webcam. Please check permissions", "app.video.sharingError": "Error on sharing webcam", "app.video.notFoundError": "Could not find webcam. Please make sure it's connected", -- GitLab