Description
I use this code to try upload from recording zoom download_url to Google Drive using the GDrive API
$token=$this->zoom->get_zoom_token();
$file_path = "https://mydomain.zoom.us/rec/download/largecode?access_token=$token";
$topic='Video example';
$filename = $topic. '.' . 'mp4';
// drive service
$file = new Google_Service_Drive_DriveFile();
$file->setName($filename);
// dir
$file->setParents(array("1vBEW6cY47Fip3cTY5..."));
// upload
$service->files->create(
$file,
array(
'data' => $file_path,
'mimeType' => $mimeType,
'uploadType' => 'resumable'
)
);
// status
$DateTime = new DateTime();
$now = $DateTime->format("Y-m-d H:i:s");
echo $now.' Upload OK :: '.$filename.PHP_EOL;
Error
The video size is 143MB (30min aprox), but in the GDrive the size is much less, when I download and reproduce, the video works but like a streaming (reproduce it only with an internet connection). I need to upload the entire file.
Which App Type (OAuth / Chatbot / JWT / Webhook)?
Knowing the endpoint/s can help us to identify your issue faster. Please link the ones you need help/have a question with.
OAuth
Which Endpoint/s?
Knowing the API endpoint/s can help us to identify your issue faster. Please link the ones you need help/have a question with.
To get the recordings information:
'GET', "/v2/users/$user_id/recordings?from=$from&to=$to&page_size=$size&next_page_token="
To get the zoom oauth token for the download_url:
public function get_zoom_token() {
$this->refresh_token();
$arr_token = $this->get_access_token();
return $arr_token->access_token;
}
private function refresh_token()
{
$refresh_token = $this->get_refresh_token();
try {
$response = $this->client->request('POST', '/oauth/token', [
"headers" => [
"Authorization" => "Basic ". base64_encode($this->config->item('CLIENT_ID').':'.$this->config->item('CLIENT_SECRET'))
],
'form_params' => [
"grant_type" => "refresh_token",
"refresh_token" => $refresh_token
],
]);
$access_token = json_decode($response->getBody()->getContents(), true);
$this->set_access_token(json_encode($access_token));
}
catch(Exception $e) {
return false;
}
}
Why I can’t upload the complete file?
I hope your help, let me know if you need more information
Thanks in advance