workadventure/front/src/Components/Video/LocalStreamMedia.svelte

24 lines
736 B
Svelte
Raw Normal View History

<script lang="typescript">
2021-06-14 17:59:50 +02:00
import {ScreenSharingLocalMedia} from "../../Stores/ScreenSharingStore";
function srcObject(node, stream) {
node.srcObject = stream;
return {
update(newStream) {
if (node.srcObject != newStream) {
node.srcObject = newStream
}
}
}
}
2021-06-14 17:59:50 +02:00
export let peer : ScreenSharingLocalMedia;
let stream : MediaStream|undefined = peer.stream;
export let cssClass : string|undefined;
</script>
<div class="video-container {cssClass}" class:hide={!stream}>
2021-06-14 17:59:50 +02:00
<video class="myCamVideo" use:srcObject={stream} autoplay muted playsinline on:click={() => peer.importanceStore.toggle()}></video>
</div>