diff options
-rw-r--r-- | package-lock.json | 12 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/components/CallView/LocalVideo.vue | 29 | ||||
-rw-r--r-- | src/utils/webrtc/models/LocalCallParticipantModel.js | 12 | ||||
-rw-r--r-- | src/utils/webrtc/simplewebrtc/simplewebrtc.js | 1 |
5 files changed, 49 insertions, 7 deletions
diff --git a/package-lock.json b/package-lock.json index 7cb0c3c0b..628bf8fca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2829,9 +2829,9 @@ "integrity": "sha512-f+sKpdLZXkODV+OY39K1M+Spmd4RgxmtEXmNn4Bviv4R7uBFHXuw+JX9ZdfDeOryfHjJ/TRQxQEp0GMpBwZFUw==" }, "@nextcloud/dialogs": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-1.1.0.tgz", - "integrity": "sha512-RjA+AEBwIkT2YEtMcfni3KQxn8o2SgbnVGp0n00z9tEhuvx9g3Z7Eh5+bY7zzanedFqryJSazMhk0voUyxr8Ow==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-1.2.0.tgz", + "integrity": "sha512-yB2GRzgiIlGg02XAD9A9yTKhPhI6MTqHdOc6T6xIs8IBmlHJrCRcL1e6kBKUTQ4GXVzYDU8JFZ5b88RSiEwS1w==", "requires": { "core-js": "3.6.4", "toastify-js": "^1.6.2" @@ -12277,9 +12277,9 @@ } }, "toastify-js": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/toastify-js/-/toastify-js-1.6.2.tgz", - "integrity": "sha512-ECQzgjTjxaElfwp/8e8qoIYx7U5rU2G54e5aiPMv+UtmGOYEitrtNp/Kr8uMgntnQNrDZEQJNGjBtoNnEgR5EA==" + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/toastify-js/-/toastify-js-1.7.0.tgz", + "integrity": "sha512-GmPy4zJ/ulCfmCHlfCtgcB+K2xhx2AXW3T/ZZOSjyjaIGevhz+uvR8HSCTay/wBq4tt2mUnBqlObP1sSWGlsnQ==" }, "tough-cookie": { "version": "2.4.3", diff --git a/package.json b/package.json index 5f2f2e3df..59f15dcb9 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@juliushaertl/vue-richtext": "^0.3.0", "@nextcloud/auth": "^1.2.1", "@nextcloud/axios": "^1.3.1", - "@nextcloud/dialogs": "^1.1.0", + "@nextcloud/dialogs": "^1.2.0", "@nextcloud/initial-state": "^1.1.0", "@nextcloud/l10n": "^1.1.0", "@nextcloud/moment": "^1.1.0", diff --git a/src/components/CallView/LocalVideo.vue b/src/components/CallView/LocalVideo.vue index 25d8bf8f5..e62f68f30 100644 --- a/src/components/CallView/LocalVideo.vue +++ b/src/components/CallView/LocalVideo.vue @@ -48,6 +48,7 @@ import Avatar from '@nextcloud/vue/dist/Components/Avatar' import LocalMediaControls from './LocalMediaControls' import Hex from 'crypto-js/enc-hex' import SHA1 from 'crypto-js/sha1' +import { showInfo } from '@nextcloud/dialogs' export default { @@ -111,6 +112,20 @@ export default { watch: { + localCallParticipantModel: { + immediate: true, + + handler: function(localCallParticipantModel, oldLocalCallParticipantModel) { + if (oldLocalCallParticipantModel) { + oldLocalCallParticipantModel.off('forcedMute', this._handleForcedMute) + } + + if (localCallParticipantModel) { + localCallParticipantModel.on('forcedMute', this._handleForcedMute) + } + }, + }, + 'localMediaModel.attributes.localStream': function(localStream) { this._setLocalStream(localStream) }, @@ -122,8 +137,22 @@ export default { this._setLocalStream(this.localMediaModel.attributes.localStream) }, + destroyed() { + if (this.localCallParticipantModel) { + this.localCallParticipantModel.off('forcedMute', this._handleForcedMute) + } + }, + methods: { + _handleForcedMute() { + // The default toast selector is "body-user", but as this toast can + // be shown to guests too a generic selector valid both for logged + // in users and guests needs to be used instead (undefined selects + // the body element). + showInfo(t('spreed', 'You have been muted by a moderator'), { selector: undefined }) + }, + _setLocalStream(localStream) { if (!localStream) { // Do not clear the srcObject of the video element, just leave diff --git a/src/utils/webrtc/models/LocalCallParticipantModel.js b/src/utils/webrtc/models/LocalCallParticipantModel.js index e2e8591fe..9ea57fe92 100644 --- a/src/utils/webrtc/models/LocalCallParticipantModel.js +++ b/src/utils/webrtc/models/LocalCallParticipantModel.js @@ -28,6 +28,8 @@ export default function LocalCallParticipantModel() { this._handlers = [] + this._handleForcedMuteBound = this._handleForcedMute.bind(this) + } LocalCallParticipantModel.prototype = { @@ -71,10 +73,16 @@ LocalCallParticipantModel.prototype = { }, setWebRtc: function(webRtc) { + if (this._webRtc) { + this._webRtc.off('forcedMute', this._handleForcedMuteBound) + } + this._webRtc = webRtc this.set('peerId', this._webRtc.connection.getSessionId()) this.set('guestName', null) + + this._webRtc.on('forcedMute', this._handleForcedMuteBound) }, setGuestName: function(guestName) { @@ -87,4 +95,8 @@ LocalCallParticipantModel.prototype = { this._webRtc.sendDirectlyToAll('status', 'nickChanged', guestName) }, + _handleForcedMute: function() { + this._trigger('forcedMute') + }, + } diff --git a/src/utils/webrtc/simplewebrtc/simplewebrtc.js b/src/utils/webrtc/simplewebrtc/simplewebrtc.js index 96d4f860f..e2c15beb2 100644 --- a/src/utils/webrtc/simplewebrtc/simplewebrtc.js +++ b/src/utils/webrtc/simplewebrtc/simplewebrtc.js @@ -117,6 +117,7 @@ function SimpleWebRTC(opts) { } else if (message.type === 'forceMute') { if (message.payload.peerId === self.connection.getSessionId()) { self.mute() + self.emit('forcedMute') } else { self.emit('mute', { id: message.payload.peerId }) } |