I created a PHP script to directly upload video to a YouTube Channel using Youtube API 3.0 and Google Api Php Client, as described in this tutorial: https://www.domsammut.com/code/php-server-side-youtube-v3-oauth-api-video-upload-guide
Differently from this tutorial, I generate The OAuth access token using the OAuth 2.0 Playground (https://developers.google.com/oauthplayground) and then I stored the json data into a MySQL database (instead of using a text file).
Everything worked right for a couple of days, but today I get this error:
Caught Google service Exception 0
message is
Failed to start the resumable upload (HTTP 400: youtube.video, Bad Request)
Stack trace is
#0 /home2/xxx/public_html/google-api-php-client/src/Google/Http/MediaFileUpload.php(134): Google_Http_MediaFileUpload->getResumeUri()
#1 /home2/xxx/public_html/_upload_video.php(98): Google_Http_MediaFileUpload->nextChunk('\x00\x00\x00\x14ftypqt \x00\x00\x00...')
#2 {main}
several times. Despite this, the video is uploaded correctly into YouTube!
Row 98 is:
$status = $media->nextChunk($chunk);
I really can't understand where the problem is. Can you help me? Thank you!