Skip to content

Commit

Permalink
Fix video background
Browse files Browse the repository at this point in the history
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
  • Loading branch information
marcoambrosini committed May 13, 2020
1 parent f334e7c commit ef67c15
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/components/CallView/shared/VideoBackground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
-->

<template>
<div
:style="{'background-color': backgroundColor }"
class="video-background">
<div class="video-backgroundbackground">
<div class="darken" />
<img
v-if="hasPicture"
:src="backgroundImage"
class="video-background__picture">
<div class="darken" />
<div v-if="!hasPicture"
:style="{'background-color': backgroundColor }"
class="video-background" />
</div>
</template>

Expand Down Expand Up @@ -67,13 +68,13 @@ export default {
}
},
backgroundImage() {
return `/avatar/${this.user}/500`
return `/avatar/${this.user}/300`
},
},

async beforeMount() {
try {
const response = await axios.get(generateUrl(`avatar/${this.user}/500`))
const response = await axios.get(generateUrl(`avatar/${this.user}/300`))
if (response.headers[`x-nc-iscustomavatar`] === '1') {
this.hasPicture = true
}
Expand All @@ -98,8 +99,8 @@ export default {
&__picture {
filter: blur(20px);
/* Make pic to at least 100% wide and tall */
min-width: calc(100% + 20px);
min-height: calc(100% + 20px);
min-width: 105%;
min-height: 105%;

/* Setting width & height to auto prevents the browser from stretching or squishing the pic */
width: auto;
Expand All @@ -121,15 +122,16 @@ export default {
font-weight: 500;
text-transform: uppercase;
}
}

.darken {
background-color: black;
opacity: 12%;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}
.darken {
background-color: black;
opacity: 12%;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
}

</style>

0 comments on commit ef67c15

Please sign in to comment.