Dec. 11, 2020
How to Download Zoom Cloud Recordings by PHP Program ?
- 0 Comments
- 11856 Views
- Categories: Zoom API Cloud Recordings PHP Symfony
The Zoom API is the primary means for developers to access a collection of resources from Zoom. Apps can read and write to the resources and mirror some of the most popular features available in such as creating a new meeting, creating, adding and removing users, viewing reports and dashboards on various usage, and so on using the Zoom API. Depending on your app’s use case, you can choose from Zoom's various APIs and implement the features accordingly.
This is how Zoom's marketplace define the usage of API's provided by Zoom. And indeed using those API's really helpful to reduce back-office operations for most of the companies.
For Cihangir Yoga / Istanbul , we integrate their portals with Zoom thru API's and automate meeting creation for scheduled sessions, implement Zoom Web Client in class detail and when the session start users can watch the session thru this web client under the brand of Cihangir Yoga.
Our next challenge was to download cloud recordings to more cost effective storage and display these videos also on Web pages of the company.
So, how we can automize the process without the need for manual intervention ?
We implemented a batch job by PHP which checks the class sessions already ended for ready recordings. If recordings are available, job get the Download_URL of the recording by using RecordingGET API of Zoom.
$ch = curl_init();
header('Content-Disposition: attachment; filename="'.$recfile->getId().'.mp4"');
// set URL and other appropriate options
$fp = fopen('public/upload/zoomvideos/'.$recfile->getId().'.mp4', 'w+');
curl_setopt($ch, CURLOPT_URL, $recfile->getDownloadUrl().'?access_token='.$authorization);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 50);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/octet-stream',
'Content-Description: File Transfer',
]);
curl_exec($ch);
fclose($fp);
use Firebase\JWT\JWT;
protected function generateJWT()
{
$token = [
'iss' => $this::ZOOM_API_KEY,
'exp' => time() + 60,
];
return JWT::encode($token, $this::ZOOM_API_SECRET);
}
0 Comments