Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

error 400 : "Media type 'application/json; charset=UTF-8' is not supported."

$
0
0

have a good time,I use Google api v3 to upload videos to YouTube. Unfortunately, I am facing this error since yesterday without any changes in the code or the server.

I searched the error text in different parts, but I didn't get any results. The only thing I found is that inside this package and this file at this address src/Http/MediaFileUpload.phpThe content-type is specified, whose value is application/json; charset=UTF-8 is set. I guess this is the problem. Please guide me.

Thank you

Environment details

  • OS: Linux
  • PHP version: 8.1.8
  • Package name and version: "google/apiclient": "^2.13.2"
  • Laravel : ^9.0

Steps to reproduce

"error": {"code": 400,"message": "Media type 'application/json; charset=UTF-8' is not supported. ","errors": [      {"message": "Media type 'application/json; charset=UTF-8' is not supported. ","domain": "global","reason": "badRequest"      }    ],"status": "INVALID_ARGUMENT"  }

Code example

 $chunkSizeBytes = 15 * 1024 * 1024;        $client->setDefer(true);        $insertRequest = $youtube->videos->insert("status,snippet,recordingDetails", $video , ['notifySubscribers' => true        ]);        $media = new MediaFileUpload(            $client,            $insertRequest,'video/'.File::extension($videoPath),            null,            false,            $chunkSizeBytes        );        $media->setFileSize(File::size($videoPath));        $status = false;        $handle = fopen($videoPath, "rb");        while (!$status && !feof($handle)) {            $chunk = fread($handle, $chunkSizeBytes);            $status = $media->nextChunk($chunk);        }        fclose($handle);        $client->setDefer(false);

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>