показывать себя в превью
All checks were successful
Deploy / publish-web (push) Successful in 42s

This commit is contained in:
2026-02-03 16:47:33 +06:00
parent 269b19a5be
commit 1354ca3f7e
7 changed files with 95 additions and 36 deletions

View File

@@ -1,19 +1,47 @@
<template>
<div class="cursor-pointer hover:outline outline-primary rounded overflow-hidden flex items-center justify-center">
<video :srcObject="mediaStream" muted autoplay />
<div
class="relative rounded overflow-hidden flex items-center justify-center"
:class="{
'group cursor-pointer hover:outline outline-primary': !isMe,
}"
@click="watch"
>
<video :srcObject="stream" muted autoplay />
<PrimeTag
severity="secondary"
class="absolute bottom-2 text-sm opacity-70"
:class="{
'group-hover:opacity-100': !isMe,
}"
rounded
>
{{ isMe ? 'You' : client.username }}
</PrimeTag>
</div>
</template>
<script setup lang="ts">
import type { Consumer } from '#shared/types'
import type { ChadClient } from '#shared/types'
const props = defineProps<{
consumer: Consumer
client: ChadClient
stream: MediaStream
}>()
const mediaStream = computed(() => {
return new MediaStream([props.consumer.raw.track])
const { me } = useClients()
const fullscreenVideo = useFullscreenVideo()
const isMe = computed(() => {
return props.client.socketId === me.value?.socketId
})
function watch() {
if (isMe.value)
return
fullscreenVideo.show(props.stream)
}
</script>
<style>