Inserting Ad Markers (EXT-X-CUE-OUT/EXT-X-CUE-IN) | v0.17.3.0+
You can dynamically insert Ad Markers into LL-HLS and HLS playlists using the REST API.
When requesting the CUE-OUT event, the following tags will be added to the playlist:
#EXT-X-CUE-OUT:DURATION=<time>
…
#EXT-X-CUE-IN
#EXT-X-CUE-OUT and #EXT-X-CUE-IN are a pair, and the entire section between the two tags will be replaced with ad content by the ad server.
DURATION=<time> is required and represents the duration of the ad.
You can request the CUE-IN event to end an inserted ad early. When the event is called, the #EXT-X-CUE-IN tag is immediately added to the playlist, and the previously added #EXT-X-CUE-IN tag is removed.
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": "cue",
"events":[
{
"cueType": "out", // out | in
"duration": 60500 // milliseconds, only available when cueType is out
}
]
}
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": "cue",
"events":[
{
"cueType": "out", // out | in
"duration": 60500 // milliseconds, only available when cueType is out
}
]
}
]
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
}