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 only way I can get it to work is by reading the entire video into a string, and then passing it via the data parameter.
I certainly do not want to read gigantic files into memory, but the api seems to offer no other way to do this. It seems to expect a string as the data
parameter. Below is the code I'm using to post the video.
$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);
$videoData = file_get_contents($pathToMyFile);
$youtubeService->videos->insert("status,snippet", $video, array("data" => $videoData, "mimeType" => "video/mp4"));
Is there any way to post the data in chunks, or stream the data in some way so as to avoid reading the entire file into memory?