Create RTMP stream

Create a new live stream. PUSHR will provide RTMP link to which you'd be sending the feed and will configure a live transcoder which will encode the stream in multiple resolutions to create an adaptive bitrate HLS stream. 

Note: The media platform is not a standalone service. In order to be able to create and destroy streams, you need to create a CDN push (storage) zone first and pass the zone_id parameter when creating a new live stream. If DVR recording is enabled, the recording will be stored in the storage space of this CDN zone, and will be available for playback as video-on-demand immediately after you end the live stream.

Endpoint

https://www.pushrcdn.com/api/v3/streams/stream

Methods

POST

Parameters

Note: parameters marked with * are required

FieldTypeValueDescription
actionstring*createCreate a new stream
zoneinteger*push zone idThe ID of the CDN push zone
namestring*any (UTF-8 only)Stream name
encoderstring*eu, us, sgIngestion encoder location 
dvrinteger 0, 1Enable DVR
muxinteger0, 1Remux output
360pinteger0, 1360p transcoded output
480pinteger 0, 1480p transcoded output
576pinteger 0, 1576p transcoded output
720pinteger0, 1720p transcoded output
1080pinteger 0, 1 1080p transcoded output

Headers 

FieldTypeDescription
APIKEYstringYour account API key

Example

Create a HLS stream named 'teststream' in adaptive bitrate HLS with 480p and 720p variants, 

curl -d "action=create" \
     -d "zone=7125" \
     -d "name=teststream" \
     -d "encoder=eu" \
     -d "vod=0" \
     -d "mux=0" \
     -d "360p=0" \
     -d "480p=1" \
     -d "576p=0" \
     -d "720p=1" \
     -d "1080p=0" \
     -H "Accept: application/json" \
     -H "Content-Type: application/json" \ 
     -H "APIKEY: 2d49e8f645d90818783c4e6c46f32ca0677ac401" \ 
     -X POST "https://www.pushrcdn.com/api/v3/stream"

Response

Returns the status of the operation, the id of the newly created stream, the streaming server and key, and the HLS link which should be used for viewing the live stream.


{  
   "status":"success",
   "id":"12081",
   "rtmp_key":"12081?auth=802267e0dedf9b1ee422460bed2ac23a",
   "rtmp_server":"trn_g0021.r-cdn.com/live",
   "hls_link":"https://05591.r-cdn.com/g01/12081/playlist.m3u8",
   "player_link":"https://live.r-cdn.com/1912/teststream/play"
}
HTTPJSONDescription
200 Returns stream info
4xx{"status":"error","description":"msg"}Error message


Notes

  • Output Resolutions: You can select one or more output resolutions. If more than one resoluion is selected, the resulting stream will automatically be created in an adaptive bitrate HLS format.
  • DVR recording: When DVR is enabled, the stream will be recorded and saved to your CDN zone's storage space. To obtain the recording URL, use the stream information API.

Due to HLS latency, there is an average delay of 20 seconds between then moment a stream is started and the moment when viewers can start watching it via the hls_link. During this time the hls_link would return HTTP404 or HTTP403. If you are automatically publishing streams in your website, app or service, we recommend that you query the hls_linkcontinuously and wait for a HTTP200 response which can be used as a trigger for publishing.