Skip to content
Last updated

Video Calling

Set up video calls with the Sinch JavaScript Voice and Video SDK.

Setting up a video call

Video calls follow the same flow as audio calls. Use CallClient.callUserVideo() to start a video call with a specific user. You’ll receive the same callbacks as for audio: progressing, ringing, answered, and established. For lifecycle details, see Audio calling.

Showing the video streams

Once you have a Call, you can access two MediaStreams:

  • incomingStream — remote stream sent to your app
  • outgoingStream — your local stream sent to the other party

Access them via Call.incomingStream and Call.outgoingStream.

Bind the appropriate stream to a <video> element by setting srcObject:

const videoElement = document.getElementById(`${direction}-video`);
videoElement.srcObject = call.incomingStream;

Pausing and resuming a video stream

Use Call.pauseVideo() to temporarily stop sending your local video (for privacy or to save bandwidth). Use Call.resumeVideo to start sending it again. Audio continues unless you mute it separately.

Switching capturing device

To select a specific camera, set the deviceId constraint via CallClient.setVideoTrackConstraints().

sinchClient.callClient.setVideoTrackConstraints({
  deviceId: { exact: <yourVideoDeviceId> },
});

For a full sample of input/output device selection, see the reference app.