Skip to content

zoom/rtms-quickstart-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 RTMS Quickstart

This simple app demonstrates integration with the Zoom Realtime Media Streams SDK for Node.js.

npm docs

📋 Setup

The SDK is already included in package dependencies. Install other dependencies:

npm install

⚙️ Configuration

Copy the example environment file and fill in your credentials:

cp .env.example .env

Set your Zoom OAuth credentials:

ZM_RTMS_CLIENT=your_client_id
ZM_RTMS_SECRET=your_client_secret

🏃‍♂️ Running the App

Start the application:

npm start

For webhook testing with ngrok:

ngrok http 8080

Use the generated ngrok URL as your Zoom webhook endpoint. Then, start a meeting to see your data!

🎯 Basic Usage

Here's how you can implement the SDK yourself.

Import the SDK

ES Modules:

import rtms from "@zoom/rtms";

CommonJS:

const rtms = require('@zoom/rtms').default;

🏢 Client-Based Approach

Create a client for each meeting to handle multiple concurrent meetings:

// Listen for Zoom webhook events
rtms.onWebhookEvent(({ event, payload }) => {
  if (event === "meeting.rtms_started") {
    const client = new rtms.Client();
    
    // Configure callbacks
    client.onAudioData((buffer, size, timestamp, metadata) => {
      // Process audio data
    });
    
    // Join using webhook payload
    client.join(payload);
  }
});

📊 Media Parameter Configuration

Configure audio, video, and deskshare processing parameters before joining:

🎵 Audio Parameters

client.setAudioParams({
  contentType: rtms.AudioContentType.RAW_AUDIO,
  codec: rtms.AudioCodec.OPUS,
  sampleRate: rtms.AudioSampleRate.SR_16K,
  channel: rtms.AudioChannel.STEREO,
  dataOpt: rtms.AudioDataOption.AUDIO_MIXED_STREAM,
  duration: 20,     // 20ms frames
  frameSize: 640    // 16kHz * 2 channels * 20ms
});

📹 Video Parameters

client.setVideoParams({
  contentType: rtms.VideoContentType.RAW_VIDEO,
  codec: rtms.VideoCodec.H264,
  resolution: rtms.VideoResolution.HD,
  dataOpt: rtms.VideoDataOption.VIDEO_SINGLE_ACTIVE_STREAM,
  fps: 30
});

🖥️ Deskshare Parameters

client.setDeskshareParams({
  contentType: rtms.VideoContentType.RAW_VIDEO,
  codec: rtms.VideoCodec.H264,
  resolution: rtms.VideoResolution.FHD,
  dataOpt: rtms.VideoDataOption.VIDEO_SINGLE_ACTIVE_STREAM,
  fps: 15
});

📞 Available Callbacks

  • onJoinConfirm(reason) - ✅ Join confirmation
  • onSessionUpdate(op, sessionInfo) - 🔄 Session state changes
  • onUserUpdate(op, participantInfo) - 👥 Participant join/leave
  • onAudioData(buffer, size, timestamp, metadata) - 🎵 Audio data
  • onVideoData(buffer, size, timestamp, metadata) - 📹 Video data
  • onTranscriptData(buffer, size, timestamp, metadata) - 💬 Live transcription
  • onLeave(reason) - 👋 Meeting ended

📚 API Reference

For complete parameter options and detailed documentation:

About

A quickstart for the RTMS Node.JS SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published