本文整理汇总了PHP中Zend_Gdata_YouTube_VideoEntry::setVideoPrivate方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_YouTube_VideoEntry::setVideoPrivate方法的具体用法?PHP Zend_Gdata_YouTube_VideoEntry::setVideoPrivate怎么用?PHP Zend_Gdata_YouTube_VideoEntry::setVideoPrivate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata_YouTube_VideoEntry
的用法示例。
在下文中一共展示了Zend_Gdata_YouTube_VideoEntry::setVideoPrivate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
$published = new Zend_Gdata_App_Extension_Published("2011-10-21 12:00:00");
$updated = new Zend_Gdata_App_Extension_Updated("2011-10-21 12:20:00");
$id = new Zend_Gdata_App_Extension_Id("Az2cv12");
$rating = new Zend_Gdata_Extension_Rating(4, 1, 5, 200, 4);
$duration = new Zend_Gdata_YouTube_Extension_Duration(80);
$player = new Zend_Gdata_Media_Extension_MediaPlayer();
$player->setUrl("coucou");
$stat = new Zend_Gdata_YouTube_Extension_Statistics();
$stat->setViewCount("5");
$thumb = new Zend_Gdata_Media_Extension_MediaThumbnail('une url', '120', '90');
$media = new Zend_Gdata_YouTube_Extension_MediaGroup();
$media->setPlayer([$player]);
$media->setDuration($duration);
$media->setVideoId($id);
$media->setThumbnail([$thumb]);
$entry = new Zend_Gdata_YouTube_VideoEntry();
$entry->setMajorProtocolVersion(2);
$entry->setMediaGroup($media);
$entry->setStatistics($stat);
$entry->setRating($rating);
$entry->setVideoCategory("category");
$entry->setVideoDescription("one description");
$entry->setVideoPrivate();
$entry->setVideoTags(['tags']);
$entry->setVideoTitle("hellow");
$entry->setUpdated($updated);
$entry->setPublished($published);
$this->object = new Bridge_Api_Youtube_Element($entry, 'video');
}
示例2: 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;
}*/
}
示例3: upload
/**
*
* @param record_adapter $record
* @param array $options
* @return string The new distant Id
*/
public function upload(record_adapter $record, array $options = [])
{
switch ($record->get_type()) {
case 'video':
$video_entry = new Zend_Gdata_YouTube_VideoEntry();
$filesource = new Zend_Gdata_App_MediaFileSource($record->get_hd_file()->getRealPath());
$filesource->setContentType($record->get_hd_file()->get_mime());
$filesource->setSlug($record->get_title());
$video_entry->setMediaSource($filesource);
$video_entry->setVideoTitle($options['title']);
$video_entry->setVideoDescription($options['description']);
$video_entry->setVideoCategory($options['category']);
$video_entry->SetVideoTags(explode(' ', $options['tags']));
$video_entry->setVideoDeveloperTags(['phraseanet']);
if ($options['privacy'] == "public") {
$video_entry->setVideoPublic();
} else {
$video_entry->setVideoPrivate();
}
$app_entry = $this->_api->insertEntry($video_entry, self::UPLOAD_URL, 'Zend_Gdata_YouTube_VideoEntry');
/*
* set major protocole version to 2 otherwise you get exception when calling getVideoId
* but setting setMajorProtocolVersion to 2 at the new entry introduce a new bug with getVideoState
* @see http://groups.google.com/group/youtube-api-gdata/browse_thread/thread/7d86cac0d3f90e3f/d9291d7314f99be7?pli=1
*/
$app_entry->setMajorProtocolVersion(2);
return $app_entry->getVideoId();
break;
default:
throw new Bridge_Exception_InvalidRecordType('Unknown format');
break;
}
}
示例4: youtube_api_upload_video
/**
* youtube_api_upload_video
*
* Uploads a video attachment to YouTube via API. Harnesses Zend YouTube api class
*
* @param Array $attachment_data - Video file upload data
* @access private
* @author Ben Moody
*/
private function youtube_api_upload_video($attachment_data)
{
//Init vars
$file_type = NULL;
$path_info = NULL;
$myVideoEntry = NULL;
$uploadUrl = NULL;
$filesource = NULL;
$newEntry = NULL;
$output = NULL;
//Cache plugin options
$plugin_options = get_option(PRSOGFORMSADVUPLOADER__OPTIONS_NAME);
//Check for required data
if (isset($attachment_data['file_path'], $attachment_data['mime_type'], $attachment_data['title'], $attachment_data['description'])) {
// upload URI for the currently authenticated user
$uploadUrl = $this->youtube_uploads_url;
// create a new VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
//Get file path
$file_path = $attachment_data['file_path'];
//Get file type
$file_type = $attachment_data['mime_type'];
//Get file slug - filename plus ext
$path_info = pathinfo($file_path);
// create a new Zend_Gdata_App_MediaFileSource object
$filesource = $this->data['YouTubeClass']->newMediaFileSource($file_path);
$filesource->setContentType($file_type);
// set slug header
$filesource->setSlug($path_info['basename']);
// add the filesource to the video entry
$myVideoEntry->setMediaSource($filesource);
$myVideoEntry->setVideoTitle($attachment_data['title']);
$myVideoEntry->setVideoDescription($attachment_data['description']);
// The category must be a valid YouTube category!
$myVideoEntry->setVideoCategory('Autos');
//Set video upload as private
if ($plugin_options['video_is_private']) {
$myVideoEntry->setVideoPrivate();
}
// try to upload the video, catching a Zend_Gdata_App_HttpException,
// if available, or just a regular Zend_Gdata_App_Exception otherwise
try {
$output = $this->data['YouTubeClass']->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
} catch (Zend_Gdata_App_HttpException $httpException) {
$output = $httpException->getRawResponseBody();
$this->plugin_error_log($output);
} catch (Zend_Gdata_App_Exception $e) {
$output = $e->getMessage();
$this->plugin_error_log($output);
}
}
return $output;
}
示例5: initiateReplication
/**
*
* @param string $ps_filepath
* @param array $pa_data
* @param array $pa_options
* @return string Unique request token. The token can be used on subsequent calls to fetch information about the replication request
*/
public function initiateReplication($ps_filepath, $pa_data, $pa_options = null)
{
if (!($o_client = $this->getClient($pa_options))) {
throw new Exception(_t('Could not connect to YouTube'));
}
$va_path_info = pathinfo($ps_filepath);
$o_video_entry = new Zend_Gdata_YouTube_VideoEntry();
$o_filesource = $o_client->newMediaFileSource($ps_filepath);
$ID3 = new getID3();
$ID3->option_max_2gb_check = false;
$va_info = $ID3->analyze($ps_filepath);
$o_filesource->setContentType($va_info['mime_type']);
$o_filesource->setSlug($va_path_info['filename'] . '.' . $va_path_info['extension']);
$o_video_entry->setMediaSource($o_filesource);
$o_video_entry->setVideoTitle(isset($pa_data['title']) ? $pa_data['title'] : $va_path_info['filename']);
$o_video_entry->setVideoDescription($pa_data['description'] ? $pa_data['description'] : '');
// Note that category must be a valid YouTube category!
$o_video_entry->setVideoCategory($pa_data['category'] ? $pa_data['category'] : 'Movies');
// Set keywords, note that this must be a comma separated string
// and that each keyword cannot contain whitespace
$o_video_entry->SetVideoTags(is_array($pa_data['tags']) ? join(",", $pa_data['tags']) : '');
if (isset($pa_options['private']) && $pa_options['private']) {
$o_video_entry->setVideoPrivate();
}
// This may throw an exception
$o_new_entry = $o_client->insertEntry($o_video_entry, WLPlugMediaReplicationYouTube::$s_upload_url, 'Zend_Gdata_YouTube_VideoEntry');
$this->opa_request_list[$o_new_entry->getVideoID()] = array('entry' => $o_video_entry, 'errors' => array());
return $this->info['NAME'] . "://" . $o_new_entry->getVideoID();
}