Skip to main content

Stream Management

Learn how to publish and receive audio, video, and screen-share streams, pause or resume incoming media, and control video quality.

A stream represents one piece of media published by a participant, such as microphone audio, camera video, or screen share.

note

Streams live in the client SDKs only. The Server SDK has no stream operations.

Streams and tracks

A track is the raw media captured on the publishing device. A stream is the published representation of that track inside a VideoSDK room.

TrackStream
What it representsRaw media captured from a camera, microphone, screen, or custom media source.A published media track with information such as kind, codec, and paused.
Where it existsOn the publishing participant's device.On clients that receive the published media.
What you use it forConfigure capture devices and encoding.Render media, pause or resume receiving it, and inspect its state.

Custom tracks give you more control over how media is captured and encoded before it is published.

Stream kinds

VideoSDK uses the following stream kinds:

KindMedia sourceReact propertyPublished with
videoCamerawebcamStreamenableWebcam()
audioMicrophonemicStreamunmuteMic()
shareScreen sharescreenShareStreamenableScreenShare()
shareAudioAudio captured with a screen shareDelivered alongside shareenableScreenShare() on platforms that support system audio

Stream properties

A stream exposes information about the published media and its current state.

PropertyTypeDescription
kindstringMedia type: audio, video, share, or shareAudio.
codecstringCodec currently used to encode the media.
trackMediaStreamTrackUnderlying media track that can be attached to a media element or platform-specific view.
pausedbooleanIndicates whether the local client has paused receiving this stream.

Publish media

The local participant publishes microphone, camera, and screen-share media through the meeting or room object.

When a stream becomes available, clients receive an onStreamEnabled event. When that stream stops, they receive onStreamDisabled.

const {
enableWebcam,
disableWebcam,
toggleWebcam,
unmuteMic,
muteMic,
toggleMic,
enableScreenShare,
disableScreenShare,
toggleScreenShare,
} = useMeeting();

When a participant starts screen sharing, VideoSDK also triggers onPresenterChanged with that participant's participantId.

When screen sharing stops, the same event is triggered with null.

Publish media when joining

You can configure whether the microphone and camera start enabled when the participant joins using:

  • micEnabled
  • webcamEnabled

The participant's mode determines whether they are allowed to publish realtime media.

Participants in RECV_ONLY or SIGNALLING_ONLY mode do not publish media.

Use custom tracks

Custom tracks let you configure media capture and encoding before publishing the media to a room.

In React, VideoSDK provides helpers for camera, microphone, and screen-share tracks.

Camera track

createCameraVideoTrack() lets you configure:

  • Camera device.
  • Encoder configuration, from h90p_w160p through h720p_w1280p.
  • Camera facing mode.
  • Optimization mode: motion, text, or detail.

Microphone track

createMicrophoneAudioTrack() lets you configure:

  • Microphone device.
  • Audio encoder configuration.
  • Noise suppression options.

Screen-share track

createScreenShareVideoTrack() lets you configure the screen-share encoder settings.

The default configuration is h720p_15fps.

You can provide custom tracks while joining or replace media during an active session.

For example, custom tracks can be passed through:

customCameraVideoTrack
customMicrophoneAudioTrack

Or supplied when changing published media:

enableWebcam(track)
changeWebcam(track)
enableScreenShare(track)

See the platform-specific custom track documentation:

Receive and render streams

When another participant publishes media, your client receives the corresponding stream.

For example, when a remote participant enables their camera, onStreamEnabled is triggered. Your application can then attach the stream's underlying track to a video element or platform-specific video view.

import {
useParticipant,
VideoPlayer,
} from "@videosdk.live/react-sdk";

const ParticipantView = ({ participantId }) => {
const { webcamOn } = useParticipant(participantId);

return (
<VideoPlayer
participantId={participantId}
type="video" // "video" or "share"
containerStyle={{
height: "100%",
width: "100%",
}}
/>
);
};

VideoPlayer attaches the video track for you.

For microphone audio, you can place micStream.track inside a MediaStream and attach it to an <audio> element.

Display audio and video is the complete rendering guide.

Layout and grid management covers arranging participant tiles.

Pause and resume incoming streams

You can temporarily stop receiving a remote stream without affecting the publisher or other participants.

Calling pause() stops receiving that stream on the local client. Calling resume() starts receiving it again.

This is useful when:

  • A participant tile is outside the visible viewport.
  • Your interface temporarily displays participant names without video.
  • You want to reduce unnecessary media consumption for hidden elements.
const {
webcamStream,
micStream,
} = useParticipant(participantId);

webcamStream.pause();
micStream.resume();

You can also pause or resume multiple remote streams at once using:

pauseAllStreams(kind)
resumeAllStreams(kind)

The optional kind can be:

  • "audio"
  • "video"
  • "share"

The stream's paused property reflects its current state, and onStreamStateChanged is triggered when that state changes.

See the useStream methods reference for pause() and resume().

Control received video quality

VideoSDK supports multiple video quality layers through multiStream, which is enabled by default.

A publisher can send multiple resolutions of the same video. Each receiving participant can then use the layer best suited to their layout and network conditions.

Use:

setQuality("low")
setQuality("med")
setQuality("high")

to request a specific video quality.

If the network cannot sustain the selected quality, VideoSDK may temporarily use a lower quality. onVideoQualityChanged reports changes to the received video quality.

const {
setViewPort,
setQuality,
} = useParticipant(participantId);

setViewPort(
videoDivWrapperRef.offsetWidth,
videoDivWrapperRef.offsetHeight
);

await setQuality("low");

See the useParticipant methods reference for setQuality().

Disable, pause, or leave

Disabling media, pausing a stream, and leaving a room solve different problems.

What you want to doMethodWho is affected
Stop publishing your camera or microphonedisableWebcam() / muteMic()Everyone stops receiving that media, and onStreamDisabled is triggered.
Stop receiving one participant's streamstream.pause()Only the local client stops receiving it. The publisher and other participants are unaffected.
Disconnect from the room entirelyleave()The local participant leaves, and other clients receive onParticipantLeft.
tip

Turn a stream off or pause it rather than leaving and rejoining. Reconnecting renegotiates every stream in the room; toggling one stream does not.

Next steps