Video Chats and Live StreamsUSER-ONLY
User Walkthrough 37 of 50
Users can manage group video chats and channel live streams.
Starting a Video Chat
startVideoChat starts a video chat immediately.
const videoChat = await client.startVideoChat(chatId, {
title: "Weekly meeting",
});
For a later start, call scheduleVideoChat with a Unix timestamp in seconds.
const scheduledVideoChat = await client.scheduleVideoChat(
chatId,
Math.floor(Date.now() / 1_000) + 3_600,
);
Joining and Leaving
joinVideoChat and leaveVideoChat join and leave a video chat.
The method accepts WebRTC connection parameters produced by the library used for the call. The returned parameters belong back in that library.
const response = await client.joinVideoChat(videoChatId, connectionParams);
await client.leaveVideoChat(videoChatId);
Channel live streams have a separate joinLiveStream method.
await client.joinLiveStream(liveStreamId);
Getting Stream Information
getVideoChat retrieves a video chat.
The video chat identifier is available as videoChatId on the result of getChat.
const { videoChatId } = await client.getChat(chatId);
const videoChat = await client.getVideoChat(videoChatId);
getLiveStreamChannels returns the channels available for a live stream.
const channels = await client.getLiveStreamChannels(videoChatId);
const channel = channels[0];
downloadLiveStreamSegment accepts a channel’s values and downloads its latest segment.
const segment = await client.downloadLiveStreamSegment(
videoChatId,
channel.id,
channel.scale,
channel.timestamp,
);