Media Server API
JavaScript APIs for Room creation, stream mixing, and RTMP streaming.
Create Room
Method: createRoom(options, callback, host)
| Name | Required | Type | Description |
|---|---|---|---|
| options | Yes | Object | Room options |
| callback | Yes | function | Callback |
| host | No | string | Media server address |
javascript
options = { name: 'test' }Returns { "id": "roomid" } — use id when joining the meeting.
Add Stream to Mix
Method: mixStream(room, streamid, callback, host)
| Name | Required | Type | Description |
|---|---|---|---|
| room | Yes | string | Room id |
| streamid | Yes | string | Stream id |
| callback | No | function | Callback |
| host | Yes | string | Media server address |
Remove Stream from Mix
Method: removeMixStream(room, streamid, callback, host)
Same parameters as add stream to mix.
Update Mix Resolution
Applied when the room has no participants. Method: updateRoomMixStream(room, options, callback, host)
javascript
options = {
views: [{
video: {
parameters: {
resolution: { width: 1280, height: 720 }
},
}
}]
}Start RTMP Streaming
Method: startStreamingOut(room, options, callback, host)
javascript
var options = {
protocol: 'rtmp',
url: 'rtmp://',
media: {
audio: { from: "streamid" },
video: { from: "streamid" }
}
};Returns { "id": "streamoutid" }.
Stop RTMP Streaming
Method: stopStreamingOut(room, streamOutId, callback, host)
| Name | Required | Type | Description |
|---|---|---|---|
| room | Yes | string | Room id |
| streamOutId | Yes | string | Stream out id from startStreamingOut |
| callback | Yes | function | Callback |
| host | No | string | Media server address |
