From 019335154655996a042f5c18d3d6cc5155924b3d Mon Sep 17 00:00:00 2001 From: Hans-Peter Herzog Date: Thu, 14 Feb 2019 13:28:19 +0100 Subject: [PATCH] TT#52484 Call: Fix resizing of the minimized remote video Change-Id: Icc7f12876dfc1c699ad49b0306ad1f67ab545f68 --- src/components/CscMedia.vue | 5 +++ src/components/call/CscCall.vue | 49 +++++++++++++++++++++++++----- src/components/layouts/Default.vue | 5 +++ 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/src/components/CscMedia.vue b/src/components/CscMedia.vue index e97b3c7e..46da6696 100644 --- a/src/components/CscMedia.vue +++ b/src/components/CscMedia.vue @@ -178,6 +178,11 @@ }, muted(muted) { this.$refs.media.muted = muted; + }, + preview() { + this.$nextTick(()=>{ + this.fitMedia(); + }); } }, computed: { diff --git a/src/components/call/CscCall.vue b/src/components/call/CscCall.vue index d20cbc35..c4d003d3 100644 --- a/src/components/call/CscCall.vue +++ b/src/components/call/CscCall.vue @@ -127,7 +127,8 @@
{ this.fetchLocalMediaWrapperWidth(); }; - this.$root.$on('window-resized', fetchLocalMediaWrapperWidth); - this.$root.$on('content-resized', fetchLocalMediaWrapperWidth); - this.$root.$on('orientation-changed', fetchLocalMediaWrapperWidth); + let fetchMediaWrapperWidth = ()=>{ + this.fetchLocalMediaWrapperWidth(); + this.fetchRemoteMediaWrapperWidth(); + }; + fetchMediaWrapperWidth(); + this.$root.$on('window-resized', fetchMediaWrapperWidth); + this.$root.$on('content-resized', fetchMediaWrapperWidth); + this.$root.$on('orientation-changed', fetchMediaWrapperWidth); }, computed: { componentClasses() { @@ -495,6 +501,14 @@ this.localMediaWrapperWidth = 0; } }, + fetchRemoteMediaWrapperWidth() { + if(this.$refs.remoteMediaWrapper) { + this.remoteMediaWrapperWidth = this.$refs.remoteMediaWrapper.clientWidth; + } + else { + this.remoteMediaWrapperWidth = 0; + } + }, startCall(media) { if(this.callState === 'input') { this.$emit('start-call', media); @@ -541,6 +555,18 @@ if(this.isMobile && this.isEstablished) { this.maximize(); } + }, + fitMedia() { + this.fetchLocalMediaWrapperWidth(); + this.fetchRemoteMediaWrapperWidth(); + this.$nextTick(()=>{ + if(this.$refs.localMedia) { + this.$refs.localMedia.fitMedia(); + } + if(this.$refs.remoteMedia) { + this.$refs.remoteMedia.fitMedia(); + } + }); } }, watch: { @@ -559,6 +585,13 @@ if(closed && this.$refs.startButton) { this.$refs.startButton.close(); } + }, + minimized() { + this.fetchLocalMediaWrapperWidth(); + this.fetchRemoteMediaWrapperWidth(); + this.$nextTick(()=>{ + this.fitMedia(); + }); } } } diff --git a/src/components/layouts/Default.vue b/src/components/layouts/Default.vue index 8a187461..c70d17ff 100644 --- a/src/components/layouts/Default.vue +++ b/src/components/layouts/Default.vue @@ -421,6 +421,11 @@ if(!this.isHome) { this.$store.commit('call/minimize'); } + if(this.$refs.call) { + this.$nextTick(()=>{ + this.$refs.call.fitMedia(); + }); + } } } }