/**
 * Echo video metadata
 *
 * @param Zend_Gdata_YouTube_VideoEntry $entry The video entry
 * @return void
 */
function echoVideoMetadata($entry)
{
    $title = htmlspecialchars($entry->getVideoTitle());
    $description = htmlspecialchars($entry->getVideoDescription());
    $authorUsername = htmlspecialchars($entry->author[0]->name);
    $authorUrl = 'http://www.youtube.com/profile?user='******', ', $entry->getVideoTags()));
    $duration = htmlspecialchars($entry->getVideoDuration());
    $watchPage = htmlspecialchars($entry->getVideoWatchPageUrl());
    $viewCount = htmlspecialchars($entry->getVideoViewCount());
    $rating = 0;
    if (isset($entry->rating->average)) {
        $rating = $entry->rating->average;
    }
    $numRaters = 0;
    if (isset($entry->rating->numRaters)) {
        $numRaters = $entry->rating->numRaters;
    }
    $flashUrl = htmlspecialchars(findFlashUrl($entry));
    print <<<END
        <b>Title:</b> {$title}<br />
        <b>Description:</b> {$description}<br />
        <b>Author:</b> <a href="{$authorUrl}">{$authorUsername}</a><br />
        <b>Tags:</b> {$tags}<br />
        <b>Duration:</b> {$duration} seconds<br />
        <b>View count:</b> {$viewCount}<br />
        <b>Rating:</b> {$rating} ({$numRaters} ratings)<br />
        <b>Flash:</b> <a href="{$flashUrl}">{$flashUrl}</a><br />
        <b>Watch page:</b> <a href="{$watchPage}">{$watchPage}</a> <br />
END;
}
Example #2
0
/**
 * Echo video metadata
 * 
 * @param Zend_Gdata_YouTube_VideoEntry $entry The video entry
 */
function echoVideoMetadata($entry) 
{
    $title = $entry->mediaGroup->title;
    $description = $entry->mediaGroup->description;
    $authorUsername = $entry->author[0]->name;
    $authorUrl = 'http://www.youtube.com/profile?user=' . $authorUsername;
    $tags = $entry->mediaGroup->keywords;
    $duration = $entry->mediaGroup->duration->seconds;
    $watchPage = $entry->mediaGroup->player[0]->url;
    $viewCount = $entry->statistics->viewCount;
    $rating = $entry->rating->average;
    $numRaters = $entry->rating->numRaters;
    $flashUrl = findFlashUrl($entry);
    print <<<END
    <b>Title:</b> ${title}<br />
    <b>Description:</b> ${description}<br />
    <b>Author:</b> <a href="${authorUrl}">${authorUsername}</a><br />
    <b>Tags:</b> ${tags}<br />
    <b>Duration:</b> ${duration} seconds<br />
    <b>View count:</b> ${viewCount}<br />
    <b>Rating:</b> ${rating} (${numRaters} ratings)<br />
    <b>Flash:</b> <a href="${flashUrl}">${flashUrl}</a><br />
    <b>Watch page:</b> <a href="${watchPage}">${watchPage}</a> <br />
END;
}
Example #3
0
function echoVideoPlayer($videoId)
{
    $yt = new Zend_Gdata_YouTube();
    $entry = $yt->getVideoEntry($videoId);
    $videoTitle = $entry->mediaGroup->title->text;
    $videoUrl = findFlashUrl($entry);
    //$relatedVideoFeed = getRelatedVideos($entry->getVideoId());
    //$topRatedFeed = getTopRatedVideosByUser($entry->author[0]->name);
    $list = array('title' => $entry->mediaGroup->title->text, 'description' => $entry->mediaGroup->description->text, 'author' => (string) $entry->author[0]->name, 'authorUrl' => 'http://www.youtube.com/profile?user='******'tags' => (string) $entry->mediaGroup->keywords, 'duration' => $entry->mediaGroup->duration->seconds, 'watchPage' => $entry->mediaGroup->player[0]->url, 'viewCount' => $entry->statistics->viewCount, 'rating' => $entry->rating->average, 'numRaters' => $entry->rating->numRaters, 'videoUrl' => findFlashUrl($entry));
    return $list;
}