Skip to main content

Media Push events

Agora message notification service can notify your server of events that occur when pushing media streams to the CDN through HTTP or HTTPS requests.

HTTP protocols only support version 1.1 or higher. HTTPS TLS protocols only support version 1.2 or higher.

1585759402952

Enable the service

Contact Agora Technical Support to configure and enable the message notification service. Refer to Message Notification Service for details of Data Format for Message Notification Callback.

Events for the Media Push

The message notification server can notify your server of four types of events that occur when pushing media streams to the CDN:

Converter created

The message notification server notifies your server of this event when you create a Converter by calling the Create method.

The eventType is1 (Converter Created). The following is an example the payload:


_70
{
_70
"converter": {
_70
"id": "4c014467d647bb87b60b719f6fa57686",
_70
"name": "show68_vertical",
_70
"transcodeOptions": {
_70
"rtcChannel": "show68",
_70
"audioOptions": {
_70
"codecProfile": "HE-AAC",
_70
"sampleRate": 48000,
_70
"bitrate": 128,
_70
"audioChannels": 1,
_70
"rtcStreamUids": [
_70
201,
_70
202
_70
]
_70
},
_70
"videoOptions": {
_70
"canvas": {
_70
"width": 360,
_70
"height": 640,
_70
"color": 0
_70
},
_70
"layout": [
_70
{
_70
"rtcStreamUid": 201,
_70
"region": {
_70
"xPos": 0,
_70
"yPos": 0,
_70
"zIndex": 1,
_70
"width": 360,
_70
"height": 320
_70
},
_70
"placeholderImageUrl": "http://example.agora.io/host_placeholder.jpg"
_70
},
_70
{
_70
"rtcStreamUid": 202,
_70
"region": {
_70
"xPos": 0,
_70
"yPos": 320,
_70
"zIndex": 1,
_70
"width": 360,
_70
"height": 320
_70
}
_70
},
_70
{
_70
"imageUrl": "http://example.agora.io/watchmark.jpg",
_70
"region": {
_70
"xPos": 0,
_70
"yPos": 0,
_70
"zIndex": 2,
_70
"width": 36,
_70
"height": 64
_70
}
_70
}
_70
],
_70
"codecProfile": "High",
_70
"frameRate": 15,
_70
"bitrate": 400,
_70
"seiOptions": ""
_70
}
_70
},
_70
"rtmpUrl": "rtmp://example.agora.io/live/show68",
_70
"idleTimeout": 300,
_70
"createTs": 1591786766,
_70
"updateTs": 1591786835,
_70
"state": "connecting"
_70
},
_70
"lts": 1603456600,
_70
"xRequestId": "7bbcc8a4acce48c78b53c5a261a8a564"
_70
}

  • The Converter contains the following fields:
    • id: String type field. The ID of the Converter. This is a UUID (Universal Unique Identifier) generated by the Agora server to identify a created Converter.
    • name: String type field. The name of the Converter.
    • transcodeOptions: JSON Object type field. The Converter's transcoding configuration.
      • rtcChannel: String type field. The Agora channel name.
      • audioOptions: JSON Object type field. The audio transcoding configuration of the Converter.
        • codecProfile: String type field. The audio codec output by the Converter.
        • sampleRate: Number type field. The audio encoding sampling rate (Hz) output by the Converter.
        • bitrate: Number type field. The audio encoding rate (Kbps) output by the Converter.
        • audioChannels: Number type field. The number of audio channels output by the Converter.
        • rtcStreamUids: JSON Array type field. The user ID or Account of the user participating in the mixing.
      • videoOptions: JSON Object type field. The video transcoding configuration of the Converter.
        • canvas: JSON Object type field. The video canvas.
          • width: Number type field. The width of the canvas (px).
          • height: Number type field. The height of the canvas (px).
          • color: Number type field. The background color of the canvas. This is an RGB color value, expressed as a decimal number. For example, 255 represents blue.
        • layout: JSON Array type field. The content description of the video screen on the canvas. Two elements are supported:
          • RtcStreamView element. The video screen of each user on the canvas. It contains the following fields:
            • rtcStreamUid: Number type field. The user ID of the user to which the video stream belongs.
            • region: JSON Object type field. The display area of the user's video screen on the canvas.
              • xPos: Number type field. The x coordinate (px) of the screen on the canvas. This is the lateral displacement relative to the origin, taking the upper left corner of the canvas as the origin and the x coordinate as the upper left corner of the screen.
              • yPos: Number type field. The y coordinate (px) of the screen on the canvas. This is the longitudinal displacement relative to the origin, taking the upper left corner of the canvas as the origin and the y coordinate as the upper left corner of the screen.
              • zIndex: Number type field. The layer number of the screen. The value range is [0,100]. 0 represents the lowest layer. 100 represents the top layer.
              • width: Number type field. The width of the screen (px).
              • height: Number type field. The height of the screen (px).
            • placeholderImageUrl: String type field. The HTTP(S) URL of the substitute image.
          • ImageView element. The video picture on the canvas, which can be used as a watermark. It contains the following fields:
            • imageUrl: String type field. The HTTP(S) URL of the image.
            • region: JSON Object type field. The display area of the picture on the canvas.
              • xPos: Number type field. The x coordinate (px) of the image on the canvas. This is the lateral displacement relative to the origin, taking the upper left corner of the canvas as the origin and the x coordinate as the upper left corner of the screen.
              • yPos: Number type field. The y coordinate (px) of the picture on the canvas. This is the longitudinal displacement relative to the origin, taking the upper left corner of the canvas as the origin, and the y coordinate as the upper left corner of the screen.
              • zIndex: Number type field. The layer number of the image. The value range is [0,100]. 0 represents the lowest layer. 100 represents the top layer.
              • width: Number type field. The width of the image (px).
              • height: Number type field. The height of the image (px).
        • codecProfile: String type field. The encoding specification of the video.
        • frameRate: Number type field. The encoding frame rate (fps) of the video.
        • bitrate: Number type field. The audio encoding rate (Kbps) output by the Converter.
        • seiExtraInfo: String type field. The user SEI information in the video. This is used to send user-defined SEI information to the CDN.
      • rtmpUrl: (Required) String type field. The CDN streaming address.
      • idleTimeOut: Number type field. The maximum time (s) that the Converter is idle. Idle means that all users of the corresponding media streams processed by the Converter have left the channel. After the idle state exceeds the set idleTimeOut, the Converter is destroyed automatically.
      • createTs: Number type field. The Unix timestamp (s) when the Converter was created.
      • updateTs: Number type field. The Unix timestamp (s) when the Converter configurationwas last updated.
      • state: String type field. The status of the Converter. If if the state is reported "connecting", the Converter is connecting to the Agora server.
  • lts: Number type field. The Unix timestamp (ms) when the event occurred on the Agora server.
  • xRequestId: String type field, which identifies the UUID (Universal Unique Identifier) of this request. This is the same as the X-Request-ID field in the request header.

