PHP API Youtube Uploads, exception: Failed to start the resumable upload, upload must be sent to the upload URL
This seems to be a problem with PHP Client Library of Google API. Go to GOOGLE_LIB_PATH/Http/MediaFileUpload.php and replace this line:
$this->request->setBaseComponent($base . '/upload');
With this one:
$this->request->setBaseComponent($base . 'upload');
Try again and share the results. I faced a similar problem with Google Pubsub API where API path set by library was incorrect.
I hope you need Resumable Uploads(https://developers.google.com/youtube/v3/guides/using_resumable_upload_protocol)
Then use this without any modification.
Also check if the video format is supported from https://support.google.com/youtube/troubleshooter/2888402?hl=en
There is a google method to get the refresh token, so instead of using json_decode :
$newToken = json_decode($client->getAccessToken());$client->refreshToken($newToken->refresh_token);
You can do :
$client->refreshToken( $client->getRefreshToken() );