diff options
author | Vincent Petry <vincent@nextcloud.com> | 2020-10-21 19:18:09 +0300 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2020-10-29 12:16:50 +0300 |
commit | 832d423d65243d928124ff7c8a3ea9fec36ea357 (patch) | |
tree | 5355c6876d36eba3a301f376dafed2b855b2ebdc /src | |
parent | b60271e12a295c1fa71c26209d3d18dfdea3aa94 (diff) |
Clear error notification when leaving call
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/CallView/shared/LocalVideo.vue | 15 | ||||
-rw-r--r-- | src/utils/webrtc/webrtc.js | 14 |
2 files changed, 25 insertions, 4 deletions
diff --git a/src/components/CallView/shared/LocalVideo.vue b/src/components/CallView/shared/LocalVideo.vue index a581332f1..b75b110a9 100644 --- a/src/components/CallView/shared/LocalVideo.vue +++ b/src/components/CallView/shared/LocalVideo.vue @@ -122,6 +122,12 @@ export default { }, }, + data() { + return { + notificationHandle: null, + } + }, + computed: { videoContainerClass() { @@ -208,15 +214,15 @@ export default { handler: function(error) { if (error) { if (error.name === 'NotAllowedError') { - showError(t('spreed', 'Access to camera was denied')) + this.notificationHandle = showError(t('spreed', 'Access to camera was denied')) } else if (error.name === 'NotReadableError' || error.name === 'AbortError') { // when camera in use, Chrome gives NotReadableError, Firefox gives AbortError - showError(t('spreed', 'Error while accessing camera: it is likely in use by another program'), { + this.notificationHandle = showError(t('spreed', 'Error while accessing camera: it is likely in use by another program'), { timeout: TOAST_PERMANENT_TIMEOUT, }) } else { console.error('Error while accessing camera: ', error.message, error.name) - showError(t('spreed', 'Error while accessing camera'), { + this.notificationHandle = showError(t('spreed', 'Error while accessing camera'), { timeout: TOAST_PERMANENT_TIMEOUT, }) } @@ -232,6 +238,9 @@ export default { }, destroyed() { + if (this.notificationHandle) { + this.notificationHandle.hideToast() + } if (this.localCallParticipantModel) { this.localCallParticipantModel.off('forcedMute', this._handleForcedMute) } diff --git a/src/utils/webrtc/webrtc.js b/src/utils/webrtc/webrtc.js index fbf3f1a33..c37540098 100644 --- a/src/utils/webrtc/webrtc.js +++ b/src/utils/webrtc/webrtc.js @@ -401,6 +401,7 @@ export default function initWebRTC(signaling, _callParticipantCollection, _local return } + clearErrorNotification() webrtc.leaveCall() }) @@ -871,6 +872,8 @@ export default function initWebRTC(signaling, _callParticipantCollection, _local let localStreamRequestedTimeout = null let localStreamRequestedTimeoutNotification = null + let errorNotificationHandle = null + const clearLocalStreamRequestedTimeoutAndHideNotification = function() { clearTimeout(localStreamRequestedTimeout) localStreamRequestedTimeout = null @@ -879,6 +882,14 @@ export default function initWebRTC(signaling, _callParticipantCollection, _local localStreamRequestedTimeoutNotification.hideToast() localStreamRequestedTimeoutNotification = null } + + } + + const clearErrorNotification = function() { + if (errorNotificationHandle) { + errorNotificationHandle.hideToast() + errorNotificationHandle = null + } } // In some cases the browser may enter in a faulty state in which @@ -901,6 +912,7 @@ export default function initWebRTC(signaling, _callParticipantCollection, _local signaling.on('leaveRoom', function(token) { if (signaling.currentRoomToken === token) { clearLocalStreamRequestedTimeoutAndHideNotification() + clearErrorNotification() } }) @@ -942,7 +954,7 @@ export default function initWebRTC(signaling, _callParticipantCollection, _local console.error('Error while accessing microphone & camera: ', error.message, error.name) } - showError(message, { + errorNotificationHandle = showError(message, { timeout: timeout, }) }) |