This simple app demonstrates integration with the Zoom Realtime Media Streams SDK for Python.
Copy the example environment file and fill in your credentials:
cp .env.example .envSet your Zoom OAuth credentials:
ZM_RTMS_CLIENT=your_client_id
ZM_RTMS_SECRET=your_client_secretUsing uv (recommended):
uv run main.pyOr manually with pip:
python3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install .
python main.pyFor webhook testing with ngrok:
ngrok http 8080Use the generated ngrok URL as your Zoom webhook endpoint. Then, start a meeting to see your data!
Here's how you can implement the SDK yourself.
import rtmsCreate a client for each meeting to handle multiple concurrent meetings:
import rtms
clients = {}
@rtms.onWebhookEvent
def handle_webhook(webhook):
event, payload = webhook.get('event'), webhook.get('payload', {})
if event == 'meeting.rtms_started':
client = rtms.Client()
clients[payload.get('rtms_stream_id')] = client
@client.onTranscriptData
def on_transcript(buffer, size, timestamp, metadata):
print(f"💬 {metadata.userName}: {buffer.decode('utf-8')}")
client.join(
meeting_uuid=payload.get('meeting_uuid'),
rtms_stream_id=payload.get('rtms_stream_id'),
server_urls=payload.get('server_urls'),
signature=payload.get('signature')
)
if __name__ == '__main__':
import time
while True:
for client in clients.values():
client._poll_if_needed()
time.sleep(0.01)Configure audio, video, and deskshare processing parameters before joining:
params = rtms.AudioParams(
content_type=rtms.AudioContentType['RAW_AUDIO'],
codec=rtms.AudioCodec['OPUS'],
sample_rate=rtms.AudioSampleRate['SR_16K'],
channel=rtms.AudioChannel['STEREO'],
data_opt=rtms.AudioDataOption['AUDIO_MIXED_STREAM'],
duration=20, # 20ms frames
frame_size=640 # 16kHz * 2 channels * 20ms
)
client.setAudioParams(params)params = rtms.VideoParams(
content_type=rtms.VideoContentType['RAW_VIDEO'],
codec=rtms.VideoCodec['H264'],
resolution=rtms.VideoResolution['HD'],
data_opt=rtms.VideoDataOption['VIDEO_SINGLE_ACTIVE_STREAM'],
fps=30
)
client.setVideoParams(params)params = rtms.DeskshareParams(
content_type=rtms.VideoContentType['RAW_VIDEO'],
codec=rtms.VideoCodec['H264'],
resolution=rtms.VideoResolution['FHD'],
fps=15
)
client.setDeskshareParams(params)@client.onJoinConfirm- ✅ Join confirmation@client.onSessionUpdate- 🔄 Session state changes@client.onUserUpdate- 👥 Participant join/leave@client.onParticipantEvent- 👥 Participant join/leave (typed)@client.onActiveSpeakerEvent- 🎤 Active speaker changes@client.onSharingEvent- 🖥️ Screen sharing start/stop@client.onAudioData- 🎵 Audio data@client.onVideoData- 📹 Video data@client.onTranscriptData- 💬 Live transcription@client.onLeave- 👋 Meeting ended
For complete parameter options and detailed documentation:
- 🎵 Audio Parameters - Complete audio configuration options
- 📹 Video Parameters - Complete video configuration options
- 🖥️ Deskshare Parameters - Complete deskshare configuration options
- 📖 Full API Documentation - Complete SDK reference