2021-05-28 15:48:58 +02:00
|
|
|
<script lang="typescript">
|
2021-12-06 16:12:37 +01:00
|
|
|
import { obtainedMediaConstraintStore } from "../Stores/MediaStore";
|
|
|
|
import { localStreamStore, isSilentStore } from "../Stores/MediaStore";
|
2021-05-28 15:48:58 +02:00
|
|
|
import SoundMeterWidget from "./SoundMeterWidget.svelte";
|
2021-12-06 16:12:37 +01:00
|
|
|
import { onDestroy } from "svelte";
|
|
|
|
import { srcObject } from "./Video/utils";
|
2022-01-21 17:06:03 +01:00
|
|
|
import LL from "../i18n/i18n-svelte";
|
2021-05-28 15:48:58 +02:00
|
|
|
|
2021-12-06 16:12:37 +01:00
|
|
|
let stream: MediaStream | null;
|
2021-05-28 15:48:58 +02:00
|
|
|
|
2021-12-06 16:12:37 +01:00
|
|
|
const unsubscribe = localStreamStore.subscribe((value) => {
|
|
|
|
if (value.type === "success") {
|
2021-05-28 15:48:58 +02:00
|
|
|
stream = value.stream;
|
|
|
|
} else {
|
|
|
|
stream = null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
onDestroy(unsubscribe);
|
|
|
|
|
2021-09-05 18:36:22 +02:00
|
|
|
let isSilent: boolean;
|
2021-12-06 16:12:37 +01:00
|
|
|
const unsubscribeIsSilent = isSilentStore.subscribe((value) => {
|
2021-09-05 18:36:22 +02:00
|
|
|
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}
|
2021-12-06 16:12:37 +01:00
|
|
|
<video class="myCamVideo" use:srcObject={stream} autoplay muted playsinline />
|
|
|
|
<SoundMeterWidget {stream} />
|
2021-06-15 18:34:11 +02:00
|
|
|
{/if}
|
2021-05-28 15:48:58 +02:00
|
|
|
</div>
|
2022-01-21 17:06:03 +01:00
|
|
|
<div class="is-silent" class:hide={isSilent}>{$LL.camera.my.silentZone()}</div>
|
2021-05-28 15:48:58 +02:00
|
|
|
</div>
|