add video to livekit calls

This commit is contained in:
mplorentz
2026-03-26 10:49:14 -04:00
parent cf4e3f5fc6
commit 5792f77fdc
8 changed files with 421 additions and 10 deletions
+27
View File
@@ -0,0 +1,27 @@
<script lang="ts">
import type {Track} from "livekit-client"
import cx from "classnames"
type Props = {
track: Track
muted?: boolean
class?: string
}
const {track, muted = true, class: className = ""}: Props = $props()
let el = $state<HTMLVideoElement | undefined>()
$effect(() => {
const v = el
const t = track
if (!v) return
t.attach(v)
return () => {
t.detach(v)
}
})
</script>
<video bind:this={el} class={cx("h-full w-full object-cover", className)} playsinline {muted}
></video>