A comprehensive WebRTC client library for real-time communication, enabling audio/video conferencing with advanced features like recording, streaming, screen sharing, and file management.
| Resource | Description |
|---|---|
| API Reference | Complete Client class documentation |
| Workflow Guide | Real-world workflow patterns and examples |
| DeviceCheck Guide | Device compatibility validation |
| File Management Guide | File filtering and management patterns |
| Connection Sequence | Connection flow visualization |
npm install @hiyve/rtc-client
import { Client, ClientEvents } from '@hiyve/rtc-client';
app.post('/generate-room-token', async function (req, res) {
try {
const response = await fetch('https://rtc.muziemedia.com/room-token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
apiKey: process.env.APIKEY,
secret: process.env.CLIENT_SECRET
}),
});
const data = await response.json();
res.send(data);
} catch (error) {
res.status(500).send({ error: 'Error generating room token' });
}
});
const { Client, ClientEvents } = window.MuzieClient;
// Initialize client
const client = new Client({ roomToken: 'your-room-token' });
// Listen for remote participants
client.addEventListener(ClientEvents.MEDIA_TRACK_ADDED, (event) => {
const { userId, track, kind, paused } = event.detail;
if (kind === 'video') {
const videoEl = document.getElementById(`remote-video-${userId}`);
videoEl.srcObject = new MediaStream([track]);
}
});
// Setup devices
const cameras = await client.listVideoDevices();
const mics = await client.listAudioInputDevices();
await client.setLocalVideoDevice({ videoDeviceId: cameras[0].deviceId });
await client.setLocalAudioInputDevice({ audioInputDeviceId: mics[0].deviceId });
// Create and join room
const room = await client.createRoom({
roomName: 'my-meeting',
userId: 'user-123'
});
// Connect media
await client.connectTransports({ localVideoElementId: 'local-video' });
See the Workflow Guide for complete examples including:
Browsers open a microphone for phone calls: echo cancellation, noise suppression, automatic gain, mono. Right for speech, wrong for an instrument or an audio interface. A capture profile names the trade-off once; the live room and any preview that uses it ask the browser for the same thing.
| Profile | Echo cancellation | Noise suppression | Auto gain | Channels | Use it for |
|---|---|---|---|---|---|
voice (default) |
on | on | off | mono | speech, speakers, noisy rooms |
music |
on | off | off | mono (Chrome drops the canceller if stereo is asked for too) | instruments on speakers — the safe upgrade |
instrument |
off | off | off | stereo when offered | headphones only: speaker sound is not removed from what is sent |
const client = new Client({ roomToken, options: { audioProfile: 'music' } });
// later, while in a room — the microphone is re-opened with the new settings
await client.setAudioProfile('instrument');
client.getAudioProfile(); // 'instrument'
Only capture changes. The encoder follows the media server's codec parameters
(stereo, bitrate, FEC), not the profile. audioProfileConstraints(profile) is
exported for previews that open the microphone themselves.
Sentiment (mood) analysis is loaded on demand and can use one of three
analysers. The faceapi analyser's library is an optional peer — install
it in your app only if you select that analyser:
npm install face-api.js # only for analyzerType: 'faceapi'
Without it the rest of the client installs and builds normally; starting the
faceapi analyser rejects with Failed to load face-api.js … npm install face-api.js. The human (@vladmandic/human) and mediapipe
(@mediapipe/tasks-vision) analysers are still regular dependencies.
| Event | Description |
|---|---|
CONNECTED |
WebRTC connection established |
MEDIA_TRACK_ADDED |
Remote media track available |
USER_JOINED_ROOM |
New participant joined |
USER_DISCONNECTED |
Participant left |
RECORDING_STARTED |
Recording in progress |
TRANSCRIPTION_RECEIVED |
Live transcription text |
FILE_OPS_AUTH_PAUSED |
File operations paused: the session token could not be re-minted (401/410). The user needs a new room token or a sign-in; the client retries on its own with a growing delay |
See the API Reference for all 40+ events.
Copyright 2023 by IWantToPractice, LLC. All rights reserved.
Use of this software is subject to license agreement. Unauthorized reproduction, distribution, or modification is expressly forbidden.