Converter's configuration changed

The message notification server notifies your server of this event when you update the configurations of a Converter by calling the Update method.

The eventType is 2 (ConverterUpdatedEvent).

  • Update the converter.transcodeOptions.videoOptions.layout configuration. tThe following is an example payload:

_53
{
_53
"converter": {
_53
"id": "4c014467d647bb87b60b719f6fa57686",
_53
"createTs": 1591786766,
_53
"updateTs": 1591786835,
_53
"state": "running",
_53
"transcodeOptions": {
_53
"rtcChannel": "show68",
_53
"videoOptions": {
_53
"layout": [
_53
{
_53
"rtcStreamUid": 201,
_53
"region": {
_53
"xPos": 0,
_53
"yPos": 0,
_53
"zIndex": 1,
_53
"width": 360,
_53
"height": 320
_53
},
_53
"placeholderImageUrl": "http://example.agora.io/host_placeholder.jpg"
_53
},
_53
{
_53
"rtcStreamUid": 202,
_53
"region": {
_53
"xPos": 0,
_53
"yPos": 320,
_53
"zIndex": 1,
_53
"width": 360,
_53
"height": 320
_53
}
_53
},
_53
{
_53
"imageUrl": "http://example.agora.io/watchmark.jpg",
_53
"region": {
_53
"xPos": 0,
_53
"yPos": 0,
_53
"zIndex": 2,
_53
"width": 36,
_53
"height": 64
_53
}
_53
}
_53
],
_53
"codecProfile": "High",
_53
"frameRate": 15,
_53
"bitrate": 400,
_53
"seiOptions": ""
_53
}
_53
}
_53
},
_53
"lts": 1603456600,
_53
"xRequestId": "7bbcc8a4acce48c78b53c5a261a8a564",
_53
"fields": "id,createTs,updateTs,state,transcodeOptions.videoOptions.layout"
_53
}

  • The Converter contains the following fields:

    • id: String type field. The ID of the Converter. This is a UUID (Universal Unique Identifier) generated by the Agora server to identify a created Converter.
    • createTs: Number type field. The Unix timestamp (s) when the Converter was created.
    • updateTs: Number type field. The Unix timestamp (s) when the Converter configurationwas last updated.
    • state: String type field. The running status of the Converter. If the state is "running", the Converter is running properly, and streams are being pushed to the CDN.
    • transcodeOptions: JSON Object type field. The Converter's transcoding configuration.
      • rtcChannel: String type field. The Agora channel name.
      • videoOptions: (Optional) JSON Object type field. The video transcoding configuration of the Converter.
        • layout: JSON Array type field. The content description of the video screen on the canvas. Two elements are supported:
          • RtcStreamView element. The video screen of each user on the canvas. It contains the following fields:
            • rtcStreamUid: Number type field. The user ID of the user to which the video stream belongs.
            • region: JSON Object type field. The display area of the user's video screen on the canvas.
              • xPos: Number type field. The x coordinate (px) of the screen on the canvas. This is the lateral displacement relative to the origin, taking the upper left corner of the canvas as the origin and the x coordinate as the upper left corner of the screen.
              • yPos: Number type field. The y coordinate (px) of the screen on the canvas. This is the longitudinal displacement relative to the origin, taking the upper left corner of the canvas as the origin and the y coordinate as the upper left corner of the screen.
              • zIndex: Number type field. The layer number of the screen. The value range is [0,100]. 0 represents the lowest layer. 100 represents the top layer.
              • width: Number type field. The width of the screen (px).
              • height: Number type field. The height of the screen (px).
            • placeholderImageUrl: String type field. The HTTP(S) URL of the substitute image.
          • ImageView element. The video picture on the canvas, which can be used as a watermark. It contains the following fields:
            • imageUrl: String type field. The HTTP(S) URL of the image.
            • region: JSON Object type field. The display area of the picture on the canvas.
              • xPos: Number type field. The x coordinate (px) of the image on the canvas. This is the lateral displacement relative to the origin, taking the upper left corner of the canvas as the origin and the x coordinate as the upper left corner of the screen.
              • yPos: Number type field. The y coordinate (px) of the picture on the canvas. This is the longitudinal displacement relative to the origin, taking the upper left corner of the canvas as the origin, and the y coordinate as the upper left corner of the screen.
              • zIndex: Number type field. The layer number of the image. The value range is [0,100]. 0 represents the lowest layer. 100 represents the top layer.
              • width: Number type field. The width of the image (px).
              • height: Number type field. The height of the image (px).
      • codecProfile: String type field. The encoding specification of the video.
      • frameRate: Number type field. The encoding frame rate (fps) of the video.
      • bitrate: Number type field. The encoding bitrate (Kbps) of the video.
      • seiExtraInfo: String type field. The user SEI information in the video. This is used to send user-defined SEI information to the CDN.
  • lts: Number type field. The Unix timestamp (ms) when the event occurred on the Agora server.

  • xRequestId: String type field, which identifies the UUID (Universal Unique Identifier) of this request. This is the same as the X-Request-ID field in the request header.

  • fields: String type field. For the field mask of JSON encoding, please refer to the Google protobuf FieldMask document for details. This is used to specify a subset of theconverter field to be returned. In this example, fields specifies a subset of the id, createTs, updateTs, and state fields in the converter field returned by the Agora server.

  • Update the configuration of the list of user IDs or Accounts participating in the mixing in the converter.transcodeOptions.audioOptions. The following is an example payload:


