This message was deleted.
# helpdesk
s
This message was deleted.
e
can you confirm whether the video is being outputted to other participants in the room?
a
I noticed that my local video is only shown when I connect in some room. I wanted to show the preview before connecting
It is possible?
e
I think this might be possible if you create the video track manually and show the videoTrack directly on the video renderer before connecting
Copy code
val track = localParticipant.createVideoTrack()
track.startCapture()

// ...
// when connected
localParticipant.publishVideoTrack(track)
a
Yes, I already do, I want to do the camera view without connecting the room
Even starting the capture is only rendered after connected
e
are you passing the track directly to the video renderer or are you trying to get it through the localParticipant’s track publications?
a
I get direct from room.localParticipant, and use the trackers.
Copy code
val trackMap by participant::videoTracks.flow.collectAsState()

    val videoTrackMap = trackMap.minByOrNull {
        it.first.source == Track.Source.CAMERA
    }

    val videoTrack = videoTrackMap?.second as? VideoTrack

    if (videoTrack != null) {
        VideoRenderer(
            modifier = modifier,
            room = room,
            videoTrack = videoTrack,
        )
    }
Copy code
VideoItemTrackSelector(
        modifier = Modifier.fillMaxSize(),
        room = vm.room,
        participant = vm.localParticipant,
    )
e
ah yeah, iirc, the video tracks will be empty until connected since it doesn’t have a valid publication yet
a
But, same when i published, only update when conect to room
Copy code
suspend fun publishLocalCamera() {

        val videoTrack = localParticipant.createVideoTrack(
            options = LocalVideoTrackOptions(
                position = CameraPosition.FRONT,
                captureParams = VideoPreset43.QHD.capture,
            )
        )

        videoTrack.startCapture()

        localParticipant.apply {
            publishVideoTrack(videoTrack)

            setMicrophoneEnabled(true)
            setCameraEnabled(true)
        }
    }
My expected behavior is to open the application and show it with the camera rendering, without being connected to any room
e
my suggestion is to cache the videoTrack yourself and pass it directly through to the videoRenderer, rather than looking for it through the localParticipant
a
Good idea! This looks works! Thanks