diff options
Diffstat (limited to 'src/components/CallView/shared')
-rw-r--r-- | src/components/CallView/shared/LocalMediaControls.vue | 60 | ||||
-rw-r--r-- | src/components/CallView/shared/LocalVideo.vue | 5 |
2 files changed, 57 insertions, 8 deletions
diff --git a/src/components/CallView/shared/LocalMediaControls.vue b/src/components/CallView/shared/LocalMediaControls.vue index a4c6a4382..a4fbb09b2 100644 --- a/src/components/CallView/shared/LocalMediaControls.vue +++ b/src/components/CallView/shared/LocalMediaControls.vue @@ -219,6 +219,7 @@ import Video from 'vue-material-design-icons/Video' import VideoOff from 'vue-material-design-icons/VideoOff' import Popover from '@nextcloud/vue/dist/Components/Popover' import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip' +import { PARTICIPANT } from '../../../constants' import SpeakingWhileMutedWarner from '../../../utils/webrtc/SpeakingWhileMutedWarner' import NetworkStrength2Alert from 'vue-material-design-icons/NetworkStrength2Alert' import { Actions, ActionSeparator, ActionButton } from '@nextcloud/vue' @@ -249,6 +250,10 @@ export default { }, props: { + token: { + type: String, + required: true, + }, model: { type: Object, required: true, @@ -289,10 +294,26 @@ export default { return t('spreed', 'Lower hand (R)') }, + conversation() { + return this.$store.getters.conversation(this.token) || this.$store.getters.dummyConversation + }, + + isAudioAllowed() { + return this.conversation.publishingPermissions === PARTICIPANT.PUBLISHING_PERMISSIONS.ALL + }, + + isVideoAllowed() { + return this.conversation.publishingPermissions === PARTICIPANT.PUBLISHING_PERMISSIONS.ALL + }, + + isScreensharingAllowed() { + return this.conversation.publishingPermissions === PARTICIPANT.PUBLISHING_PERMISSIONS.ALL + }, + audioButtonClass() { return { - 'audio-disabled': this.model.attributes.audioAvailable && !this.model.attributes.audioEnabled, - 'no-audio-available': !this.model.attributes.audioAvailable, + 'audio-disabled': this.isAudioAllowed && this.model.attributes.audioAvailable && !this.model.attributes.audioEnabled, + 'no-audio-available': !this.isAudioAllowed || !this.model.attributes.audioAvailable, } }, @@ -301,6 +322,10 @@ export default { }, audioButtonTooltip() { + if (!this.isAudioAllowed) { + return t('spreed', 'You are not allowed to enable audio') + } + if (!this.model.attributes.audioAvailable) { return { content: t('spreed', 'No audio'), @@ -348,8 +373,8 @@ export default { videoButtonClass() { return { - 'video-disabled': this.model.attributes.videoAvailable && !this.model.attributes.videoEnabled, - 'no-video-available': !this.model.attributes.videoAvailable, + 'video-disabled': this.isVideoAllowed && this.model.attributes.videoAvailable && !this.model.attributes.videoEnabled, + 'no-video-available': !this.isVideoAllowed || !this.model.attributes.videoAvailable, } }, @@ -358,6 +383,10 @@ export default { }, videoButtonTooltip() { + if (!this.isVideoAllowed) { + return t('spreed', 'You are not allowed to enable video') + } + if (!this.model.attributes.videoAvailable) { return t('spreed', 'No camera') } @@ -391,15 +420,24 @@ export default { screenSharingButtonClass() { return { - 'screensharing-disabled': !this.model.attributes.localScreen, + 'screensharing-disabled': this.isScreensharingAllowed && !this.model.attributes.localScreen, + 'no-screensharing-available': !this.isScreensharingAllowed, } }, screenSharingButtonTooltip() { + if (!this.isScreensharingAllowed) { + return t('spreed', 'You are not allowed to enable screensharing') + } + if (this.screenSharingMenuOpen) { return null } + if (!this.isScreensharingAllowed) { + return t('spreed', 'No screensharing') + } + return this.model.attributes.localScreen ? t('spreed', 'Screensharing options') : t('spreed', 'Enable screensharing') }, @@ -614,6 +652,10 @@ export default { }, toggleScreenSharingMenu() { + if (!this.isScreensharingAllowed) { + return + } + if (!this.model.getWebRtc().capabilities.supportScreenSharing) { if (window.location.protocol === 'https:') { showMessage(t('spreed', 'Screen sharing is not supported by your browser.')) @@ -746,7 +788,7 @@ export default { .buttons-bar button.audio-disabled:not(.no-audio-available), .buttons-bar button.video-disabled:not(.no-video-available), -.buttons-bar button.screensharing-disabled, +.buttons-bar button.screensharing-disabled:not(.no-screensharing-available), .buttons-bar button.lower-hand { &:hover, &:focus { @@ -755,7 +797,8 @@ export default { } .buttons-bar button.no-audio-available, -.buttons-bar button.no-video-available { +.buttons-bar button.no-video-available, +.buttons-bar button.no-screensharing-available { &, & * { opacity: .7; cursor: not-allowed; @@ -763,7 +806,8 @@ export default { } .buttons-bar button.no-audio-available:active, -.buttons-bar button.no-video-available:active { +.buttons-bar button.no-video-available:active, +.buttons-bar button.no-screensharing-available:active { background-color: transparent; } diff --git a/src/components/CallView/shared/LocalVideo.vue b/src/components/CallView/shared/LocalVideo.vue index 534d192bb..8886f8959 100644 --- a/src/components/CallView/shared/LocalVideo.vue +++ b/src/components/CallView/shared/LocalVideo.vue @@ -53,6 +53,7 @@ <LocalMediaControls v-if="showControls" class="local-media-controls" + :token="token" :model="localMediaModel" :local-call-participant-model="localCallParticipantModel" :screen-sharing-button-hidden="isSidebar" @@ -97,6 +98,10 @@ export default { mixins: [video], props: { + token: { + type: String, + required: true, + }, localMediaModel: { type: Object, required: true, |