diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2020-03-17 15:42:42 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-06-11 10:07:30 +0300 |
commit | da5d51ecc87031b245dac4789b05e3edc83110bd (patch) | |
tree | 6a2eaa2d6f138299f0f74cf63d40d95f3244e3cf /src | |
parent | 4f1bb9467087da6f3ee7990d37f0d7dd99722e70 (diff) |
Send media streams in calls only when publishing is allowed
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/CallView/CallView.vue | 3 | ||||
-rw-r--r-- | src/components/CallView/Grid/Grid.vue | 2 | ||||
-rw-r--r-- | src/components/CallView/shared/LocalMediaControls.vue | 32 | ||||
-rw-r--r-- | src/components/CallView/shared/LocalVideo.vue | 5 | ||||
-rw-r--r-- | src/components/TopBar/CallButton.vue | 6 | ||||
-rw-r--r-- | src/constants.js | 7 |
6 files changed, 51 insertions, 4 deletions
diff --git a/src/components/CallView/CallView.vue b/src/components/CallView/CallView.vue index c289a2129..5f470f3db 100644 --- a/src/components/CallView/CallView.vue +++ b/src/components/CallView/CallView.vue @@ -30,6 +30,7 @@ <LocalMediaControls class="local-media-controls" :class="{ 'local-media-controls--sidebar': isSidebar }" + :token="token" :model="localMediaModel" :show-actions="!isSidebar" :local-call-participant-model="localCallParticipantModel" @@ -90,6 +91,7 @@ :is-stripe="false" :show-controls="false" :is-big="true" + :token="token" :local-media-model="localMediaModel" :video-container-aspect-ratio="videoContainerAspectRatio" :local-call-participant-model="localCallParticipantModel" @@ -143,6 +145,7 @@ :show-controls="false" :fit-video="true" :is-stripe="true" + :token="token" :local-media-model="localMediaModel" :video-container-aspect-ratio="videoContainerAspectRatio" :local-call-participant-model="localCallParticipantModel" diff --git a/src/components/CallView/Grid/Grid.vue b/src/components/CallView/Grid/Grid.vue index d4191ff3e..e7b0f8d72 100644 --- a/src/components/CallView/Grid/Grid.vue +++ b/src/components/CallView/Grid/Grid.vue @@ -112,6 +112,7 @@ class="video" :is-grid="true" :fit-video="isStripe" + :token="token" :local-media-model="localMediaModel" :video-container-aspect-ratio="videoContainerAspectRatio" :local-call-participant-model="localCallParticipantModel" @@ -135,6 +136,7 @@ :fit-video="true" :is-stripe="true" :show-controls="false" + :token="token" :local-media-model="localMediaModel" :video-container-aspect-ratio="videoContainerAspectRatio" :local-call-participant-model="localCallParticipantModel" diff --git a/src/components/CallView/shared/LocalMediaControls.vue b/src/components/CallView/shared/LocalMediaControls.vue index a4c6a4382..1ad20c790 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,6 +294,14 @@ export default { return t('spreed', 'Lower hand (R)') }, + conversation() { + return this.$store.getters.conversation(this.token) || this.$store.getters.dummyConversation + }, + + isScreensharingAllowed() { + return this.conversation.publishingPermissions === PARTICIPANT.PUBLISHING_PERMISSIONS.ALL + }, + audioButtonClass() { return { 'audio-disabled': this.model.attributes.audioAvailable && !this.model.attributes.audioEnabled, @@ -391,7 +404,8 @@ export default { screenSharingButtonClass() { return { - 'screensharing-disabled': !this.model.attributes.localScreen, + 'screensharing-disabled': this.isScreensharingAllowed && !this.model.attributes.localScreen, + 'no-screensharing-available': !this.isScreensharingAllowed, } }, @@ -400,6 +414,10 @@ export default { 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 +632,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 +768,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 +777,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 +786,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, diff --git a/src/components/TopBar/CallButton.vue b/src/components/TopBar/CallButton.vue index 84d83edab..870a414fc 100644 --- a/src/components/TopBar/CallButton.vue +++ b/src/components/TopBar/CallButton.vue @@ -177,6 +177,11 @@ export default { }, async joinCall() { + let flags = PARTICIPANT.CALL_FLAG.IN_CALL + if (this.conversation.publishingPermissions === PARTICIPANT.PUBLISHING_PERMISSIONS.ALL) { + flags |= PARTICIPANT.CALL_FLAG.WITH_AUDIO | PARTICIPANT.CALL_FLAG.WITH_VIDEO + } + console.info('Joining call') this.loading = true // Close navigation @@ -186,6 +191,7 @@ export default { await this.$store.dispatch('joinCall', { token: this.token, participantIdentifier: this.$store.getters.getParticipantIdentifier(), + flags: flags, }) this.loading = false }, diff --git a/src/constants.js b/src/constants.js index 6cebbc53e..e422f9a7f 100644 --- a/src/constants.js +++ b/src/constants.js @@ -86,6 +86,13 @@ export const PARTICIPANT = { USER_SELF_JOINED: 5, GUEST_MODERATOR: 6, }, + PUBLISHING_PERMISSIONS: { + NONE: 0, + AUDIO: 1, + VIDEO: 2, + SCREENSHARING: 4, + ALL: 7, + }, } export const WEBINAR = { LOBBY: { |