uberf-7206: adjustments and resources to support desktop screenshare (#5790)

Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
Alexey Zinoviev 2024-06-12 16:19:46 +04:00 committed by GitHub
parent 363cca4559
commit fb7679ae5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 126 additions and 7 deletions

View File

@ -57,6 +57,8 @@
"LeaveRoomConfirmation": "Are you sure you want to leave the room?",
"ServiceNotConfigured": "Service is not configured",
"FullscreenMode": "Full-screen mode",
"ExitingFullscreenMode": "Exiting fullscreen mode"
"ExitingFullscreenMode": "Exiting fullscreen mode",
"Select": "Select",
"ChooseShare": "Choose what to share"
}
}

View File

@ -57,6 +57,8 @@
"LeaveRoomConfirmation": "¿Estás seguro de que quieres salir de la sala?",
"ServiceNotConfigured": "El servicio no está configurado",
"FullscreenMode": "Modo de pantalla completa",
"ExitingFullscreenMode": "Salir del modo de pantalla completa"
"ExitingFullscreenMode": "Salir del modo de pantalla completa",
"Select": "Seleccionar",
"ChooseShare": "Elija qué compartir"
}
}

View File

@ -57,6 +57,8 @@
"LeaveRoomConfirmation": "Tem certeza de que deseja sair da sala?",
"ServiceNotConfigured": "O serviço não está configurado",
"FullscreenMode": "Modo de ecrã inteiro",
"ExitingFullscreenMode": "Saindo do modo de tela cheia"
"ExitingFullscreenMode": "Saindo do modo de tela cheia",
"Select": "Seleccione",
"ChooseShare": "Escolha o que partilhar"
}
}

View File

@ -57,6 +57,8 @@
"LeaveRoomConfirmation": "Вы уверены, что хотите покинуть комнату?",
"ServiceNotConfigured": "Сервис не настроен",
"FullscreenMode": "Полноэкранный режим",
"ExitingFullscreenMode": "Выход из полноэкранного режима"
"ExitingFullscreenMode": "Выход из полноэкранного режима",
"Select": "Выбрать",
"ChooseShare": "Выберите, чем вы хотите поделиться"
}
}

View File

@ -0,0 +1,89 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte'
import { Card } from '@hcengineering/presentation'
import { Button } from '@hcengineering/ui'
import { ScreenSource } from '@hcengineering/love'
import love from '../plugin'
export let sources: ScreenSource[]
const dispatch = createEventDispatcher()
let selectedSourceId: string | undefined
</script>
<Card
label={love.string.ChooseShare}
width="large"
okAction={() => {
dispatch('update', selectedSourceId)
}}
okLabel={love.string.Select}
canSave={selectedSourceId !== undefined}
on:close={() => dispatch('close')}
>
<div class="root">
{#each sources as source}
<!-- svelte-ignore a11y-missing-attribute -->
<Button
kind="ghost"
justify="left"
height="auto"
selected={source.id === selectedSourceId}
on:click={() => {
selectedSourceId = source.id
}}
>
<svelte:fragment slot="content">
<div class="item">
<div class="title">
{#if source.appIconURL != null}
<img class="icon" src={source.appIconURL} />
{/if}
<div class="name">
{source.name}
</div>
</div>
<img src={source.thumbnailURL} />
</div>
</svelte:fragment>
</Button>
{/each}
</div>
</Card>
<style lang="scss">
.root {
padding: 0 2rem;
display: flex;
flex-wrap: wrap;
gap: 1rem;
height: 100%;
}
.item {
padding: 1rem;
display: flex;
flex-direction: column;
width: 262px;
}
.title {
margin-bottom: 0.5rem;
display: flex;
gap: 1rem;
overflow: hidden;
}
.name {
min-width: 0;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.icon {
width: 1rem;
height: 1rem;
}
</style>

View File

@ -3,14 +3,18 @@ import ControlExt from './components/ControlExt.svelte'
import Main from './components/Main.svelte'
import Settings from './components/Settings.svelte'
import WorkbenchExtension from './components/WorkbenchExtension.svelte'
import SelectScreenSourcePopup from './components/SelectScreenSourcePopup.svelte'
import { toggleMic, toggleVideo } from './utils'
export { setCustomCreateScreenTracks } from './utils'
export default async (): Promise<Resources> => ({
component: {
Main,
ControlExt,
Settings,
WorkbenchExtension
WorkbenchExtension,
SelectScreenSourcePopup
},
actionImpl: {
ToggleMic: toggleMic,

View File

@ -70,6 +70,8 @@ export default mergeIds(loveId, love, {
FullscreenMode: '' as IntlString,
ExitingFullscreenMode: '' as IntlString,
Invite: '' as IntlString,
KnockAction: '' as IntlString
KnockAction: '' as IntlString,
Select: '' as IntlString,
ChooseShare: '' as IntlString
}
})

View File

@ -22,6 +22,7 @@ import {
ConnectionState,
Room as LKRoom,
LocalAudioTrack,
type LocalTrack,
LocalVideoTrack,
RoomEvent,
Track,
@ -95,6 +96,10 @@ export const lk: LKRoom = new LKRoom({
}
})
export function setCustomCreateScreenTracks (value: () => Promise<Array<LocalTrack<Track.Kind>>>): void {
lk.localParticipant.createScreenTracks = value
}
async function prepare (): Promise<void> {
const wsURL = getMetadata(love.metadata.WebSocketURL)
if (wsURL !== undefined) {

View File

@ -4,10 +4,11 @@ import { Drive } from '@hcengineering/drive'
import { NotificationType } from '@hcengineering/notification'
import { Asset, IntlString, Metadata, Plugin, plugin } from '@hcengineering/platform'
import { Preference } from '@hcengineering/preference'
import { AnyComponent } from '@hcengineering/ui/src/types'
import { Action } from '@hcengineering/view'
export const loveId = 'love' as Plugin
export type { ScreenSource } from './utils'
export const GRID_WIDTH = 15
export enum RoomAccess {
@ -146,6 +147,9 @@ const love = plugin(loveId, {
space: {
Rooms: '' as Ref<Space>,
Drive: '' as Ref<Drive>
},
component: {
SelectScreenSourcePopup: '' as AnyComponent
}
})

View File

@ -173,3 +173,10 @@ export function checkIntersection (rooms: Slot[], width: number, height: number,
}
return false
}
export interface ScreenSource {
id: string
name: string
thumbnailURL: string
appIconURL: string
}