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

[stable28] feat(ViewerOverlayCallView): Add screensharing support #11033

Merged
merged 2 commits into from Dec 1, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/components/CallView/CallView.vue
Expand Up @@ -25,7 +25,9 @@
<ViewerOverlayCallView v-if="isViewerOverlay"
:token="token"
:model="promotedParticipantModel"
:shared-data="promotedParticipantModel && sharedDatas[promotedParticipantModel.attributes.peerId]" />
:shared-data="promotedParticipantModel && sharedDatas[promotedParticipantModel.attributes.peerId]"
:screens="screens"
:local-shared-data="localSharedData" />

<template v-else>
<EmptyCallView v-if="!remoteParticipantsCount && !screenSharingActive && !isGrid" :is-sidebar="isSidebar" />
Expand Down Expand Up @@ -426,12 +428,16 @@ export default {
this.adjustSimulcastQuality()
},

speakers() {
this._setPromotedParticipant()
speakers(value) {
if (value) {
this._setPromotedParticipant()
}
},

screenSharingActive() {
this._setPromotedParticipant()
shownRemoteScreenPeerId(value) {
if (value) {
this._setPromotedParticipant()
}
},

screens() {
Expand Down Expand Up @@ -656,6 +662,8 @@ export default {

if (!this.screenSharingActive && this.speakers.length) {
this.sharedDatas[this.speakers[0].id].promoted = true
} else if (this.shownRemoteScreenPeerId) {
this.sharedDatas[this.shownRemoteScreenPeerId].promoted = true
}

this.adjustSimulcastQuality()
Expand Down
42 changes: 41 additions & 1 deletion src/components/CallView/shared/ViewerOverlayCallView.vue
Expand Up @@ -67,7 +67,18 @@
</NcButton>
</div>

<VideoVue v-if="model"
<!-- local screen -->
<Screen v-if="showLocalScreen"
:token="token"
:local-media-model="localModel"
:shared-data="localSharedData" />
<!-- remote screen -->
<Screen v-else-if="screens[model.attributes.peerId]"
:token="token"
:call-participant-model="model"
:shared-data="sharedData" />

<VideoVue v-else-if="model"
class="viewer-overlay__video"
:token="token"
:model="model"
Expand All @@ -92,11 +103,13 @@

<div class="viewer-overlay__bottom-bar">
<LocalAudioControlButton class="viewer-overlay__button"
:token="token"
:conversation="conversation"
:model="localModel"
nc-button-type="secondary"
disable-keyboard-shortcuts />
<LocalVideoControlButton class="viewer-overlay__button"
:token="token"
:conversation="conversation"
:model="localModel"
nc-button-type="secondary"
Expand Down Expand Up @@ -124,6 +137,7 @@ import LocalAudioControlButton from './LocalAudioControlButton.vue'
import LocalVideo from './LocalVideo.vue'
import LocalVideoControlButton from './LocalVideoControlButton.vue'
import VideoVue from './VideoVue.vue'
import Screen from './Screen.vue'

import { localCallParticipantModel, localMediaModel } from '../../../utils/webrtc/index.js'

Expand All @@ -135,6 +149,7 @@ export default {
LocalAudioControlButton,
LocalVideoControlButton,
Portal,
Screen,
LocalVideo,
ChevronUp,
ChevronDown,
Expand All @@ -154,6 +169,7 @@ export default {
required: true,
},

// Promoted participant model
model: {
type: Object,
required: false,
Expand All @@ -177,6 +193,18 @@ export default {
required: false,
default: () => localCallParticipantModel,
},

localSharedData: {
type: Object,
required: true,
default: () => {}
},

screens: {
type: Array,
required: false,
default: () => [],
}
},

data() {
Expand All @@ -198,6 +226,14 @@ export default {
portalSelector() {
return this.$store.getters.isFullscreen() ? '#content-vue' : 'body'
},

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

showLocalScreen() {
return this.hasLocalScreen && this.screens[0] === localCallParticipantModel.attributes.peerId
},
},

mounted() {
Expand Down Expand Up @@ -310,4 +346,8 @@ export default {
position: relative;
height: 100%;
}

:deep(.screen) {
border-radius: calc(var(--default-clickable-area) / 4);
}
</style>