![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
18/07/2011, 22:27
|
| | Fecha de Ingreso: enero-2010
Mensajes: 247
Antigüedad: 15 años Puntos: 2 | |
Respuesta: Subir video con la API de youtube con php desde mi web de nuevo por aca, he cambiado parte de mi codigo por esto
$yt = new Zend_Gdata_YouTube($httpClient);
// create a new Zend_Gdata_YouTube_VideoEntry object
$myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
// create a new Zend_Gdata_App_MediaFileSource object
$filesource = $yt->newMediaFileSource('1.mp4');
$filesource->setContentType('video/quicktime');
// set slug header
$filesource->setSlug('1.mp4');
// add the filesource to the video entry
$myVideoEntry->setMediaSource($filesource);
// create a new Zend_Gdata_YouTube_MediaGroup object
$myVideoEntry->setVideoTitle('My Test Movie');
$myVideoEntry->setVideoDescription('My Test Movie');
// Note that category must be a valid YouTube category !
$myVideoEntry->setVideoCategory('Comedy');
$myVideoEntry->SetVideoTags('cars, funny');
// the category must be a valid YouTube category
// optionally set some developer tags (see Searching by Developer Tags for more details)
$mediaGroup->category = array(
$yt->newMediaCategory()->setText('Autos')->setScheme('http://gdata.youtube.com/schemas/2007/categories.cat'),
$yt->newMediaCategory()->setText('mydevelopertag')->setScheme('http://gdata.youtube.com/schemas/2007/developertags.cat'),
$yt->newMediaCategory()->setText('anotherdevelopertag')->setScheme('http://gdata.youtube.com/schemas/2007/developertags.cat')
);
// Optionally set some developer tags
$myVideoEntry->setVideoDeveloperTags(array('mydevelopertag',
'anotherdevelopertag'));
// Optionally set the video's location
$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/users/default/uploads';
// Try to upload the video, catching a Zend_Gdata_App_HttpException
// if availableor just a regular Zend_Gdata_App_Exception
try {
$newEntry = $yt->insertEntry($myVideoEntry,
$uploadUrl,
'Zend_Gdata_YouTube_VideoEntry');
} catch (Zend_Gdata_App_HttpException $httpException) {
echo $httpException->getRawResponseBody();
} catch (Zend_Gdata_App_Exception $e) {
echo $e->getMessage();
}
y aunque no me saca ningun error, tampoco me sube el video a youtube, me hace falta alguna otra cosa ? o sera porque el video que intento subir es mp4 ? acudo a sus conocimientos.
y muchas gracias por la ayuda que he recibo de ustedes. |