@telestack/rtc
v1.0.5
Published
Industrial-grade P2P RTC SDK with Edge Signaling
Maintainers
Readme
@telestack/rtc
Industrial-grade P2P WebRTC SDK for Building Real-Time Collaboration Engines.
@telestack/rtc is a high-performance, developer-first WebRTC SDK designed for production-scale video conferencing, file sharing, and real-time synchronization. It features a decentralized Mesh architecture with Edge-based signaling for ultra-low latency.
🚀 Key Features
- Mesh Networking: Peer-to-peer connections for small to medium groups (up to 5 peers) without expensive SFU costs.
- Adaptive Quality Engine: Automatic bitrate scaling (up to 2.5Mbps) based on real-time RTT and packet loss.
- E2E Encryption: Military-grade AES-GCM encryption for DataChannels.
- AI Virtual Background: Built-in support for background blur and images (via MediaPipe).
- Live Captions: Real-time audio transcription using the Web Speech API.
- Advanced DataChannels: Reliable message passing and high-speed binary file transfer with backpressure handling.
- Edge Signaling: Powered by Telestack Edge Workers for global, low-latency connection negotiation.
📦 Installation
npm install @telestack/rtc🛠️ Quick Start
1. Initialize the SDK
import { TelestackRTC } from '@telestack/rtc';
const rtc = TelestackRTC.init({
apiKey: 'your_telestack_api_key',
gatewayUrl: 'your_edge_gateway_url'
});2. Join a Room
// Join a room and start your camera/audio
const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true });
await rtc.joinMesh('room-123', stream);3. Handle Remote Streams
rtc.onTrack = (event, peerId) => {
const remoteVideo = document.getElementById(`video-${peerId}`);
remoteVideo.srcObject = event.streams[0];
};4. Real-time Messaging
// Send a message to everyone
rtc.broadcast({ type: 'chat', text: 'Hello World!' });
// Listen for incoming messages
rtc.onMessage = (data, peerId) => {
console.log(`Message from ${peerId}:`, data);
};🔐 Advanced Usage
E2E Encryption
// Enable encryption with a shared secret
rtc.enableE2E('your-secret-key');
// All DataChannel traffic (chat, files, sync) is now encrypted
rtc.broadcast({ type: 'secure-data', val: 42 });AI Virtual Background
const videoTrack = stream.getVideoTracks()[0];
// Apply blur background
const backgroundTrack = await rtc.startVirtualBackground('blur');
// Replace the original track in the local stream
stream.removeTrack(videoTrack);
stream.addTrack(backgroundTrack);File Transfer
const file = fileInput.files[0];
rtc.sendFile(file);
rtc.onFileProgress = (p) => {
console.log(`Transferring ${p.name}: ${p.percent}%`);
};
rtc.onFileReceived = (file, peerId) => {
console.log(`Received ${file.name} from ${peerId}`);
};📖 API Reference
For detailed documentation, event lists, and architecture diagrams, check out the Full API Reference.
📄 License
MIT © Telestack HQ
