Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(CallView) - add an option to disable background blur in call #10464

Merged
merged 1 commit into from
Sep 6, 2023
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
16 changes: 14 additions & 2 deletions src/components/CallView/CallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-->

<template>
<div id="call-container">
<div id="call-container" :class="{ 'blurred': isBackgroundBlurred }">
<ViewerOverlayCallView v-if="isViewerOverlay"
:token="token"
:model="promotedParticipantModel"
Expand Down Expand Up @@ -162,6 +162,7 @@ import VideoVue from './shared/VideoVue.vue'
import ViewerOverlayCallView from './shared/ViewerOverlayCallView.vue'

import { SIMULCAST } from '../../constants.js'
import BrowserStorage from '../../services/BrowserStorage.js'
import { fetchPeers } from '../../services/callsService.js'
import { EventBus } from '../../services/EventBus.js'
import { localMediaModel, localCallParticipantModel, callParticipantCollection } from '../../utils/webrtc/index.js'
Expand Down Expand Up @@ -212,6 +213,7 @@ export default {
screenVisible: true,
},
callParticipantCollection,
isBackgroundBlurred: true,
}
},
computed: {
Expand Down Expand Up @@ -439,20 +441,23 @@ export default {
// Ensure that data is properly initialized before mounting the
// subviews.
this.updateDataFromCallParticipantModels(this.callParticipantModels)
this.isBackgroundBlurred = BrowserStorage.getItem('background-blurred') !== 'false'
},
mounted() {
EventBus.$on('refresh-peer-list', this.debounceFetchPeers)

callParticipantCollection.on('remove', this._lowerHandWhenParticipantLeaves)

subscribe('switch-screen-to-id', this._switchScreenToId)
subscribe('set-background-blurred', this.setBackgroundBlurred)
},
beforeDestroy() {
EventBus.$off('refresh-peer-list', this.debounceFetchPeers)

callParticipantCollection.off('remove', this._lowerHandWhenParticipantLeaves)

unsubscribe('switch-screen-to-id', this._switchScreenToId)
unsubscribe('set-background-blurred', this.setBackgroundBlurred)
},
methods: {
/**
Expand Down Expand Up @@ -704,6 +709,10 @@ export default {
callParticipantModel.setSimulcastVideoQuality(SIMULCAST.LOW)
}
},

setBackgroundBlurred(value) {
this.isBackgroundBlurred = value
},
},
}
</script>
Expand All @@ -722,7 +731,10 @@ export default {
width: 100%;
height: 100%;
background-color: $color-call-background;
backdrop-filter: blur(25px);

&.blurred {
backdrop-filter: blur(25px);
}
}

#videos {
Expand Down
30 changes: 29 additions & 1 deletion src/components/SettingsDialog/SettingsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@
{{ t('spreed', 'Sounds for chat and call notifications can be adjusted in the personal settings.') }} ↗
</a>
</NcAppSettingsSection>
<NcAppSettingsSection id="performance"
:title="t('spreed', 'Performance')"
class="app-settings-section">
<NcCheckboxRadioSwitch id="blur-call-background"
:checked="isBackgroundBlurred"
type="switch"
class="checkbox"
@update:checked="toggleBackgroundBlurred">
{{ t('spreed', 'Blur background image in the call (may increase GPU load)') }}
</NcCheckboxRadioSwitch>
</NcAppSettingsSection>
<NcAppSettingsSection v-if="!disableKeyboardShortcuts"
id="shortcuts"
:title="t('spreed', 'Keyboard shortcuts')">
Expand Down Expand Up @@ -156,7 +167,7 @@
<script>
import { getCapabilities } from '@nextcloud/capabilities'
import { getFilePickerBuilder, showError, showSuccess } from '@nextcloud/dialogs'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { generateUrl } from '@nextcloud/router'

import NcAppSettingsDialog from '@nextcloud/vue/dist/Components/NcAppSettingsDialog.js'
Expand All @@ -168,6 +179,7 @@ import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'
import MediaDevicesPreview from '../MediaDevicesPreview.vue'

import { PRIVACY } from '../../constants.js'
import BrowserStorage from '../../services/BrowserStorage.js'
import { useSettingsStore } from '../../stores/settings.js'

const supportTypingStatus = getCapabilities()?.spreed?.config?.chat?.['typing-privacy'] !== undefined
Expand Down Expand Up @@ -199,6 +211,7 @@ export default {
attachmentFolderLoading: true,
privacyLoading: false,
playSoundsLoading: false,
isBackgroundBlurred: true,
}
},

Expand Down Expand Up @@ -240,6 +253,15 @@ export default {
},
},

created() {
const blurred = BrowserStorage.getItem('background-blurred')
if (blurred === null) {
BrowserStorage.setItem('background-blurred', 'true')
}

this.isBackgroundBlurred = blurred !== 'false'
},

mounted() {
subscribe('show-settings', this.handleShowSettings)
this.attachmentFolderLoading = false
Expand Down Expand Up @@ -299,6 +321,12 @@ export default {
this.privacyLoading = false
},

toggleBackgroundBlurred(value) {
this.isBackgroundBlurred = value
BrowserStorage.setItem('background-blurred', value)
emit('set-background-blurred', value)
},

async togglePlaySounds() {
this.playSoundsLoading = true
try {
Expand Down