Skip to content
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
79 changes: 60 additions & 19 deletions src/components/CallView/CallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@
@switchScreenToId="_switchScreenToId" />
</template>
</div>
<!-- Local Video Override mode -->
<div v-if="showLocalVideo" ref="videoContainer" class="video__promoted override">
<LocalVideo
ref="localVideo"
:fit-video="true"
:is-stripe="false"
:is-big="true"
:local-media-model="localMediaModel"
:video-container-aspect-ratio="videoContainerAspectRatio"
:local-call-participant-model="localCallParticipantModel"
:is-sidebar="false"
@switchScreenToId="1" />
</div>
<!-- Screens -->
<div v-if="!isSidebar && (showLocalScreen || showRemoteScreen)" id="screens">
<!-- local screen -->
Expand Down Expand Up @@ -88,7 +101,8 @@
:local-media-model="localMediaModel"
:local-call-participant-model="localCallParticipantModel"
:shared-datas="sharedDatas"
@select-video="handleSelectVideo" />
@select-video="handleSelectVideo"
@click-local-video="handleClickLocalVideo" />
<!-- Local video if the conversation is 1to1 or if sidebar -->
<LocalVideo
v-if="isOneToOneView"
Expand Down Expand Up @@ -183,6 +197,18 @@ export default {
return this.$store.getters.isGrid
},

showGrid() {
return (!this.isOneToOneView || this.showLocalScreen) && !this.isSidebar
},

gridTargetAspectRatio() {
if (this.isStripe) {
return 1
} else {
return 1.5
}
},

selectedVideoPeerId() {
return this.$store.getters.selectedVideoPeerId
},
Expand All @@ -199,33 +225,43 @@ export default {
return (this.isOneToOne && !this.isGrid) || this.isSidebar
},

showGrid() {
return (!this.isOneToOneView || this.showLocalScreen) && !this.isSidebar
hasLocalVideo() {
return this.localMediaModel.attributes.videoEnabled
},

hasLocalScreen() {
return this.localMediaModel.attributes.localScreen
return !!this.localMediaModel.attributes.localScreen
},

hasRemoteScreen() {
return this.callParticipantModelsWithScreen.length > 0
},
// The following conditions determine what to show in the "Big container"
// of the promoted view

showSelected() {
return !this.isGrid && this.hasSelectedVideo && !this.showLocalScreen && !this.showRemoteScreen
// Show local screen (has priority over anything else when screensharing)
showLocalScreen() {
return this.screens.filter(screen => screen === localCallParticipantModel.attributes.peerId).length === 1
},

showPromoted() {
return !this.isGrid && !this.hasSelectedVideo && !this.screenSharingActive
// Shows the local video if selected
showLocalVideo() {
return this.hasLocalVideo && this.$store.getters.selectedVideoPeerId === 'local'
},

showLocalScreen() {
return this.screens.filter(screen => screen === localCallParticipantModel.attributes.peerId).length === 1
// Show selected video (other than local)
showSelected() {
return !this.isGrid && this.hasSelectedVideo && !this.showLocalScreen && !this.showLocalVideo
},

// Show the current automatically promoted video
showPromoted() {
return !this.isGrid && !this.hasSelectedVideo && !this.screenSharingActive && !this.showLocalVideo
},

// Show somebody else's screen
showRemoteScreen() {
return this.shownRemoteScreenPeerId !== null
return this.shownRemoteScreenPeerId !== null && !this.showLocalVideo
},

shownRemoteScreenPeerId() {
Expand All @@ -251,14 +287,6 @@ export default {

return null
},

gridTargetAspectRatio() {
if (this.isStripe) {
return 1
} else {
return 1.5
}
},
},
watch: {
localScreen: function(localScreen) {
Expand Down Expand Up @@ -295,6 +323,13 @@ export default {
this.$store.dispatch('isGrid', false)
}
},
'hasLocalVideo': function(newValue) {
if (this.$store.getters.selectedVideoPeerId === 'local') {
if (!newValue) {
this.$store.dispatch('selectedVideoPeerId', null)
}
}
},

},
created() {
Expand Down Expand Up @@ -456,6 +491,12 @@ export default {
handleSelectVideo(peerId) {
this.$store.dispatch('isGrid', false)
this.$store.dispatch('selectedVideoPeerId', peerId)
this.isLocalVideoSelected = false
},
handleClickLocalVideo() {
// Deselect possible selected video
this.$store.dispatch('selectedVideoPeerId', 'local')
this.$store.dispatch('isGrid', false)
},
},
}
Expand Down
16 changes: 14 additions & 2 deletions src/components/CallView/Grid/Grid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
:local-media-model="localMediaModel"
:video-container-aspect-ratio="videoContainerAspectRatio"
:local-call-participant-model="localCallParticipantModel"
@switchScreenToId="1" />
@switchScreenToId="1"
@click-video="handleClickLocalVideo" />
</template>
<!-- Grid developer mode -->
<template v-else>
Expand Down Expand Up @@ -91,7 +92,8 @@
:local-media-model="localMediaModel"
:video-container-aspect-ratio="videoContainerAspectRatio"
:local-call-participant-model="localCallParticipantModel"
@switchScreenToId="1" />
@switchScreenToId="1"
@click-video="handleClickLocalVideo" />
<!-- page indicator (disabled) -->
<div
v-if="numberOfPages !== 0 && hasPagination && false"
Expand Down Expand Up @@ -213,6 +215,10 @@ export default {
type: Object,
required: true,
},
isLocalVideoSelectable: {
type: Boolean,
default: false,
},
},

data() {
Expand Down Expand Up @@ -632,9 +638,15 @@ export default {
console.debug('selected-video peer id', peerId)
this.$emit('select-video', peerId)
},

handleClickLocalVideo() {
this.$emit('click-local-video')
},

isSelected(callParticipantModel) {
return callParticipantModel.attributes.peerId === this.$store.getters.selectedVideoPeerId
},

},
}

Expand Down
Loading