Skip to content

Commit

Permalink
Fix: reset and respect flag used for skipping the global config
Browse files Browse the repository at this point in the history
Signed-off-by: DorraJaouad <[email protected]>
  • Loading branch information
DorraJaouad committed Nov 15, 2024
1 parent 3d7cbd8 commit 9ea1f70
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
24 changes: 19 additions & 5 deletions src/components/MediaSettings/MediaSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<template #tab-panel:backgrounds>
<VideoBackgroundEditor class="media-settings__tab"
:token="token"
:skip-blur-virtual-background="skipBlurVirtualBackground"
@update-background="handleUpdateVirtualBackground" />
</template>
</MediaSettingsTabs>
Expand Down Expand Up @@ -321,7 +322,7 @@ export default {
isRecordingFromStart: false,
isPublicShareAuthSidebar: false,
isMirrored: false,
skipBlurVirtualBackgroundEnabled: false,
skipBlurVirtualBackground: false,
}
},
Expand Down Expand Up @@ -428,6 +429,10 @@ export default {
return this.updatedBackground || this.audioDeviceStateChanged
|| this.videoDeviceStateChanged
},
connectionFailed() {
return this.$store.getters.connectionFailed(this.token)
},
},
watch: {
Expand All @@ -444,7 +449,7 @@ export default {
} else if (BrowserStorage.getItem('virtualBackgroundType_' + this.token) === VIRTUAL_BACKGROUND.BACKGROUND_TYPE.IMAGE) {
this.setVirtualBackgroundImage(BrowserStorage.getItem('virtualBackgroundUrl_' + this.token))
}
} else if (this.blurVirtualBackgroundEnabled) {
} else if (this.blurVirtualBackgroundEnabled && !this.skipBlurVirtualBackground) {
// Fall back to global blur background setting
this.blurVirtualBackground()
} else {
Expand Down Expand Up @@ -477,9 +482,18 @@ export default {
if (value) {
const virtualBackgroundEnabled = BrowserStorage.getItem('virtualBackgroundEnabled_' + this.token) === 'true'
// Apply global blur background setting
if (this.blurVirtualBackgroundEnabled && !this.skipBlurVirtualBackgroundEnabled && !virtualBackgroundEnabled) {
if (this.blurVirtualBackgroundEnabled && !this.skipBlurVirtualBackground && !virtualBackgroundEnabled) {
this.blurBackground(true)
}
} else {
// Reset the flag for the next call
this.skipBlurVirtualBackground = false
}
},
connectionFailed(value) {
if (value) {
this.skipBlurVirtualBackground = false
}
},
},
Expand Down Expand Up @@ -574,7 +588,7 @@ export default {
handleUpdateBackground(background) {
// Default global blur background setting was changed by user
if (this.blurVirtualBackgroundEnabled && background !== 'blur') {
this.skipBlurVirtualBackgroundEnabled = true
this.skipBlurVirtualBackground = true
}
// Apply the new background
if (background === 'none') {
Expand Down Expand Up @@ -636,7 +650,7 @@ export default {
localMediaModel.enableVirtualBackground()
localMediaModel.setVirtualBackgroundBlur(VIRTUAL_BACKGROUND.BLUR_STRENGTH.DEFAULT, globalBlurVirtualBackground)
} else if (!globalBlurVirtualBackground) {
this.skipBlurVirtualBackgroundEnabled = true
this.skipBlurVirtualBackground = true
BrowserStorage.setItem('virtualBackgroundEnabled_' + this.token, 'true')
BrowserStorage.setItem('virtualBackgroundType_' + this.token, VIRTUAL_BACKGROUND.BACKGROUND_TYPE.BLUR)
BrowserStorage.setItem('virtualBackgroundBlurStrength_' + this.token, VIRTUAL_BACKGROUND.BLUR_STRENGTH.DEFAULT)
Expand Down
7 changes: 6 additions & 1 deletion src/components/MediaSettings/VideoBackgroundEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ export default {
type: String,
required: true,
},
skipBlurVirtualBackground: {
type: Boolean,
default: false,
},
},
emits: ['update-background'],
Expand Down Expand Up @@ -265,7 +270,7 @@ export default {
} else {
this.selectedBackground = 'none'
}
} else if (this.settingsStore.blurVirtualBackgroundEnabled) {
} else if (this.settingsStore.blurVirtualBackgroundEnabled && !this.skipBlurVirtualBackground) {
this.selectedBackground = 'blur'
} else {
this.selectedBackground = 'none'
Expand Down

0 comments on commit 9ea1f70

Please sign in to comment.