https://github.com/red5pro/red5pro-conference-sdk
https://github.com/red5pro/red5pro-conference-sdk
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/red5pro/red5pro-conference-sdk
- Owner: red5pro
- Created: 2026-02-02T19:24:11.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2026-02-05T20:43:26.000Z (6 months ago)
- Last Synced: 2026-02-09T06:37:17.545Z (6 months ago)
- Language: JavaScript
- Size: 45.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Red5 Pro Conference SDK
The Red5 Pro Conference SDK is a powerful, professional-grade toolkit for building multi-party video conferencing applications on the Red5 Pro platform. It handles room management, media streaming (WHIP/WHEP), WebRTC statistics, and advanced features like virtual backgrounds and local recording.
## Table of Contents
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Configuration](#configuration)
- [Core API](#core-api)
- [Events](#events)
- [Advanced Features](#advanced-features)
- [Development](#development)
## Installation
Install the SDK via npm:
```bash
npm install red5pro-conference-sdk
```
## Quick Start
```javascript
import { ConferenceClient, ConferenceEvents } from 'red5pro-conference-sdk';
// 1. Configure the client
const config = {
host: 'your-red5-pro-host',
nodeGroup: 'your-node-group',
iceServers: [{ urls: 'stun:stun.l.google.com:19302' }],
pubnubPublishKey: 'your-pubnub-publish-key',
pubnubSubscribeKey: 'your-pubnub-subscribe-key'
};
const client = new ConferenceClient(config);
// 2. Listen for events
client.on(ConferenceEvents.USER_PUBLISHED, (event) => {
console.log('Successfully published to room:', event.streamName);
});
client.on(ConferenceEvents.NEW_PARTICIPANT, (participant) => {
console.log('New participant joined:', participant.userId);
// Auto-subscribe to the new participant
client.subscribe(participant);
});
// 3. Join a room
const joinParams = {
roomId: 'my-awesome-room',
userId: 'user-' + Math.floor(Math.random() * 1000),
token: 'your-auth-token',
role: 'publisher',
mediaStream: await navigator.mediaDevices.getUserMedia({ video: true, audio: true }),
videoEnabled: true,
audioEnabled: true
};
await client.join(
joinParams.roomId,
joinParams.userId,
joinParams.token,
joinParams.role,
joinParams.mediaStream,
joinParams.videoEnabled,
joinParams.audioEnabled
);
```
## Configuration
The `ConferenceConfig` object supports the following parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| `host` | `string` | Red5 Pro Server host address. |
| `nodeGroup` | `string` | Optional node group for autoscaling. |
| `iceServers` | `RTCIceServer[]` | Array of ICE servers for WebRTC. |
| `reconnectionEnabled` | `boolean` | Enable automatic reconnection. Default: `true`. |
| `maxVideoBitrateKbps` | `number` | Maximum video bitrate for publishing. |
| `pubnubPublishKey` | `string` | PubNub Publish Key for chat/signaling. |
| `pubnubSubscribeKey` | `string` | PubNub Subscribe Key for chat/signaling. |
## Core API
### Room Management
- `join(roomId, userId, token, role, mediaStream, ...)`: Join a conference room.
- `leave()`: Disconnect and leave the room.
### Media Controls
- `muteVideo()` / `unmuteVideo()`: Control local camera.
- `muteAudio()` / `unmuteAudio()`: Control local microphone.
- `switchVideoDeviceWithTrackReplacement(deviceId)`: Seamlessly switch cameras.
### Publishing & Subscribing
- `subscribe(user)`: Start viewing a participant's stream.
- `unsubscribe(userId)`: Stop viewing a participant's stream.
## Events
The SDK uses `ConferenceEvents` for all notifications.
```javascript
import { ConferenceEvents } from 'red5pro-conference-sdk';
client.on(ConferenceEvents.ROOM_STATE_UPDATE, (state) => {
console.log('Room users updated:', state.users);
});
client.on(ConferenceEvents.CHAT_MESSAGE, (message) => {
console.log('New message:', message.text);
});
client.on(ConferenceEvents.ISSUES_DETECTED, (issues) => {
console.warn('Network or WebRTC issues:', issues);
});
```
## Advanced Features
### Virtual Backgrounds
Requires `@mediapipe/selfie_segmentation`.
```javascript
await client.initializeVirtualBackground();
await client.enableVirtualBackground('blur', { blurAmount: 10 });
// Types: 'none', 'blur', 'slight-blur', 'image', 'color'
```
### Screen Sharing
```javascript
await client.startScreenShare({
includeAudio: true,
metaData: { type: 'presentation' }
});
await client.stopScreenShare();
```
### Local Recording
Records participant streams directly in the browser and creates a ZIP file.
```javascript
// Enable local recording
const zip = await client.generateLocalRecordingZip();
// Download the recording
await client.downloadLocalRecording('my-conference-record');
```