这是我的代码示例:
$httpClient = Zend_Gdata_ClientLogin::getHttpClient( $username, $password, $service, $client, $source, $loginToken, $loginCaptcha, $authenticationURL);
$httpClient->setHeaders('X-GData-Key', "key=${myDeveloperKey}");
$yt = new Zend_Gdata_YouTube($httpClient);
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
$filesource = $yt->newMediaFileSource($filename);
$filesource->setContentType('video/quicktime');
$filesource->setSlug($filename);
$myVideoEntry->setMediaSource($filesource);
$mediaGroup = $yt->newMediaGroup();
$mediaGroup->title = $yt->newMediaTitle()->setText(POST("title"));
$mediaGroup->description = $yt->newMediaDescription()->setText(POST("description"));
$mediaGroup->category = array(
$yt->newMediaCategory()->setText(POST("category"))->setScheme('http://gdata.youtube.com/schemas/2007/categories.cat'),
$yt->newMediaCategory()->setText('mydevelopertag')->setScheme('http://gdata.youtube.com/schemas/2007/developertags.cat')
);
$mediaGroup->keywords = $yt->newMediaKeywords()->setText(POST("tags"));
$myVideoEntry->mediaGroup = $mediaGroup;
$uploadUrl = 'http://uploads.gdata.youtube.com/feeds/users/default/uploads';
$newEntry = $yt->insertEntry($myVideoEntry, $uploadUrl, 'Zend_Gdata_YouTube_VideoEntry');
$youtube_id = $newEntry->getVideoID();
请注意,为简单起见,这只是代码示例。完整的代码要复杂得多,并且经过测试可以正常工作。
伙计们,这可能只是一行代码。我找不到任何文档。
最佳答案
搜寻Zend_Gdata_YouTube_VideoEntry disable comments
会出现this:
I'm not sure that the latest Zend client library release has added native support for the
yt:accessControl
setting yet. You should be able to manually construct the relevant Atom XML element based on the language-neutral documentation: ....
看来您必须更改要发送的原始数据。我不知道那有多困难。也许无论如何都会有帮助。
关于php - 直接上载Zend PHP:如何禁用对正在上载的视频的评论?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4058419/