2021-06-11 11:29:36 +02:00
|
|
|
<script lang="ts">
|
2022-01-05 10:27:40 +01:00
|
|
|
import { highlightedEmbedScreen } from "../../Stores/EmbedScreensStore";
|
|
|
|
import type { EmbedScreen } from "../../Stores/EmbedScreensStore";
|
|
|
|
import type { Streamable } from "../../Stores/StreamableCollectionStore";
|
|
|
|
|
2021-12-06 16:12:37 +01:00
|
|
|
import type { ScreenSharingPeer } from "../../WebRtc/ScreenSharingPeer";
|
|
|
|
import { getColorByString, srcObject } from "./utils";
|
2021-06-11 11:29:36 +02:00
|
|
|
|
2022-01-05 10:27:40 +01:00
|
|
|
export let clickable = false;
|
|
|
|
|
2021-06-11 11:29:36 +02:00
|
|
|
export let peer: ScreenSharingPeer;
|
|
|
|
let streamStore = peer.streamStore;
|
|
|
|
let name = peer.userName;
|
|
|
|
let statusStore = peer.statusStore;
|
2022-01-05 10:27:40 +01:00
|
|
|
|
|
|
|
let embedScreen: EmbedScreen;
|
|
|
|
|
|
|
|
if (peer) {
|
|
|
|
embedScreen = {
|
|
|
|
type: "streamable",
|
|
|
|
embed: peer as unknown as Streamable,
|
|
|
|
};
|
|
|
|
}
|
2021-06-11 11:29:36 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="video-container">
|
2021-12-06 16:12:37 +01:00
|
|
|
{#if $statusStore === "connecting"}
|
|
|
|
<div class="connecting-spinner" />
|
2021-06-11 11:29:36 +02:00
|
|
|
{/if}
|
2021-12-06 16:12:37 +01:00
|
|
|
{#if $statusStore === "error"}
|
|
|
|
<div class="rtc-error" />
|
2021-06-11 11:29:36 +02:00
|
|
|
{/if}
|
2022-01-28 19:17:40 +01:00
|
|
|
{#if $streamStore !== null}
|
2021-12-06 16:12:37 +01:00
|
|
|
<!-- svelte-ignore a11y-media-has-caption -->
|
2022-01-28 19:17:40 +01:00
|
|
|
<i class="container">
|
|
|
|
<span style="background-color: {getColorByString(name)};">{name}</span>
|
|
|
|
</i>
|
2022-01-05 10:27:40 +01:00
|
|
|
<video
|
|
|
|
use:srcObject={$streamStore}
|
|
|
|
autoplay
|
|
|
|
playsinline
|
|
|
|
on:click={() => (clickable ? highlightedEmbedScreen.toggleHighlight(embedScreen) : null)}
|
|
|
|
/>
|
2021-06-11 11:29:36 +02:00
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2021-12-06 16:12:37 +01:00
|
|
|
.video-container {
|
|
|
|
video {
|
|
|
|
width: 100%;
|
|
|
|
}
|
2022-01-28 19:17:40 +01:00
|
|
|
i {
|
|
|
|
span {
|
|
|
|
padding: 2px 32px;
|
|
|
|
}
|
|
|
|
}
|
2021-06-11 11:29:36 +02:00
|
|
|
}
|
|
|
|
</style>
|