Api版本0.6.2
我跟着这个回答:
Post large video to youtube via google php client api v3
我正在
Failed to start the resumable upload
500 Internal Server Error - Google_Exception
堆栈跟踪
in /home/darko/NetBeansProjects/shekortet/vendor/google/google-api-php-client/src/service/Google_MediaFileUpload.php at line 260 -+
if (200 == $code && true == $location) {
return $location;
}
throw new Google_Exception("Failed to start the resumable upload");
}
}
at Google_MediaFileUpload ->getResumeUri (object(Google_HttpRequest))
in /home/darko/NetBeansProjects/shekortet/vendor/google/google-api-php-client/src/service/Google_MediaFileUpload.php at line 214 -+
public function nextChunk(Google_HttpRequest $req, $chunk=false) {
if (false == $this->resumeUri) {
$this->resumeUri = $this->getResumeUri($req);
}
if (false == $chunk) {
at Google_MediaFileUpload ->nextChunk (object(Google_HttpRequest), '')
in /home/darko/NetBeansProjects/shekortet/src/Dalu/MediaBundle/Controller/EncodeController.php at line 284 -+
while (!$status && !feof($handle))
{
$chunk = fread($handle, $chunkSizeBytes);
$uploadStatus = $media->nextChunk($result, $chunk);
var_dump($uploadStatus);
}
当尝试发布不可恢复的上传时,我收到400 Bad Request错误。
错误消息
Error calling POST https://www.googleapis.com/youtube/v3/videos?part=status%2Csnippet&key=replacedkeystring: (400) Bad Request
堆栈跟踪
in /home/darko/NetBeansProjects/shekortet/vendor/google/google-api-php-client/src/io/Google_REST.php at line 66 -+
$err .= ": ($code) $body";
}
throw new Google_ServiceException($err, $code, null, $decoded['error']['errors']);
}
// Only attempt to decode the response, if the response code wasn't (204) 'no content'
at Google_REST ::decodeHttpResponse (object(Google_HttpRequest))
in /home/darko/NetBeansProjects/shekortet/vendor/google/google-api-php-client/src/io/Google_REST.php at line 36 -+
*/
static public function execute(Google_HttpRequest $req) {
$httpRequest = Google_Client::$io->makeRequest($req);
$decodedResponse = self::decodeHttpResponse($httpRequest);
$ret = isset($decodedResponse['data'])
? $decodedResponse['data'] : $decodedResponse;
return $ret;
at Google_REST ::execute (object(Google_HttpRequest))
in /home/darko/NetBeansProjects/shekortet/vendor/google/google-api-php-client/src/service/Google_ServiceResource.php at line 186 -+
return $httpRequest;
}
return Google_REST::execute($httpRequest);
}
public function useObjects() {
at Google_ServiceResource ->__call ('insert', array(array('part' => 'status,snippet', 'postBody' => object(Google_Video), 'mediaUpload' => object(Google_MediaFileUpload))))
in /home/darko/NetBeansProjects/shekortet/vendor/google/google-api-php-client/src/contrib/Google_YouTubeService.php at line 789 -+
public function insert($part, Google_Video $postBody, $optParams = array()) {
$params = array('part' => $part, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
$data = $this->__call('insert', array($params));
if ($this->useObjects()) {
return new Google_Video($data);
} else {
at Google_VideosServiceResource ->insert ('status,snippet', object(Google_Video), array('mediaUpload' => object(Google_MediaFileUpload)))
in /home/darko/NetBeansProjects/shekortet/src/Dalu/MediaBundle/Controller/EncodeController.php at line 277 -+
$media = new \Google_MediaFileUpload('video/x-matroska', null, false, $chunkSizeBytes);
$media->setFileSize(filesize($filename));
$result = $youtube->videos->insert("status,snippet", $gvideo, ['mediaUpload' => $media]);
$status = false;
$handle = fopen($filename, "rb");
几个小时前我已经过身份验证了。我看到令牌的生命周期是3600(1小时)。 这也是在本地完成的 这可能是原因或可能是什么原因?
任何帮助表示感谢。