Use this file to discover all available pages before exploring further.
The matrix-js-sdk provides full WebRTC calling support through two complementary APIs:
MatrixCall — 1:1 calls between two Matrix users
GroupCall — multi-party calls across a room
Both are built on WebRTC and signalled via Matrix room events.
MatrixRTC (LiveKit-based) is the recommended path for new multi-party calling features. GroupCall is the legacy implementation. See the MatrixRTC guide for the modern approach.
client.getMediaHandler() returns the MediaHandler instance that manages local camera and microphone streams. Configure it before or during a call.
const mediaHandler = client.getMediaHandler();// Switch the active microphoneawait mediaHandler.setAudioInput("device-id-from-enumerateDevices");// Switch the active cameraawait mediaHandler.setVideoInput("device-id-from-enumerateDevices");// Set both at onceawait mediaHandler.setMediaInputs(audioDeviceId, videoDeviceId);// Configure audio processingawait mediaHandler.setAudioSettings({ autoGainControl: true, echoCancellation: true, noiseSuppression: true,});
The MediaHandler emits MediaHandlerEvent.LocalStreamsChanged when its streams change:
import { GroupCall, GroupCallType, GroupCallIntent, GroupCallEvent, GroupCallState,} from "matrix-js-sdk";const groupCall = new GroupCall( client, room, GroupCallType.Video, /*isPtt=*/ false, GroupCallIntent.Room,);// Create the group call state event in the roomawait groupCall.create();// Listen for state changesgroupCall.on(GroupCallEvent.GroupCallStateChanged, (newState: GroupCallState, oldState: GroupCallState) => { console.log(`GroupCall state: ${oldState} -> ${newState}`);});// Listen for participant list changesgroupCall.on(GroupCallEvent.ParticipantsChanged, (participants) => { console.log("Participants:", [...participants.keys()].map((m) => m.name));});// Listen for errorsgroupCall.on(GroupCallEvent.Error, (err) => { console.error("GroupCall error:", err.code, err.message);});// Enter the call (acquires local media and connects to all members)await groupCall.enter();