SoundMeterWidget no longer instantiate new SoundMeter

This commit is contained in:
Hanusiak Piotr
2022-02-03 14:51:47 +01:00
parent 40aae25e11
commit a4cd626c41
5 changed files with 40 additions and 95 deletions
@@ -11,13 +11,14 @@
import type { Streamable } from "../../Stores/StreamableCollectionStore";
import Woka from "../Woka/Woka.svelte";
import { onMount } from "svelte";
import { onDestroy, onMount } from "svelte";
import { isMediaBreakpointOnly } from "../../Utils/BreakpointsUtils";
export let clickable = false;
export let peer: VideoPeer;
let streamStore = peer.streamStore;
let volumeStore = peer.volumeStore;
let name = peer.userName;
let statusStore = peer.statusStore;
let constraintStore = peer.constraintsStore;
@@ -29,6 +30,11 @@
let embedScreen: EmbedScreen;
let videoContainer: HTMLDivElement;
let minimized = isMediaBreakpointOnly("md");
let volume = 0;
const unsubscribe = volumeStore.subscribe((value) => {
volume = value ?? 0;
});
if (peer) {
embedScreen = {
@@ -48,6 +54,10 @@
onMount(() => {
resizeObserver.observe(videoContainer);
});
onDestroy(() => {
unsubscribe();
});
</script>
<div
@@ -93,7 +103,7 @@
/>
<img src={blockSignImg} draggable="false" on:dragstart|preventDefault={noDrag} class="block-logo" alt="Block" />
{#if $constraintStore && $constraintStore.audio !== false}
<SoundMeterWidget stream={$streamStore} />
<SoundMeterWidget {volume} />
{/if}
</div>