Skip to content

Commit

Permalink
Merge pull request #10464 from nextcloud/fix/7896/disable-background-…
Browse files Browse the repository at this point in the history
…blur

perf(CallView) - add an option to disable background blur in call
  • Loading branch information
Antreesy authored Sep 6, 2023
2 parents 864e3b1 + d43d1d7 commit def55fe
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
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

0 comments on commit def55fe

Please sign in to comment.