Files
Webka/frontend/components/StreamVideo.vue
2026-09-06 16:23:09 +05:00

19 lines
487 B
Vue

<script setup lang="ts">
const props = defineProps<{ stream: MediaStream | null; mirror?: boolean }>();
const video = ref<HTMLVideoElement>();
watch(
() => props.stream,
async (stream) => {
await nextTick();
if (video.value) {
video.value.srcObject = stream;
if (stream) void video.value.play().catch(() => {});
}
},
{ immediate: true },
);
</script>
<template>
<video ref="video" autoplay playsinline muted :class="{ mirrored: mirror }" />
</template>