_20
{
_20
"converter": {
_20
"id": "4c014467d647bb87b60b719f6fa57686",
_20
"createTs": 1591786766,
_20
"updateTs": 1591786835,
_20
"state": "running",
_20
"transcodeOptions": {
_20
"rtcChannel": "show68",
_20
"audioOptions": {
_20
"rtcStreamUids": [
_20
201,
_20
202
_20
]
_20
}
_20
}
_20
},
_20
"lts": 1603456600,
_20
"xRequestId": "7bbcc8a4acce48c78b53c5a261a8a564",
_20
"fields": "id,createTs,updateTs,state,transcodeOptions.audioOptions.rtcStreamUids"
_20
}

  • The Converter contains the following fields:

    • id: String type field. The ID of the Converter. This is a UUID (Universal Unique Identifier) generated by the Agora server to identify a created Converter.
    • createTs: Number type field. The Unix timestamp (s) when the Converter was created.
    • updateTs: Number type field. The Unix timestamp (s) when the Converter configurationwas last updated.
    • state: String type field. The running status of the Converter. If the state is "running", the Converter is running properly, and streams are being pushed to the CDN.
    • transcodeOptions: JSON Object type field. The Converter's transcoding configuration.
      • rtcChannel: String type field. The Agora channel name.
      • audioOptions: JSON Object type field. The audio transcoding configuration of the Converter.
        • rtcStreamUids: JSON Array type field. The user ID or Account of the user participating in the mixing.
  • lts: Number type field. The Unix timestamp (ms) when the event occurred on the Agora server.

  • xRequestId: String type field, which identifies the UUID (Universal Unique Identifier) of this request. This is the same as the X-Request-ID field in the request header.

  • fields: String type field. For the field mask of JSON encoding, please refer to the Google protobuf FieldMask document for details. This is used to specify a subset of theconverter field to be returned. In this example, fields specifies a subset of the id, createTs, updateTs, and statefields in the converter field returned by the Agora server.

  • Update other configurations of the converter, such as converter.rtmpUrl:


