This commit is contained in:
2026-02-11 07:05:20 +06:00
parent 1bd8aa0fea
commit 363f1008c6
16 changed files with 397 additions and 75 deletions

View File

@@ -16,11 +16,12 @@
</template>
<script setup lang="ts">
import type { ChadClient } from '#shared/types'
import type { ChadClient, Consumer, Producer } from '#shared/types'
const props = defineProps<{
client: ChadClient
stream: MediaStream
consumer?: Consumer
producer?: Producer
}>()
const { me } = useClients()
@@ -30,8 +31,21 @@ const isMe = computed(() => {
return props.client.socketId === me.value?.socketId
})
const track = computed(() => {
return props.consumer?.raw.track ?? props.producer?.raw.track
})
const stream = computed<MediaStream | undefined>((previousStream) => {
if (previousStream?.getTracks()[0] === track.value) {
return previousStream
}
return track.value ? new MediaStream([track.value]) : undefined
})
function watch() {
fullscreenVideo.show(props.stream)
if (stream.value)
fullscreenVideo.show(stream.value)
}
</script>