Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/components/MediaSettings/MediaSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -616,11 +616,8 @@ export default {
} else {
this.clearVirtualBackground()
}
} else {
// Disable virtual background when closing
this.clearVirtualBackground()
this.unsubscribeFromDevices()
}
// Teardown should be handled in close() to cover both NcDialog and div use-cases
},

audioInputId(audioInputId) {
Expand Down Expand Up @@ -703,6 +700,11 @@ export default {
},

close() {
if (this.show) {
// Disable virtual background and release devices when closing
this.clearVirtualBackground()
this.unsubscribeFromDevices()
}
this.show = false
this.updatedBackground = undefined
this.audioDeviceStateChanged = false
Expand Down
6 changes: 3 additions & 3 deletions src/composables/useDevices.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { createSharedComposable } from '@vueuse/core'
import createHark from 'hark'
import { computed, onBeforeUnmount, ref, watch } from 'vue'
import { computed, onScopeDispose, ref, watch } from 'vue'
import { useSoundsStore } from '../stores/sounds.js'
import attachMediaStream from '../utils/attachmediastream.js'
import TrackToStream from '../utils/media/pipeline/TrackToStream.js'
Expand Down Expand Up @@ -124,9 +124,9 @@ export const useDevices = createSharedComposable(function() {
})

/**
* Called for shared composable when all subscribers are unmounted (onScopeDispose)
* Called for shared composable when all subscribers are unmounted
*/
onBeforeUnmount(() => {
onScopeDispose(() => {
stopDevices()
})

Expand Down
Loading