I am trying to upload large videos to youtube via the latest version of the google client api (v3, latest checked out source)
I have it posting the videos, but the
It looks like this use case wasn't supported before. Here's a sample that works with the very latest version of the Google APIs PHP client (from https://code.google.com/p/google-api-php-client/source/checkout).
if ($client->getAccessToken()) {
$videoPath = "path/to/foo.mp4";
$snippet = new Google_VideoSnippet();
$snippet->setTitle("Test title2");
$snippet->setDescription("Test descrition");
$snippet->setTags(array("tag1", "tag2"));
$snippet->setCategoryId("22");
$status = new Google_VideoStatus();
$status->privacyStatus = "private";
$video = new Google_Video();
$video->setSnippet($snippet);
$video->setStatus($status);
$chunkSizeBytes = 1 * 1024 * 1024;
$media = new Google_MediaFileUpload('video/mp4', null, true, $chunkSizeBytes);
$media->setFileSize(filesize($videoPath));
$result = $youtube->videos->insert("status,snippet", $video,
array('mediaUpload' => $media));
$status = false;
$handle = fopen($videoPath, "rb");
while (!$status && !feof($handle)) {
$chunk = fread($handle, $chunkSizeBytes);
$uploadStatus = $media->nextChunk($result, $chunk);
}
fclose($handle);
}