onCuePoint Message Insertion
When re-streaming (Push Publishing) a live stream to another system using the RTMP protocol, you can insert AMF0 messages. Utilizing this feature, you can deliver messages such as subtitle insertions and advertisement markers to another system. The method for inserting messages is as follows:
- If the Media Source received through the RTMP Provider includes a message, it will be automatically inserted.
- You can insert messages dynamically through the OvenMediaEngine's Send Event API.
Inserting onCuePoint message
The onCuePoint message is used for the purpose of automatic ad cue point insertions to YouTube live broadcasts.
API Interface
Request
POST /v1/vhosts{vhost}/apps/{app}/streams/{stream}:sendEvent
Header
Authorization: Basic {credentials}
# Authorization
Credentials for HTTP Basic Authentication created with <AccessToken>
Body
{
"eventFormat": "amf",
"events":[
{
"amfType": "onCuePoint.YouTube",
"version": "0.1",
"preRollTimeSec": 2.56,
"cuePointStart": true,
"breakDurationSec": 30,
"spliceEventId": 0
}
]
}
POST /v1/vhosts{vhost}/apps/{app}/streams/{stream}:sendEvents
Header
Authorization: Basic {credentials}
# Authorization
Credentials for HTTP Basic Authentication created with <AccessToken>
Body
[
{
"eventFormat": "id3v2",
"eventType": "video", // "eventTarget": "video" is same
"events":[
{
"frameType": "TXXX",
"info": "AirenSoft",
"data": "OvenMediaEngine"
},
{
"frameType": "TIT2",
"data": "OvenMediaEngine 123"
}
]
},
{
"eventFormat": "amf",
"events":[
{
"amfType": "onCuePoint.YouTube",
"version": "0.1",
"preRollTimeSec": 2.56,
"cuePointStart": true,
"breakDurationSec": 30,
"spliceEventId": 0
}
]
}
]
Responses
200 Ok
The request has succeeded
Header
Content-Type: application/json
Body
{
"message": "OK",
"statusCode": 200
}
400 Bad Request
Invalid request. Body is not a Json Object or does not have a required value
401 Unauthorized
Authentication required
Header
WWW-Authenticate: Basic realm=”OvenMediaEngine”
Body
{
"message": "[HTTP] Authorization header is required to call API (401)",
"statusCode": 401
}
404 Not Found
The given vhost name or application name could not be found.
Body
{
"message": "[HTTP] Could not find the application: [default/app2] (404)",
"statusCode": 404
}
Payload Example
Here’s an example of a payload encoded in AMF0 format for an onCuePoint message:
string-marker “onCuePoint”
object-marker
“type” string-marker “com.youtube.cuepoint”
“version” string-marker “0.1”
“pre_roll_time_sec” number-marker 2.56
“cue_point_start” boolean-marker 1
“break_duration_sec” number-marker 30
“splice_event_id” number-marker 0
UTF-8-empty object-end-marker