2021-05-28 15:48:58 +02:00
|
|
|
<script lang="typescript">
|
2021-08-31 18:28:59 +02:00
|
|
|
import {obtainedMediaConstraintStore} from "../Stores/MediaStore";
|
2021-09-05 18:36:22 +02:00
|
|
|
import {localStreamStore, isSilentStore} from "../Stores/MediaStore";
|
2021-05-28 15:48:58 +02:00
|
|
|
import SoundMeterWidget from "./SoundMeterWidget.svelte";
|
|
|
|
import {onDestroy} from "svelte";
|
2021-08-31 18:28:59 +02:00
|
|
|
import {srcObject} from "./Video/utils";
|
2021-05-28 15:48:58 +02:00
|
|
|
|
|
|
|
let stream : MediaStream|null;
|
|
|
|
|
|
|
|
const unsubscribe = localStreamStore.subscribe(value => {
|
|
|
|
if (value.type === 'success') {
|
|
|
|
stream = value.stream;
|
|
|
|
} else {
|
|
|
|
stream = null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
onDestroy(unsubscribe);
|
|
|
|
|
2021-09-05 18:36:22 +02:00
|
|
|
|
|
|
|
let isSilent: boolean;
|
|
|
|
const unsubscribeIsSilent = isSilentStore.subscribe(value => {
|
|
|
|
isSilent = value;
|
|
|
|
});
|
|
|
|
|
|
|
|
onDestroy(unsubscribeIsSilent);
|
|
|
|
|
2021-05-28 15:48:58 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<div>
|
2021-09-05 18:36:22 +02:00
|
|
|
<div class="video-container div-myCamVideo" class:hide={!$obtainedMediaConstraintStore.video || isSilent}>
|
2021-08-31 18:28:59 +02:00
|
|
|
{#if $localStreamStore.type === "success" && $localStreamStore.stream}
|
|
|
|
<video class="myCamVideo" use:srcObject={stream} autoplay muted playsinline></video>
|
2021-05-28 15:48:58 +02:00
|
|
|
<SoundMeterWidget stream={stream}></SoundMeterWidget>
|
2021-06-15 18:34:11 +02:00
|
|
|
{/if}
|
2021-05-28 15:48:58 +02:00
|
|
|
</div>
|
2021-09-05 18:36:22 +02:00
|
|
|
<div class="is-silent" class:hide={isSilent}>
|
|
|
|
Silent zone
|
|
|
|
</div>
|
2021-05-28 15:48:58 +02:00
|
|
|
</div>
|