_12
{
_12
"converter": {
_12
"id": "4c014467d647bb87b60b719f6fa57686",
_12
"createTs": 1591786766,
_12
"updateTs": 1591786835,
_12
"state": "running",
_12
"rtmpUrl": "rtmp://example.agora.io/live/show68"
_12
},
_12
"lts": 1603456600,
_12
"xRequestId": "7bbcc8a4acce48c78b53c5a261a8a564",
_12
"fields": "id,createTs,updateTs,state,rtmpUrl"
_12
}

  • The Converter contains the following fields:
    • id: String type field. The ID of the Converter. This is a UUID (Universal Unique Identifier) generated by the Agora server to identify a created Converter.
    • createTs: Number type field. The Unix timestamp (s) when the Converter was created.
    • updateTs: Number type field. The Unix timestamp (s) when the Converter configurationwas last updated.
    • state: String type field. The running status of the Converter. If the state is "running", the Converter is running properly, and streams are being pushed to the CDN.
    • rtmpUrl: (Required) String type field. The CDN streaming address.
  • lts: Number type field. The Unix timestamp (ms) when the event occurred on the Agora server.
  • xRequestId: String type field, which identifies the UUID (Universal Unique Identifier) of this request. This is the same as the X-Request-ID field in the request header.
  • fields: String type field. For the field mask of JSON encoding, please refer to the Google protobuf FieldMask document for details. This is used to specify a subset of theconverter field to be returned. In this example, fields specifies a subset of the id, createTs, updateTs, and state fields in the converter field returned by the Agora server.

Converter's status changed

The message notification server notifies your server of this event when you have created a Converter and the running state of the Converter changes.

The eventType is 3(ConverterStateChangedEvent). The following is an example payload:


_10
{
_10
"converter": {
_10
"id": "4c014467d647bb87b60b719f6fa57686",
_10
"createTs": 1603456600,
_10
"updateTs": 1603456600,
_10
"state": "running"
_10
},
_10
"lts": 1603456600,
_10
"fields": "id,createTs,updateTs,state"
_10
}

  • The Converter contains the following fields:
    • id: String type field. The ID of the Converter. This is a UUID (Universal Unique Identifier) generated by the Agora server to identify a created Converter.
    • createTs: Number type field. The Unix timestamp (s) when the Converter was created.
    • updateTs: Number type field. The Unix timestamp (s) when the Converter configurationwas last updated.
    • state: String type field. The running status of the Converter.
      • connecting: The Converter is connecting to the Agora server.
      • running: The Converter is running properly, and streams are being pushed to the CDN.
      • failed: There is a failure in pushing streams to the CDN.
  • lts: Number type field. The Unix timestamp (ms) when the event occurred on the Agora server.
  • fields: String type field. For the field mask of JSON encoding, please refer to the Google protobuf FieldMask document for details. This is used to specify a subset of theconverter field to be returned. In this example, fields specifies a subset of the id, createTs, updateTs, and state fields in the converter field returned by the Agora server.

Converter destroyed

The message notification server will notify your server of this event when a Converter is destroyed, and the streams are stopped being pushed to the CDN.

For the destruction reason, see the destroyReason field.

The eventType is 4(ConverterDestroyedEvent). The following is an example payload:


_11
{
_11
"converter": {
_11
"id": "4c014467d647bb87b60b719f6fa57686",
_11
"name": "show68_vertical",
_11
"createTs": 1603456600,
_11
"updateTs": 1603456600
_11
},
_11
"lts": 1603456600,
_11
"destroyReason": "Delete Request",
_11
"fields": "id,name,createTs,updateTs"
_11
}

  • The Converter contains the following fields:
    • id: String type field. The ID of the Converter. This is a UUID (Universal Unique Identifier) generated by the Agora server to identify a created Converter.
    • name: String type field. The name of the Converter.
    • createTs: Number type field. The Unix timestamp (s) when the Converter was created.
    • updateTs: Number type field. The Unix timestamp (s) when the Converter configurationwas last updated.
  • lts: Number type field. The Unix timestamp (ms) when the event occurred on the Agora server.
  • destroyReason: String type field, which shows the reason for the destruction of the Converter.
    • Delete Request: The Agora server receives your Delete request.
    • Idle Timeout: After the idle state exceeds the set idleTimeOut, all users of the corresponding media streams processed by the Converter leave the channel.
    • Internal Error: Errors related to the Agora server. For example, hardware failure.
  • fields: String type field. For the field mask of JSON encoding, please refer to the Google protobuf FieldMask document for details. This is used to specify a subset of theconverter field to be returned. In this example, fields specifies a subset of the id, createTs, updateTs, and state fields in the converter field returned by the Agora server.