/** * Echo the video embed code, related videos and videos owned by the same user * as the specified videoId. * * @param string $videoId The video */ function echoVideoPlayer($videoId) { $yt = new Zend_Gdata_YouTube(); $entry = $yt->getVideoEntry($videoId); $videoTitle = $entry->mediaGroup->title; $videoUrl = findFlashUrl($entry); $relatedVideoFeed = getRelatedVideos($entry->getVideoId()); $topRatedFeed = getTopRatedVideosByUser($entry->author[0]->name); print <<<END <b>$videoTitle</b><br /> <object width="425" height="350"> <param name="movie" value="${videoUrl}&autoplay=1"></param> <param name="wmode" value="transparent"></param> <embed src="${videoUrl}&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width=425" height="350"></embed> </object> END; echo '<br />'; echoVideoMetadata($entry); echo '<br /><b>Related:</b><br />'; echoThumbnails($relatedVideoFeed); echo '<br /><b>Top rated videos by user:</b><br />'; echoThumbnails($topRatedFeed); }
/** * Echo the video embed code, related videos and videos owned by the same user * as the specified videoId. * * @param string $videoId The video * @return void */ function echoVideoPlayer($videoId) { $youTubeService = new Zend_Gdata_YouTube(); try { $entry = $youTubeService->getVideoEntry($videoId); } catch (Zend_Gdata_App_HttpException $httpException) { print 'ERROR ' . $httpException->getMessage() . ' HTTP details<br /><textarea cols="100" rows="20">' . $httpException->getRawResponseBody() . '</textarea><br />' . '<a href="session_details.php">' . 'click here to view details of last request</a><br />'; return; } $videoTitle = htmlspecialchars($entry->getVideoTitle()); $videoUrl = htmlspecialchars(findFlashUrl($entry)); $relatedVideoFeed = getRelatedVideos($entry->getVideoId()); $topRatedFeed = getTopRatedVideosByUser($entry->author[0]->name); print <<<END <b>{$videoTitle}</b><br /> <object width="425" height="350"> <param name="movie" value="{$videoUrl}&autoplay=1"></param> <param name="wmode" value="transparent"></param> <embed src="{$videoUrl}&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed> </object> END; echo '<br />'; echoVideoMetadata($entry); echo '<br /><b>Related:</b><br />'; echoThumbnails($relatedVideoFeed); echo '<br /><b>Top rated videos by user:</b><br />'; echoThumbnails($topRatedFeed); }