Skip to content

Instantly share code, notes, and snippets.

@icywind
Created December 11, 2020 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icywind/0b883081c0466ab757e08e219f9b3ab2 to your computer and use it in GitHub Desktop.
Save icywind/0b883081c0466ab757e08e219f9b3ab2 to your computer and use it in GitHub Desktop.
Query the cloud recording session
<?php
require_once("config.php");
$curl = curl_init();
// Receive ResourceID and sid from client
$ResourceID = $_POST["resourceId"];
$Channel = $_POST["sid"];
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.agora.io/v1/apps/$AppID/cloud_recording/resourceid/$ResourceID/sid/$sid/mode/mix/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: Basic $AuthSecret"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
/**
* Returns json {"resourceId":"xxxx", "sid":"yyy", "serverResponse":{"status":5,"fileList":"zzzz.m3u8","fileListMode":"string","sliceStartTime":1606357122528}}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment