本文整理匯總了PHP中Zend_Gdata_YouTube_VideoEntry::setAccess方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Gdata_YouTube_VideoEntry::setAccess方法的具體用法?PHP Zend_Gdata_YouTube_VideoEntry::setAccess怎麽用?PHP Zend_Gdata_YouTube_VideoEntry::setAccess使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Gdata_YouTube_VideoEntry
的用法示例。
在下文中一共展示了Zend_Gdata_YouTube_VideoEntry::setAccess方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: uploadVideo
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;
}*/
}