本文整理汇总了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;
}*/
}