useRTCStream Hook Properties - React Native
kind
-
type:
"audio"|"video"|"share"|"shareAudio" -
kindis the type of stream. It isundefineduntil the stream is found.
stream
-
type:
RTCStreamornull -
The stream for the
streamIdyou passed, ornullwhile no participant in the room has a stream with that ID. -
streamhasid,kind,participantId(the participant who publishes it),track,pause()andresume(). Listen for its state withonStreamStateChanged. -
To render a
videoorsharestream, passnew MediaStream([stream.track]).toURL()toRTCView. Audio plays without a view.
track
-
type:
MediaStreamTrack -
The stream's track. Wrap it in a
MediaStreamto render it:
import { MediaStream, RTCView, useRTCStream } from "@videosdk.live/react-native-sdk";
function StreamView({ streamId }) {
const { track } = useRTCStream(streamId);
return track ? (
<RTCView
streamURL={new MediaStream([track]).toURL()}
objectFit="cover"
style={{ flex: 1 }}
/>
) : null;
}
Got a Question? Ask us on discord

