Skip to main content
Version: 2.x.x

useRTCStream Hook Properties - React Native

kind​

  • type: "audio" | "video" | "share" | "shareAudio"

  • kind is the type of stream. It is undefined until the stream is found.


stream​

  • type: RTCStream or null

  • The stream for the streamId you passed, or null while no participant in the room has a stream with that ID.

  • stream has id, kind, participantId (the participant who publishes it), track, pause() and resume(). Listen for its state with onStreamStateChanged.

  • To render a video or share stream, pass new MediaStream([stream.track]).toURL() to RTCView. Audio plays without a view.


track​

  • type: MediaStreamTrack

  • The stream's track. Wrap it in a MediaStream to 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


Was this helpful?

Not helpfulHelpful