Skip to content

Commit 40d7cda

Browse files
authored
Merge pull request #16521 from nextcloud/backport/16517/stable31
[stable31] fix: force disabled media when permissions are granted in call
2 parents 436d3b9 + 2faba7b commit 40d7cda

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/components/CallView/shared/VideoVue.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ import TransitionWrapper from '../../UIShared/TransitionWrapper.vue'
9494
import Screen from './Screen.vue'
9595
import VideoBackground from './VideoBackground.vue'
9696
import VideoBottomBar from './VideoBottomBar.vue'
97-
import { ATTENDEE, AVATAR } from '../../../constants.ts'
97+
import { ATTENDEE, AVATAR, PARTICIPANT } from '../../../constants.ts'
9898
import { EventBus } from '../../../services/EventBus.ts'
9999
import { useCallViewStore } from '../../../stores/callView.ts'
100100
import { useGuestNameStore } from '../../../stores/guestName.js'
@@ -456,7 +456,10 @@ export default {
456456
},
457457
458458
hasVideo() {
459-
return !this.model.attributes.videoBlocked && this.model.attributes.videoAvailable && this.sharedData.remoteVideoBlocker.isVideoEnabled() && (typeof this.model.attributes.stream === 'object')
459+
return !!(this.participant.permissions & PARTICIPANT.PERMISSIONS.PUBLISH_VIDEO)
460+
&& !this.model.attributes.videoBlocked
461+
&& this.model.attributes.videoAvailable
462+
&& this.sharedData.remoteVideoBlocker.isVideoEnabled() && (typeof this.model.attributes.stream === 'object')
460463
},
461464
462465
hasSelectedVideo() {

src/utils/webrtc/webrtc.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,16 +1060,22 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local
10601060
const removeSender = (hasAudioSenders && !(currentParticipant.participantPermissions & PARTICIPANT.PERMISSIONS.PUBLISH_AUDIO))
10611061
|| (hasVideoSenders && !(currentParticipant.participantPermissions & PARTICIPANT.PERMISSIONS.PUBLISH_VIDEO))
10621062

1063-
if (currentParticipant.participantPermissions & PARTICIPANT.PERMISSIONS.PUBLISH_AUDIO) {
1064-
webrtc.webrtc.allowAudio()
1065-
} else {
1063+
const hasPublishAudioPermissions = !!(currentParticipant.participantPermissions & PARTICIPANT.PERMISSIONS.PUBLISH_AUDIO)
1064+
const hasPublishVideoPermissions = !!(currentParticipant.participantPermissions & PARTICIPANT.PERMISSIONS.PUBLISH_VIDEO)
1065+
1066+
if (!hasPublishAudioPermissions) {
1067+
// If permissions were revoked, disable media devices
10661068
webrtc.webrtc.disallowAudio()
1069+
} else if (!webrtc.webrtc.isAudioAllowed()) {
1070+
// If permissions were just granted and media was not previous allowed
1071+
// Mute audio to avoid unintentional audio publishing
1072+
webrtc.webrtc.mute()
10671073
}
10681074

1069-
if (currentParticipant.participantPermissions & PARTICIPANT.PERMISSIONS.PUBLISH_VIDEO) {
1070-
webrtc.webrtc.allowVideo()
1071-
} else {
1075+
if (!hasPublishVideoPermissions) {
10721076
webrtc.webrtc.disallowVideo()
1077+
} else if (!webrtc.webrtc.isVideoAllowed()) {
1078+
webrtc.webrtc.pauseVideo()
10731079
}
10741080

10751081
if (webrtc.webrtc.isLocalMediaActive()

0 commit comments

Comments
 (0)