Skip to content

Commit 24c9970

Browse files
Antreesybackportbot[bot]
authored andcommitted
fix(call): resume input device track after change
- with BottomBar and one-click selection, devices should not be muted anymore, as users directly trying them during the call - managed by component only, not touching the localModel - fake 'enabled' state to avoid icon flickering Signed-off-by: Maksim Sukharev <[email protected]>
1 parent 3473524 commit 24c9970

File tree

2 files changed

+54
-4
lines changed

2 files changed

+54
-4
lines changed

src/components/CallView/shared/LocalAudioControlButton.vue

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
'no-audio-available': !isAudioAvailable,
2323
'audio-control-button': showDevices,
2424
}"
25-
:disabled="!isAudioAllowed"
25+
:disabled="!isAudioAllowed || resumeAudioAfterChange"
2626
@click.stop="toggleAudio">
2727
<template #icon>
2828
<VolumeIndicator
2929
:audio-preview-available="isAudioAvailable"
30-
:audio-enabled="showMicrophoneOn"
30+
:audio-enabled="showMicrophoneOn || resumeAudioAfterChange"
3131
:current-volume="model.attributes.currentVolume"
3232
:volume-threshold="model.attributes.volumeThreshold"
3333
overlay-muted-color="#888888" />
@@ -178,6 +178,9 @@ export default {
178178
unsubscribeFromDevices,
179179
} = useDevices()
180180
181+
/* Flag to smoothly toggle the audio while in call */
182+
const resumeAudioAfterChange = ref(false)
183+
181184
/**
182185
* Check if component is visible and not obstructed by others
183186
*
@@ -204,6 +207,7 @@ export default {
204207
updatePreferences,
205208
subscribeToDevices,
206209
unsubscribeFromDevices,
210+
resumeAudioAfterChange,
207211
}
208212
},
209213
@@ -259,6 +263,22 @@ export default {
259263
},
260264
},
261265
266+
watch: {
267+
isAudioAvailable(newValue) {
268+
if (newValue && this.resumeAudioAfterChange) {
269+
// New track is available, resume audio
270+
this.model.enableAudio()
271+
this.resumeAudioAfterChange = false
272+
}
273+
},
274+
275+
audioInputId(newValue) {
276+
if (!newValue && this.resumeAudioAfterChange) {
277+
this.resumeAudioAfterChange = false
278+
}
279+
},
280+
},
281+
262282
created() {
263283
useHotKey('m', this.toggleAudio)
264284
useHotKey(' ', this.toggleAudio, { push: true })
@@ -288,6 +308,10 @@ export default {
288308
},
289309
290310
handleAudioInputIdChange(audioInputId) {
311+
if (this.showDevices && this.showMicrophoneOn) {
312+
// If input was changed from bottom bar while active, it should not be muted after track change
313+
this.resumeAudioAfterChange = true
314+
}
291315
this.audioInputId = audioInputId
292316
this.updatePreferences('audioinput')
293317
},

src/components/CallView/shared/LocalVideoControlButton.vue

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
'no-video-available': !isVideoAvailable,
1414
'video-control-button': showDevices,
1515
}"
16-
:disabled="!isVideoAllowed"
16+
:disabled="!isVideoAllowed || resumeVideoAfterChange"
1717
@click.stop="toggleVideo">
1818
<template #icon>
19-
<IconVideo v-if="showVideoOn" :size="20" />
19+
<IconVideo v-if="showVideoOn || resumeVideoAfterChange" :size="20" />
2020
<IconVideoOffOutline v-else :size="20" />
2121
</template>
2222
</NcButton>
@@ -49,6 +49,7 @@
4949
import { emit } from '@nextcloud/event-bus'
5050
import { t } from '@nextcloud/l10n'
5151
import { useHotKey } from '@nextcloud/vue/composables/useHotKey'
52+
import { ref } from 'vue'
5253
import NcActionButton from '@nextcloud/vue/components/NcActionButton'
5354
import NcActionCaption from '@nextcloud/vue/components/NcActionCaption'
5455
import NcActions from '@nextcloud/vue/components/NcActions'
@@ -113,13 +114,18 @@ export default {
113114
subscribeToDevices,
114115
unsubscribeFromDevices,
115116
} = useDevices()
117+
118+
/* Flag to smoothly toggle the video while in call */
119+
const resumeVideoAfterChange = ref(false)
120+
116121
return {
117122
devices,
118123
videoInputId,
119124
updateDevices,
120125
updatePreferences,
121126
subscribeToDevices,
122127
unsubscribeFromDevices,
128+
resumeVideoAfterChange,
123129
}
124130
},
125131
@@ -183,6 +189,22 @@ export default {
183189
},
184190
},
185191
192+
watch: {
193+
isVideoAvailable(newValue) {
194+
if (newValue && this.resumeVideoAfterChange) {
195+
// New track is available, resume video
196+
this.model.enableVideo()
197+
this.resumeVideoAfterChange = false
198+
}
199+
},
200+
201+
videoInputId(newValue) {
202+
if (!newValue && this.resumeVideoAfterChange) {
203+
this.resumeVideoAfterChange = false
204+
}
205+
},
206+
},
207+
186208
created() {
187209
useHotKey('v', this.toggleVideo)
188210
},
@@ -211,6 +233,10 @@ export default {
211233
},
212234
213235
handleVideoInputIdChange(videoInputId) {
236+
if (this.showDevices && this.showVideoOn) {
237+
// If input was changed from bottom bar while active, it should not be muted after track change
238+
this.resumeVideoAfterChange = true
239+
}
214240
this.videoInputId = videoInputId
215241
this.updatePreferences('videoinput')
216242
},

0 commit comments

Comments
 (0)