Pushes a live stream or channel to another service. To push a stream the origin stream details (application, instance, and stream name), service type and destination stream name/key are required. Other parameters may be required based on the service you wish to connect. To connect to a service that has been stored using pushpublish.add the only parameter required is the 'push_service_id' param. The default source app and stream that was stored will be used unless a new app or stream is provided with this call. The PushPublish services we offer are Akamai HLS, Facebook, Icecast, and any other RTMP based service.
Akamai HLS pushes require an Akamai Host and Stream ID
Facebook pushes requires a destination host
Requires destination host address and stream
Youtube pushes require no additional fields
RTMP Services will require a host address, and may also require a destination app, instance, port, username and password to connect.
Icecast pushes require a host address, port, username, and password
Requires no additional fields. Default host url: live.twitch.tv, use dst_host to change if different.
$request = array( 'command' => 'pushpublish.connect', 'api_key' => 'APX4GKLM0RKQLSP2FBO1ROPKSSW47DZE', 'timestamp' => time(), 'cdn' => 158, /* connect using stored details */ 'push_service_id' => 1234, 'app' => 'demo-origin', 'inst' => 'live', 'stream' => 'stream_1', ); //Create request signature $json_request = json_encode($request); $sig = base64_encode(hash_hmac('sha256', $json_request, '8fc8c48da81e6a2a06a9556379bf798af508dc0792497c678b4c3532ba8b637f', true)); $request['signature'] = $sig; $json_request = json_encode($request); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.scaleengine.net/stable/'); // Set the URL curl_setopt($ch, CURLOPT_POST, true); // Perform a POST curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // If not set, curl prints output to the browser curl_setopt($ch, CURLOPT_HEADER, false); // If set, curl returns headers as part of the data stream curl_setopt($ch, CURLOPT_POSTFIELDS, array('json' => $json_request)); //'Json' string or 'PHP' serialized return //If your PHP host does not have a proper SSL certificate bundle, you will need to turn off SSL Certificate Verification //This is dangerous, and should only be done temporarily until a proper certificate bundle can be installed //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Turns off verification of the SSL certificate. //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Turns off verification of the SSL certificate. $response = curl_exec($ch); //Execute the API Call if (!$response) { die('Failed to connect to ScaleEngine API'); } //Decode the response as an associative array $arrResponse = json_decode($response, true); if ($arrResponse) { //Operation completed successfully //TODO Add work here print_r($arrResponse); } else { //Operation failed echo 'An error occured processing your request:'; print_r($response); }
$request = array( 'command' => 'pushpublish.connect', 'api_key' => 'APX4GKLM0RKQLSP2FBO1ROPKSSW47DZE', 'timestamp' => time(), 'cdn' => 158, 'app' => 'demo-origin', 'inst' => 'live', 'stream' => 'stream_1', 'service_name' => 'akamai', 'dst_stream' => 'destination_stream_name', 'server_tag' => 'SER1', 'entry_name' => 'session_1', //optional 'adaptive_group' => 'group1', //optional 'origin_url' => 'jb-origin.secdn.net', // optional /* Akamai Params */ 'host_id' => 'akamai_host_id', 'stream_id' => 'akamai_stream_id', 'event_name' => 'my_event', //optional 'push_source' => true, //optional 'redundant_playlist' => 1, //optional 'playback_ssl' => 0, //optional 'addEndListOnDisconnect => false, //optional /* Advanced Settings */ 'playlist_count' => 0, //optional 'playlist_timeout => 120000, //optional 'playlist_across_sessions' => 0, //optional 'relative_playlist' => 0, //optional 'bitrate_order' => 'high2low', //optional ); //Create request signature $json_request = json_encode($request); $sig = base64_encode(hash_hmac('sha256', $json_request, '8fc8c48da81e6a2a06a9556379bf798af508dc0792497c678b4c3532ba8b637f', true)); $request['signature'] = $sig; $json_request = json_encode($request); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.scaleengine.net/stable/'); // Set the URL curl_setopt($ch, CURLOPT_POST, true); // Perform a POST curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // If not set, curl prints output to the browser curl_setopt($ch, CURLOPT_HEADER, false); // If set, curl returns headers as part of the data stream curl_setopt($ch, CURLOPT_POSTFIELDS, array('json' => $json_request)); //'Json' string or 'PHP' serialized return //If your PHP host does not have a proper SSL certificate bundle, you will need to turn off SSL Certificate Verification //This is dangerous, and should only be done temporarily until a proper certificate bundle can be installed //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Turns off verification of the SSL certificate. //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Turns off verification of the SSL certificate. $response = curl_exec($ch); //Execute the API Call if (!$response) { die('Failed to connect to ScaleEngine API'); } //Decode the response as an associative array $arrResponse = json_decode($response, true); if ($arrResponse) { //Operation completed successfully //TODO Add work here print_r($arrResponse); } else { //Operation failed echo 'An error occured processing your request:'; print_r($response); }
$request = array( 'command' => 'pushpublish.connect', 'api_key' => 'APX4GKLM0RKQLSP2FBO1ROPKSSW47DZE', 'timestamp' => time(), 'cdn' => 158, 'app' => 'demo-origin', 'inst' => 'live', 'stream' => 'stream_1', 'service_name' => 'rtmp', 'dst_stream' => 'destination_stream_name', 'entry_name' => 'session_1', 'origin_url' => 'jb-origin.secdn.net', // optional /* RTMP Params */ 'dst_host' => 'rtmp.host.com', //do not include rtmp:// 'dst_port' => 1935, 'dst_app' => 'destination_app', 'dst_appinst' => 'destination_instance', 'dst_user' => 'destination_username', 'dst_pass => 'destination_password', 'send_ssl' => 1, //optional ); //Create request signature $json_request = json_encode($request); $sig = base64_encode(hash_hmac('sha256', $json_request, '8fc8c48da81e6a2a06a9556379bf798af508dc0792497c678b4c3532ba8b637f', true)); $request['signature'] = $sig; $json_request = json_encode($request); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://api.scaleengine.net/stable/'); // Set the URL curl_setopt($ch, CURLOPT_POST, true); // Perform a POST curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // If not set, curl prints output to the browser curl_setopt($ch, CURLOPT_HEADER, false); // If set, curl returns headers as part of the data stream curl_setopt($ch, CURLOPT_POSTFIELDS, array('json' => $json_request)); //'Json' string or 'PHP' serialized return //If your PHP host does not have a proper SSL certificate bundle, you will need to turn off SSL Certificate Verification //This is dangerous, and should only be done temporarily until a proper certificate bundle can be installed //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Turns off verification of the SSL certificate. //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Turns off verification of the SSL certificate. $response = curl_exec($ch); //Execute the API Call if (!$response) { die('Failed to connect to ScaleEngine API'); } //Decode the response as an associative array $arrResponse = json_decode($response, true); if ($arrResponse) { //Operation completed successfully //TODO Add work here print_r($arrResponse); } else { //Operation failed echo 'An error occured processing your request:'; print_r($response); }
command | [REQUIRED] [string] - API command to execute |
cdn | [REQUIRED] [int] - The ScaleEngine CDN ID of your account |
api_key | [REQUIRED] [string] - The API key provided as part of your account |
timestamp | [REQUIRED] [int] - The unix timestamp of your request, used to prevent authenticated API requests from being replayed |
push_service_id | [OPTIONAL] [int] - ID of the stored PushPublish Service |
app | [REQUIRED] [string] - The ScaleEngine Application name |
inst | [REQUIRED] [String] - Name of the Application Instance |
stream | [REQUIRED] [string] - Stream name |
service_name | [REQUIRED] [string] - service type.
Available services:
|
dst_stream | [REQUIRED] [string] - PushPublish Destination Stream Name |
entry_name | [REQUIRED] [String] - Unique Key used to reference the PushPublish session. Required if connecting/disconnecting without a push service id |
adaptive_group | [OPTIONAL] [string] - Name for a group of transcoded streams |
host_id | [OPTIONAL] [string] - Service Host ID |
stream_id | [OPTIONAL] [int] - Service Stream ID |
event_name | [OPTIONAL] [String] - Akamai stream event name. |
dst_host | [OPTIONAL] [string] - Destination Host Address. Do not inlcude protocol or port in the address. |
dst_port | [OPTIONAL] [int] - Destination Port Number. |
dst_app | [OPTIONAL] [string] - Destination Application Name |
dst_appinst | [OPTIONAL] [string] - Destination Application Instance Name |
dst_pass | [OPTIONAL] [string] - Destination Password |
dst_user | [OPTIONAL] [string] - Destination Username |
playlist_count | [OPTIONAL] [int] - How many chunks to have on the manifest for each rendition. [Default: 0] |
playlist_timeout | [OPTIONAL] [int] - How many milliseconds to keep the playlist after the encoder disconnects. [Default: 120,000] |
playlist_across_sessions | [OPTIONAL] [int] - Set to 1, keep the playlist when the encoder disconnects, instead of starting over. [Default: 0] |
relative_playlist | [OPTIONAL] [int] - [Default: false] |
bitrate_order | [OPTIONAL] [string] - "high2low" shows the top bitrate first in the rendition list, or "low2high" shows the lowest bitrate first. [Default: high2low]. |
send_ssl | [OPTIONAL] [boolean] - Push to RTMP Sources using SSL. default: false |
playback_ssl | [OPTIONAL] [boolean] - Enables Akamai Manifests to use HTTPS urls. default: false |
addEndListOnDisconnect | [OPTIONAL] [boolean] - Add End List tag to chunklist when Stream Disconnects. (default false) |
origin_url | [REQUIRED] [string] - Defines the url address of an origin to be called. Defaults to jb-origin.secdn.net for origins and jb-chorigin.secdn.net for channels. |
server_tag | [REQUIRED] [string] - The Server Tag must match either the primary_server, or backup_server provided when lock_servers is enabled from pushpublish.add command. |
{ "message": "cupertino-akamai connected", "status": "success", "handle_time":"0.3795 seconds" }
message | [string] - Debugging message |
status | [string] - "success" or "failure" |
handle_time | [float] - The amount of time spent processing your request |