# Using Live Transcode with APIs
To start managing Live Transcode with APIs, please contact us for request by email support@inox.co.th
After recieved your service ID and API key, you can start send request through ours APIs.
# List of APIs for Live Transcode
- Create new Live Transcode (createchannel)
- List opened Live Transcode (listchannels)
- Delete unused Live Transcode (deletechannel)
- Drop inbound singnal to Live Transcode server (dropchannelpublisher)
- Reset and restart Live Transcoder (dropchanneltranscoder)
# Basic of using APIs
curl -XPOST https://fleet.byteark.com/api/:serviceId/:apiKey/:apiFunctionName -d [parameters]
Send HTTP Requests to https://fleet.byteark.com/api (opens new window) with these required parameters
- serviceId : Service number of your ByteArk Fleet
- apiKey : API Key for request an API in match with Service ID.
- apiFunctionName : Function of request API.
- parameters : Assosiate paraameters for reqeust function, input in Key Value pattern.
After our Live Transcode API service recieved your API request, it will response with status 200 and body in JSON object with data that corresponding to function you requested.
# List of APIs functions in Live Stream Transcoder
# 1. Create new Live Stream (createchannel)
curl -XPOST https://fleet.byteark.com/api/:serviceId/:apiKey/createchannel -d 'transcode[1080p]=1&transcode[720p]=1&transcode[480p]=1&streamname=teststream'
Create new Live Stream channel. We requested you to input any ressulotion in need by these parameters.
- Stream name (streamname)
- List of resoulution you need, transcode[1080p] , transcode[720p] , transcode[576p] , transcode[480p], transcode[360p], transcode[240p] assigned value to 1 to enable each resolution.
After requested this create Live Stream API, Service will return status of current transcoder and RTMP endpoint for you to publish to. User can input the given streamendpoint
and streamkey
into RTMP streaming software to start publish streaming signal to Byteark. And for watching the Live Streaming, a streamurl that end with index.m3u8
can be use to watch the Live stream.
{ "transcodelimit" :5,
"transcodeusage" :3,
"streamid" :450,
"streamname" :"testapi2",
"streamkey" :"t5bx-fwr7-mywm",
"streamsource" :"",
"streammode" :"PUSH",
"streamendpoint" :"rtmp:\/\/publish.fleet.byteark.com\/fleet",
"transcoder": {
"1080p": { "enabled" :true, "bitrate" :"auto" },
"720p": { "enabled" :true, "bitrate" :"auto" },
"576p": { "enabled" :false, "bitrate" :"auto" },
"480p": { "enabled" :true, "bitrate" :"auto" },
"360p": { "enabled" :false, "bitrate" :"auto" },
"240p": { "enabled" :false, "bitrate" :"auto" }
},
"streamurl" :"https:\/\/teststream-gmwjpl.cdn.byteark.com\/fleetstream\/testapi2\/index.m3u8" }
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 2. List opened Live Stream (listchannels)
curl -XPOST https://fleet.byteark.com/api/:serviceId/:apiKey/listchannels
List opened live stream channel with transcode status and detail for each channel.
- transcodelimit : Maximum number of transcode in your service.
- transcodeusage : Number of used trasncode.
For details of each channel, we will arrange and group it by channel. Detail data is as show in this list.
- streamid : ID of stream in Fleet Stream
- streamname : Stream name (named on create)
- streamkey : Key of RTMP endpoint.
- streammode : Mode of streaming, "PUSH" = User publish signal to assigned RTMP enpoint, "PULL" Fleet Streaming pulling RTMP from user assigned enpoint.
- streamendpoint : RTMP server enpoint.
- streamurl : Live Stream url for user watch the stream.
- transcoder: List of enabled resolution(s). Example:
1080p: {"enabled": true}
# 3. Delete Live Stream (deletechannel)
curl -XPOST https://fleet.byteark.com/api/:serviceId/:apiKey/deletechannel -d "streamname=[streamname]"
This API will delete you Live Stream channel after you already done using it. By request this API with stream name. After request, the stream name you request will be delete, publish signal and transcode will be drop and you can no longer use this stream.
# 4. Drop Live Stream Publisher (dropchannelpublisher)
curl -XPOST https://fleet.byteark.com/api/:serviceId/:apiKey/dropchannelpublisher -d "streamname=[streamname]"
Drop signal that publish to given stream name RTMP server. This result in RTMP server will wait to recieve signal again.
In normal operation this function will be use for reseting status in case of detecting some form of streaming error both in term of signal error or sending status error.
Response status=1 refer to signal dropping is completed. If publish software still alive and still sending signal to the RTMP server it will resume. This function will active and result will appear within 5-15 seconds.
# 5. Drop Live Transcoder (dropchanneltranscoder)
curl -XPOST https://fleet.byteark.com/api/:serviceId/:apiKey/dropchanneltranscoder -d "streamname=[streamname]"
This function disconnect Live Transcoder in order to restart itself. By request the API with a streamname
of channel that you wish to restart transcoder. nomally admin will use this function to reset transcode in case of invalid or false input signal.
Response status=2 refer to restarting transcode is completed. If publish software still alive and still sending signal to the RTMP server it will resume. This function will active and result will appear within 5-15 seconds.
# Limitation
Transcoding Cloud limit number of active Live Transcode at the same time within an account (transcodelimit). You can increase limit of active Live Transcode by contacting us at sales@byteark.com