public function uploadVideo($fileDisk, $fileUrl, $props, $private = false) { // foreach ($props as $key => $val) // { // error_log($key . " is " . $val); // } // create a new VideoEntry object $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry(); // create a new Zend_Gdata_App_MediaFileSource object $filesource = $this->yt->newMediaFileSource($fileDisk); $filesource->setContentType('video/quicktime'); // print_r($filesource); // set slug header $filesource->setSlug($fileUrl); // add the filesource to the video entry $myVideoEntry->setMediaSource($filesource); $myVideoEntry->setVideoTitle($props['title']); $myVideoEntry->setVideoDescription($props['description']); // The category must be a valid YouTube category! $myVideoEntry->setVideoCategory($props['category']); // Set keywords. Please note that this must be a comma-separated string // and that individual keywords cannot contain whitespace $myVideoEntry->setVideoTags($props['keywords']); if ($private) { $myVideoEntry->setVideoPrivate(); } else { $myVideoEntry->setVideoPublic(); } $access = array(); $access[] = new Zend_Gdata_YouTube_Extension_Access('comment', $props['comment']); $access[] = new Zend_Gdata_YouTube_Extension_Access('rate', $props['rate']); $access[] = new Zend_Gdata_YouTube_Extension_Access('commentVote', $props['commentVote']); $access[] = new Zend_Gdata_YouTube_Extension_Access('videoRespond', $props['videoRespond']); $access[] = new Zend_Gdata_YouTube_Extension_Access('embed', $props['embed']); $myVideoEntry->setAccess($access); // set some developer tags -- this is optional // (see Searching by Developer Tags for more details) // $myVideoEntry->setVideoDeveloperTags(array('mydevtag', 'anotherdevtag')); // set the video's location -- this is also optional // $yt->registerPackage('Zend_Gdata_Geo'); // $yt->registerPackage('Zend_Gdata_Geo_Extension'); // $where = $yt->newGeoRssWhere(); // $position = $yt->newGmlPos('37.0 -122.0'); // $where->point = $yt->newGmlPoint($position); // $myVideoEntry->setWhere($where); // upload URI for the currently authenticated user $uploadUrl = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads'; // try to upload the video, catching a Zend_Gdata_App_HttpException, // if available, or just a regular Zend_Gdata_App_Exception otherwise /* try { */ $newEntry = $this->yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry'); $newEntry->setMajorProtocolVersion(2); //if(isset($props['playlists'])) //$this->handlePlaylists($newEntry, explode(',', $props['playlists'])); return $newEntry->getVideoId(); /* } catch (Zend_Gdata_App_HttpException $httpException) { // print_r($httpException); echo $httpException->getRawResponseBody(); return null; } catch (Zend_Gdata_App_Exception $e) { // print_r($e); echo $e->getMessage(); return null; }*/ }