ScheduledChannel
ScheduledChannel allows you to create a live channel by scheduling pre-recorded files has been added to OvenMediaEngine. Other services or software call this Pre-recorded Live or File Live, but OvenMediaEngine plans to expand the function to organize live channels as a source, so we named it Scheduled Channel.
ScheduledChannel can be controlled by API or file. For more information about ScheduledChannel, see below.
The body of the API all has the same structure as the ScheduledChannel schedule file.
Get Channel List
Get all scheduled channels in the {vhost name}/{app name} application.
Request
GET /v1/vhosts/{vhost}/apps/{app}/scheduledChannels
Header
Authorization: Basic {credentials}
# Authorization
Credentials for HTTP Basic Authentication created with <AccessToken>
Responses
200 Ok
The request has succeeded
Header
Content-Type: application/json
Body
{
"message": "OK",
"response": [
"stream"
],
"statusCode": 200
}
# statusCode
Same as HTTP Status Code
# message
A human-readable description of the response code
# response
Json array containing a list of stream names
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 app name could not be found.
Header
Content-Type: application/json
Body
{
"statusCode": 404,
"message": "Could not find the application: [default/non-exists] (404)"
}
Create Channel
Create a Scheduled channel.
Request
POST /v1/vhosts/{vhost}/apps/{app}/scheduledChannels
Header
Authorization: Basic {credentials}
Content-Type: application/json
# Authorization
Credentials for HTTP Basic Authentication created with <AccessToken>
Body
{
"stream": {
"name": "stream2",
"bypassTranscoder": false,
"videoTrack": true,
"audioTrack": true
},
"fallbackProgram": {
"items": [
{
"url": "file://video/sample.mp4",
"start": 0,
"duration": 60000
}
]
},
"programs": [
{
"name": "1",
"scheduled": "2023-11-13T20:57:00.000+09",
"repeat": true,
"items": [
{
"url": "file://video/sample.mp4",
"start": 0,
"duration": 60000
},
{
"url": "file://video/1.mp4",
"start": 0,
"duration": 60000
}
]
},
{
"name": "2",
"scheduled": "2023-11-14T20:57:00.000+09",
"repeat": true,
"items": [
{
"url": "file://1.mp4",
"start": 0,
"duration": 60000
},
{
"url": "file://sample.mp4",
"start": 0,
"duration": 60000
}
]
}
]
}
Responses
201 Created
A stream has been created.
Header
Content-Type: application/json
Body
{
"message": "Created",
"statusCode": 201
}
# statusCode
Same as HTTP Status Code
# message
A human-readable description of the response code
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 app name could not be found.
Body
{
"statusCode": 404,
"message": "Could not find the application: [default/non-exists] (404)"
}
Patch Schedule
Update the schedule. <Stream>
cannot be PATCHed.
Request
PATCH /v1/vhosts/{vhost}/apps/{app}/scheduledChannels/{channel name}
Header
Authorization: Basic {credentials}
# Authorization
Credentials for HTTP Basic Authentication created with <AccessToken>
Body
Write the value you want to modify. However, name and outputProfiles cannot be modified.
{
"fallbackProgram": {
"items": [
{
"url": "file://video/sample.mp4",
"start": 5000,
"duration": 30000
}
]
},
"programs": [
{
"name": "1",
"scheduled": "2023-11-10T20:57:00.000+09",
"repeat": true,
"items": [
{
"url": "file://video/1.mp4",
"start": 0,
"duration": 60000
}
]
},
{
"name": "2",
"scheduled": "2023-11-20T20:57:00.000+09",
"repeat": true,
"items": [
{
"url": "file://video/1.mp4",
"start": 0,
"duration": 60000
},
{
"url": "file://video/sample.mp4",
"start": 0,
"duration": 60000
}
]
}
]
}
Responses
400 Bad Request
Invalid request.
{
"message": "[HTTP] Cannot change [name] using this API (400)",
"statusCode": 400
}
Get Channel Info
Get detailed information of scheduled channel. It also provides information about the currently playing program and item.
Request
GET /v1/vhosts/{vhost}/apps/{app}/scheduledChannels/{channel name}
Header
Authorization: Basic {credentials}
# Authorization
Credentials for HTTP Basic Authentication created with <AccessToken>
Responses
200 Ok
The request has succeeded
Header
Content-Type: application/json
Body
{
"message": "OK",
"response": {
"currentProgram": {
"currentItem": {
"currentPosition": 1700,
"duration": 60000,
"start": 0,
"url": "file://video/1.mp4"
},
"duration": -1,
"end": "2262-04-12T08:47:16.854+09:00",
"name": "2",
"repeat": true,
"scheduled": "2023-11-20T20:57:00.000+09:00",
"state": "onair"
},
"fallbackProgram": {
"items": [
{
"duration": -1,
"start": 0,
"url": "file://hevc.mov"
},
{
"duration": -1,
"start": 0,
"url": "file://avc.mov"
}
],
"name": "fallback",
"repeat": true,
"scheduled": "1970-01-01T00:00:00Z"
},
"programs": [
{
"name": "2",
"repeat": true,
"scheduled": "2023-11-20T20:57:00.000+09"
}
],
"stream": {
"audioTrack": true,
"bypassTranscoder": false,
"name": "stream",
"videoTrack": true
}
},
"statusCode": 200
}
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 app name could not be found.
Header
Content-Type: application/json
Body
{
"statusCode": 404,
"message": "Could not find the application or stream (404)"
}
Delete Channel
Delete Scheduled Channel
Request
DELETE /v1/vhosts/{vhost}/apps/{app}/scheduledChannels/{channel name}
Header
Authorization: Basic {credentials}
# Authorization
Credentials for HTTP Basic Authentication created with <AccessToken>
Responses
200 Ok
The request has succeeded
Header
Content-Type: application/json
Body
{
"statusCode": 200,
"message": "OK",
}
# statusCode
Same as HTTP Status Code
# message
A human-readable description of the response code