Skip to content

Commit 4446a51

Browse files
authored
[Realtime] Introduce Media Transport Adapters (#24814)
1 parent a2bb9af commit 4446a51

File tree

3 files changed

+444
-0
lines changed

3 files changed

+444
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
pcx_content_type: navigation
3+
title: Media Transport Adapters
4+
sidebar:
5+
order: 6
6+
group:
7+
label: Adapters
8+
---
9+
10+
import { Render } from "~/components";
11+
12+
Media Transport Adapters bridge WebRTC and other transport protocols. Adapters handle protocol conversion, codec transcoding, and bidirectional media flow between WebRTC sessions and external endpoints.
13+
14+
## What adapters do
15+
16+
Adapters extend Realtime beyond WebRTC-to-WebRTC communication:
17+
18+
- Ingest audio/video from external sources into WebRTC sessions
19+
- Stream WebRTC media to external systems for processing or storage
20+
- Integrate with AI services for transcription, translation, or generation
21+
- Bridge WebRTC applications with legacy communication systems
22+
23+
## Available adapters
24+
25+
### WebSocket adapter (beta)
26+
27+
Stream audio between WebRTC tracks and WebSocket endpoints. Currently in beta; the API may change.
28+
29+
[Learn more](/realtime/sfu/media-transport-adapters/websocket-adapter/)
30+
31+
## Architecture
32+
33+
Media Transport Adapters operate as intermediaries between Cloudflare Realtime SFU sessions and external endpoints:
34+
35+
```mermaid
36+
graph LR
37+
A[WebRTC Client] <--> B[Realtime SFU Session]
38+
B <--> C[Media Transport Adapter]
39+
C <--> D[External Endpoint]
40+
```
41+
42+
### Key concepts
43+
44+
**Adapter instance**: Each connection creates a unique instance with an `adapterId` to manage its lifecycle.
45+
46+
**Location types**:
47+
- `local` (Ingest): Receives media from external endpoints to create new WebRTC tracks
48+
- `remote` (Stream): Sends media from existing WebRTC tracks to external endpoints
49+
50+
**Codec support**: Adapters convert between WebRTC and external system formats.
51+
52+
## Common use cases
53+
54+
### AI processing
55+
56+
- Speech-to-text transcription
57+
- Text-to-speech generation
58+
- Real-time translation
59+
- Audio enhancement
60+
61+
### Media recording
62+
63+
- Cloud recording
64+
- Content delivery networks
65+
- Media processing pipelines
66+
67+
### Legacy integration
68+
69+
- Traditional telephony
70+
- Broadcasting infrastructure
71+
- Custom media servers
72+
73+
## API overview
74+
75+
Media Transport Adapters are managed through the Realtime SFU API:
76+
77+
```
78+
POST /v1/apps/{appId}/adapters/{adapterType}/new
79+
POST /v1/apps/{appId}/adapters/{adapterType}/close
80+
```
81+
82+
Each adapter type has specific configuration requirements and capabilities. Refer to individual adapter documentation for detailed API specifications.
83+
84+
## Best practices
85+
86+
- Close adapter instances when no longer needed
87+
- Implement reconnection logic for network failures
88+
- Choose codecs based on bandwidth and quality requirements
89+
- Secure endpoints with authentication for sensitive media
90+
91+
## Limitations
92+
93+
- Each adapter type has specific codec and format support
94+
- Network latency between Cloudflare edge and external endpoints affects real-time performance
95+
- Maximum message size and streaming modes vary by adapter type
96+
97+
## Get started
98+
99+
[WebSocket adapter (beta)](/realtime/sfu/media-transport-adapters/websocket-adapter/) - Stream audio between WebRTC and WebSocket endpoints

0 commit comments

Comments
 (0)