How to get thumbnails of video uploaded in Youtube using Youtube Data API in CakePHP
I have an application in which I have manually uploaded videos using Youtube Data API.
It is working fine.
But now I want to display thumbnails of video uploaded by my users in my application.
I have tried a lot for this with getVideoThumbnails()
, but I can not get videoEntry
object of recently uploaded video.
This is my code :
$yt = new Zend_Gdata_YouTube($httpClient,$applicationkey,null,$developerkey);
$videoEntry = $yt->getVideoEntry('the0KZLEacs');
$videoThumbnails = $videoEntry->getVideoThumbnails();
foreach($videoThumbnails as $videoThumbnail) {
echo $videoThumbnail['time'] . ' - ' . $videoThumbnail['url'];
echo ' height=' . $开发者_开发问答videoThumbnail['height'];
echo ' width=' . $videoThumbnail['width'] . "\n";
}
Here, the0KZLEacs is a id of uploaded video.
Have any idea?
Thanks in advance...
Try:
http://i3.ytimg.com/vi/<?php echo $video_id; ?>/default.jpg
Where $video_id
is the ID of your YouTube video.
精彩评论