Skip to main content

Start Cloud Playback

When inputting an online media stream to a specified RTC room, you need to configure virtual user information, including the media stream URL, resource type, and room ID. Upon successful invocation, other participants in the room can subscribe to this media stream using the same method as subscribing to resources published by other users.

Enable the Service

Before using the Cloud Playback API, ensure that the Cloud Playback service is enabled. Go to the Cloud Playback page in the Console to enable the service.

Request Method

POST: https://Data Center Domain/v2/rtc/cloudplayer/start

Signature Rule: All requests to RC's server APIs require signature validation. For details, refer to API Request Signature.

Request Body Parameters

The HTTP request body contains a JSON object with the following structure:

ParameterDescriptionNotes
user_idStringUser ID. If the user is currently streaming in the room, this will replace their existing stream.
user_nameStringUsername.
media_typeNumberMedia type. 0 for audio and video, 1 for audio-only, 2 for video-only.
room_typeNumberRoom type. 0 for standard RTC rooms, 2 for live streaming rooms.
rtmp_urlStringPublic URL of the media stream.
callback_urlStringCallback URL for status updates. RTMP status callbacks will be sent to this address.
rtsp_transportStringTransport protocol for RTSP streams. Options: tcp or udp. For public RTSP URLs, tcp is typically used. Defaults to tcp if not specified.

Request Example

POST http://api.rong-api.com/v2/rtc/cloudplayer/start HTTP/1.1
Host: api.rong-api.com
App-Key: XXX
RC-Nonce: 1027489915
RC-Timestamp: 1609754958
RC-Signature: 357cef9b529edd1ed4f34bd8df52de00a909914b
Room-Id: 123
Content-Type: application/json

{
"user_id": "xxx",
"user_name": "xxx",
"rtmp_url": "rtmp://xxx",
"media_type":0,
"room_type":2,
"callback_url":"http://xxx"
}

Response

The HTTP response body contains a JSON object with the following structure:

  • code: Business status code in the HTTP response body. 10000 indicates success.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
"code":10000
}