1

API 版本 0.6.2

我正在关注这个答案:

通过 google php client api v3 将大型视频发布到 youtube

我越来越

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 (1h)。这也是在本地完成的这可能是原因还是可能是什么原因?

任何帮助表示赞赏。

4

0 回答 0