2021-06-11 11:29:36 +02:00
|
|
|
<script lang="ts">
|
2021-06-17 10:07:15 +02: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-06-15 14:45:01 +02:00
|
|
|
import {videoFocusStore} from "../../Stores/VideoFocusStore";
|
2021-06-15 15:16:01 +02:00
|
|
|
import {showReportScreenStore} from "../../Stores/ShowReportScreenStore";
|
2021-06-21 14:07:03 +02:00
|
|
|
import {getColorByString, srcObject} from "./utils";
|
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 {
|
|
|
|
showReportScreenStore.set({ userId:peer.userId, userName: peer.userName });
|
|
|
|
}
|
|
|
|
|
2021-06-11 11:29:36 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="video-container">
|
|
|
|
{#if $statusStore === 'connecting'}
|
|
|
|
<div class="connecting-spinner"></div>
|
|
|
|
{/if}
|
|
|
|
{#if $statusStore === 'error'}
|
|
|
|
<div class="rtc-error"></div>
|
|
|
|
{/if}
|
|
|
|
{#if !$constraintStore || $constraintStore.video === false}
|
|
|
|
<i style="background-color: {getColorByString(name)};">{name}</i>
|
|
|
|
{/if}
|
|
|
|
{#if $constraintStore && $constraintStore.audio === false}
|
2021-08-10 10:12:31 +02: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-06-11 11:29:36 +02:00
|
|
|
<img alt="Report this user" src={reportImg}>
|
|
|
|
<span>Report/Block</span>
|
|
|
|
</button>
|
2021-09-09 16:51:02 +02:00
|
|
|
<video use:srcObject={$streamStore} autoplay playsinline on:click={() => videoFocusStore.toggleFocus(peer)}></video>
|
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}
|
|
|
|
<SoundMeterWidget stream={$streamStore}></SoundMeterWidget>
|
|
|
|
{/if}
|
|
|
|
</div>
|
|
|
|
|