2021-06-11 11:29:36 +02:00
|
|
|
<script lang="ts">
|
2021-11-26 23:30:21 +01:00
|
|
|
import type { VideoPeer } from "../../WebRtc/VideoPeer";
|
2021-06-11 11:29:36 +02:00
|
|
|
import SoundMeterWidget from "../SoundMeterWidget.svelte";
|
|
|
|
import microphoneCloseImg from "../images/microphone-close.svg";
|
|
|
|
import reportImg from "./images/report.svg";
|
|
|
|
import blockSignImg from "./images/blockSign.svg";
|
2021-11-26 23:30:21 +01:00
|
|
|
import { videoFocusStore } from "../../Stores/VideoFocusStore";
|
|
|
|
import { showReportScreenStore } from "../../Stores/ShowReportScreenStore";
|
|
|
|
import { getColorByString, srcObject } from "./utils";
|
2021-11-30 19:10:35 +01:00
|
|
|
|
2021-12-07 13:56:28 +01:00
|
|
|
import Woka from "../Woka/Woka.svelte";
|
2021-06-11 11:29:36 +02:00
|
|
|
|
|
|
|
export let peer: VideoPeer;
|
|
|
|
let streamStore = peer.streamStore;
|
|
|
|
let name = peer.userName;
|
|
|
|
let statusStore = peer.statusStore;
|
|
|
|
let constraintStore = peer.constraintsStore;
|
|
|
|
|
2021-06-15 15:16:01 +02:00
|
|
|
function openReport(peer: VideoPeer): void {
|
2021-11-26 23:30:21 +01:00
|
|
|
showReportScreenStore.set({ userId: peer.userId, userName: peer.userName });
|
2021-06-15 15:16:01 +02:00
|
|
|
}
|
2021-06-11 11:29:36 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="video-container">
|
2021-11-26 23:30:21 +01:00
|
|
|
{#if $statusStore === "connecting"}
|
|
|
|
<div class="connecting-spinner" />
|
2021-06-11 11:29:36 +02:00
|
|
|
{/if}
|
2021-11-26 23:30:21 +01:00
|
|
|
{#if $statusStore === "error"}
|
|
|
|
<div class="rtc-error" />
|
2021-06-11 11:29:36 +02:00
|
|
|
{/if}
|
|
|
|
{#if !$constraintStore || $constraintStore.video === false}
|
2021-12-07 15:21:54 +01:00
|
|
|
<i class="container" style="background-color: {getColorByString(name)};">
|
|
|
|
<div class="woka-icon"><Woka userId={peer.userId} placeholderSrc={""} /></div>
|
2021-11-26 23:30:21 +01:00
|
|
|
</i>
|
2021-06-11 11:29:36 +02:00
|
|
|
{/if}
|
|
|
|
{#if $constraintStore && $constraintStore.audio === false}
|
2021-11-26 23:30:21 +01:00
|
|
|
<img src={microphoneCloseImg} class="active" alt="Muted" />
|
2021-06-11 11:29:36 +02:00
|
|
|
{/if}
|
2021-06-15 15:16:01 +02:00
|
|
|
<button class="report" on:click={() => openReport(peer)}>
|
2021-11-26 23:30:21 +01:00
|
|
|
<img alt="Report this user" src={reportImg} />
|
2021-06-11 11:29:36 +02:00
|
|
|
<span>Report/Block</span>
|
|
|
|
</button>
|
2021-12-06 16:12:37 +01:00
|
|
|
<!-- svelte-ignore a11y-media-has-caption -->
|
2021-11-26 23:30:21 +01:00
|
|
|
<video use:srcObject={$streamStore} autoplay playsinline on:click={() => videoFocusStore.toggleFocus(peer)} />
|
2021-06-15 15:16:01 +02:00
|
|
|
<img src={blockSignImg} class="block-logo" alt="Block" />
|
2021-06-11 11:29:36 +02:00
|
|
|
{#if $constraintStore && $constraintStore.audio !== false}
|
2021-11-26 23:30:21 +01:00
|
|
|
<SoundMeterWidget stream={$streamStore} />
|
2021-06-11 11:29:36 +02:00
|
|
|
{/if}
|
|
|
|
</div>
|
2021-12-07 15:21:54 +01:00
|
|
|
|
|
|
|
<style>
|
|
|
|
.container {
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.woka-icon {
|
|
|
|
margin-right: 3px;
|
|
|
|
}
|
|
|
|
</style>
|