コード例 #1
0
ファイル: Youtube.php プロジェクト: nlegoff/Phraseanet
 /**
  *
  * @param string $element_id
  * @param string $object
  *
  * @return Bridge_Api_Youtube_Element
  */
 public function get_element_from_id($element_id, $object)
 {
     switch ($object) {
         case self::ELEMENT_TYPE_VIDEO:
             return new Bridge_Api_Youtube_Element($this->_api->getVideoEntry($element_id), $object);
             break;
         default:
             throw new Bridge_Exception_ElementUnknown('Unknown element ' . $object);
             break;
     }
 }
コード例 #2
0
ファイル: YoutubeService.php プロジェクト: uhdyi/blacklist
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;
}
コード例 #3
0
ファイル: zendyoutube.php プロジェクト: hoanglannet/copar
 function delete($username, $password, $source, $videoId)
 {
     $httpClient = $this->clientLogin($username, $password, $source);
     $httpClient->setHeaders('X-GData-Key', "key={$source}");
     $yt = new Zend_Gdata_YouTube($httpClient);
     try {
         $videoEntryToDelete = $yt->getVideoEntry($videoId, null, true);
         $result = $yt->delete($videoEntryToDelete);
         return $result;
     } catch (Zend_Gdata_App_HttpException $httpException) {
         echo $httpException->getRawResponseBody();
     } catch (Zend_Gdata_App_Exception $e) {
         echo $e->getMessage();
     }
 }
コード例 #4
0
ファイル: VideoMapper.php プロジェクト: eleclerc/subyt
 /**
  * get a new video from from a youtube url
  *
  * @param $url
  * @return Model_Video video object
  */
 public function getFromYoutube($url)
 {
     $urlArray = parse_url($url);
     if (!isset($urlArray['query'])) {
         throw new Exception('Invalid URL');
     }
     parse_str($urlArray['query'], $query);
     if (!isset($query['v'])) {
         throw new Exception('Invalide YouTube Video URL');
     }
     $youtube_id = $query['v'];
     $yt = new Zend_Gdata_YouTube();
     try {
         $videoEntry = $yt->getVideoEntry($youtube_id);
     } catch (Zend_Gdata_App_HttpException $e) {
         //YouTube may be down too?
         throw new Exception('Invalid YouTube Video URL');
     }
     $data = array('url' => $url, 'youtube_id' => $youtube_id, 'title' => $videoEntry->getTitleValue());
     return new Model_Video($data);
 }
コード例 #5
0
 public function populateFromUrl()
 {
     $urlArray = parse_url($this->getUrl());
     if (!isset($urlArray['query'])) {
         throw new Exception('Invalid URL');
     }
     parse_str($urlArray['query'], $query);
     if (!isset($query['v'])) {
         throw new Exception('Invalide YouTube Video URL');
     }
     $youtube_id = $query['v'];
     $yt = new Zend_Gdata_YouTube();
     try {
         $videoEntry = $yt->getVideoEntry($youtube_id);
     } catch (Zend_Gdata_App_HttpException $e) {
         //YouTube may be down too?
         throw new Exception('Invalid YouTube Video URL');
     }
     $this->youtube_id = $youtube_id;
     $this->youtube_title = $videoEntry->getVideoTitle();
     $this->youtube_description = $videoEntry->getVideoDescription();
     $thumbnails = $videoEntry->getVideoThumbnails();
     $this->youtube_thumbnail = $thumbnails[0]['url'];
 }
コード例 #6
0
 function video()
 {
     $videoId = $this->params['id'];
     $yt = new Zend_Gdata_YouTube();
     $entry = $yt->getVideoEntry($videoId);
     $this->set('videoTitle', $entry->mediaGroup->title);
     $this->set('description', $entry->mediaGroup->description);
     $this->set('authorUsername', $entry->author[0]->name);
     $this->set('authorUrl', 'http://www.youtube.com/profile?user='******'tags', $entry->mediaGroup->keywords);
     $this->set('duration', $entry->mediaGroup->duration->seconds);
     $this->set('watchPage', $entry->mediaGroup->player[0]->url);
     $this->set('viewCount', $entry->statistics->viewCount);
     $this->set('rating', $entry->rating->average);
     $this->set('numRaters', $entry->rating->numRaters);
     /* Get related Videos */
     $ytQuery = $yt->newVideoQuery();
     $ytQuery->setFeedType('related', $videoId);
     $ytQuery->setOrderBy('rating');
     $ytQuery->setMaxResults(5);
     $ytQuery->setFormat(5);
     $this->set('videoId', $videoId);
     $this->set('related', $yt->getVideoFeed($ytQuery));
 }
コード例 #7
0
/**
 * 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);
}
コード例 #8
0
ファイル: Video.php プロジェクト: EntityFX/QuikiJAR
 /**
  * Функция получения видео-файла
  * @param $videoId
  */
 public function getVideo($videoId)
 {
     $yt = new Zend_Gdata_YouTube($this->authYT($username, $password));
     $videoEntry = $yt->getVideoEntry($videoId);
     $resArr = $this->getVideoInfo($videoEntry);
     return $resArr;
 }
コード例 #9
0
ファイル: videos.php プロジェクト: alvaropereyra/shrekcms
 /**
  * Agrega o modifica un video
  * @param boolean $ie6 es Internet Explorer 6
  * @return void 
  */
 function actualizar($ie = NULL)
 {
     $this->load->helper('url');
     $this->load->helper('form');
     $this->load->helper('inflector');
     $this->load->library('combofiller');
     $this->load->library('form_validation');
     $this->form_validation->set_rules($this->_reglas());
     $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
     if ($this->form_validation->run() == FALSE) {
         $data['id'] = $this->input->post('id');
         $data['ret'] = $this->input->post('ret');
         $data['has_category'] = FALSE;
         $data['titulo'] = set_value('titulo');
         $data['texto'] = $this->input->post('texto');
         $data['tags'] = $this->input->post('tags');
         $data['files'] = $this->input->post('files');
         $data['doclink'] = $this->input->post('doclink');
         $data['ie6'] = $ie != NULL ? TRUE : $this->_is_ie6();
         $data['categorias'] = $this->combofiller->categorias();
         foreach ($data['categorias'] as $key => $value) {
             if ($this->input->post('' . $key . '')) {
                 $categorias_selected[] = $key;
             }
         }
         if (isset($categorias_selected)) {
             $data['categorias_selected'] = $categorias_selected == NULL ? NULL : $categorias_selected;
             $data['has_category'] = TRUE;
         } else {
             $data['categorias_selected'] = NULL;
         }
         $data['departamentos'] = $this->combofiller->states(TRUE);
         $data['departamentos_selected'] = NULL;
         $data['provincias_selected'] = NULL;
         $data['distritos_selected'] = NULL;
         if ($this->input->post('departamento') != 'null') {
             $data['departamentos_selected'] = $this->input->post('departamento');
         }
         if ($this->input->post('provincia') != NULL) {
             $data['provincias'] = $this->combofiller->provinces($this->input->post('departamento'), TRUE);
             if ($this->input->post('provincia') != 'null') {
                 $data['provincias_selected'] = $this->input->post('provincia');
             }
         }
         if ($this->input->post('distrito') != NULL) {
             $data['distritos'] = $this->combofiller->districts($this->input->post('provincia'), TRUE);
             if ($this->input->post('distrito') != 'null') {
                 $data['distritos_selected'] = $this->input->post('distrito');
             }
         }
         $data['paices'] = $this->combofiller->countries();
         $data['paices_selected'] = $this->input->post('pais');
         $data['localizar'] = $this->input->post('localizar');
         $data['form'] = $this->form;
         $this->load->view('videos/video', $data);
         $this->__destruct();
     } else {
         $this->load->model('countries');
         $this->load->model('states');
         $this->load->model('districts');
         $this->load->model('provinces');
         $this->load->model('options');
         $this->load->model('postmeta');
         $this->load->model('post');
         $this->load->model('term_relationships');
         $this->load->model('terms');
         $id = $this->input->post('id');
         $data['post_title'] = $this->input->post('titulo');
         $data['post_content'] = "<p>" . $this->input->post('texto') . "</p>";
         $data['tags'] = $this->input->post('tags');
         $this->load->library('zend');
         $this->zend->load('Zend/Gdata/YouTube');
         $this->zend->load('Zend/Gdata/ClientLogin');
         $authenticationURL = 'https://www.google.com/youtube/accounts/ClientLogin';
         $httpClient = Zend_Gdata_ClientLogin::getHttpClient($username = '******', $password = '******', $service = 'youtube', $client = null, $source = 'LaMulaSRD', $loginToken = null, $loginCaptcha = null, $authenticationURL);
         $clientId = "ytapi-AlvaroPereyraRab-WebPublishing-afg0bc0f-0";
         $developerKey = "AI39si77SKdfoJ3spb7HZHe_tUVcOKX_TAn7Fne7BU8ux6ixJ6E8ZdNmZ7UeJs7y3ZGOfVyNAzSe4nYJqIX3Lu7RNryf-dOn9A";
         $httpClient->setHeaders('X-GData-Key', "key={$developerKey}");
         $applicationId = "SRD-LaMula-1.0";
         $yt = new Zend_Gdata_YouTube($httpClient);
         switch ($this->input->post('upload-content')) {
             //subir documentos
             case 'subir':
                 if ($this->_is_ie6() == TRUE or $ie != null) {
                     if ($_FILES['Filedata']['error'] == 0) {
                         $aceptados = array('video/quicktime', 'video/mpeg');
                         if (in_array($_FILES['Filedata']['type'], $aceptados)) {
                             $docs_id[] = $this->_upload($ie);
                             if (is_null($docs_id[0])) {
                                 //error y debo redireccionar
                                 $this->load->library('session');
                                 $this->session->set_flashdata('fileupload', 'Error en la carga');
                                 redirect('videos/formulario');
                             }
                         } else {
                             $this->load->library('session');
                             $this->session->set_flashdata('fileupload', 'Error en la carga');
                             redirect('videos/formulario');
                         }
                     }
                 } else {
                     $docs_id = split('-', $this->input->post('files'));
                     unset($docs_id[0]);
                 }
                 foreach ($docs_id as $doc) {
                     $youtube = substr($doc, 31);
                     $videoEntry = $yt->getVideoEntry($youtube);
                     $videoThumbnails = $videoEntry->getVideoThumbnails();
                     $photo_url = $videoThumbnails[0]["url"];
                     $tmp = '<img rel="from_video" class="alignnone fromvideo" src="' . $photo_url . '" />';
                     $tmp .= '<br />';
                     $tmp .= "[youtube]";
                     $tmp .= $doc;
                     $tmp .= '[/youtube]';
                     $data['post_content'] = $tmp . $data['post_content'];
                 }
                 break;
                 //enlazar
             //enlazar
             case 'enlazar':
                 $url = $this->input->post('doclink');
                 $youtube = substr($url, 31);
                 $videoEntry = $yt->getVideoEntry($youtube);
                 $videoThumbnails = $videoEntry->getVideoThumbnails();
                 $photo_url = $videoThumbnails[0]["url"];
                 $tmp = '<img rel="from_video" class="alignnone fromvideo" src="' . $photo_url . '" />';
                 $tmp .= '[youtube]' . $url . '[/youtube]';
                 $tmp .= '<br />';
                 $data['post_content'] .= $tmp;
                 break;
         }
         //$data['post_content'] = $data['post_content'];
         //consigue los id de las cata
         $this->load->library('combofiller');
         $categorias = $this->combofiller->categorias();
         $terms_taxonomy_id = NULL;
         foreach ($categorias as $key => $value) {
             if ($this->input->post('' . $key . '')) {
                 $terms_taxonomy_id[] = $key;
             }
         }
         switch ($this->input->post('localizar')) {
             case 'mundo':
                 $tmp = array('pais');
                 break;
             case 'peru':
                 $tmp = array('provincia', 'distrito', 'departamento');
                 break;
         }
         foreach ($tmp as $custom) {
             if ($this->input->post($custom) != NULL) {
                 $customs[$custom] = sanitize2url($this->input->post($custom));
             }
         }
         $data['terms_taxonomy_id'] = $terms_taxonomy_id;
         if ($id == NULL) {
             $post_id = $this->post->insert_article($data, $customs);
             $this->term_relationships->insertar($post_id, array(32));
         } else {
             $where['id'] = $id;
             $this->post->actualizar($data, $customs, $where);
             $this->session->set_flashdata('notice', 'Documento actualizado exitosamente');
             redirect('home/dashboard');
         }
         $this->session->set_flashdata('notice', 'Video enviado exitosamente');
         redirect('home/dashboard');
     }
 }
コード例 #10
0
ファイル: functions.php プロジェクト: danielheyman/EazySubs
function comment($entry, $comment)
{
    $username = $_SESSION['username'];
    $query = "select token from user where username='******'";
    $result = mysql_query($query);
    $row = mysql_fetch_array($result);
    $token = $row['token'];
    $httpClient = Zend_Gdata_AuthSub::getHttpClient($token);
    $developerKey = 'AI39si5uCFW5FETweIaPnbNJUP88YvpOtSoy7FSUnYnTFVH4liFKzqWTkndATtgiltByN54tPcVjsScyh3S28P-D4PC4n73alg';
    $applicationId = 'EazySubs';
    $clientId = 'EazySubs';
    $yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
    try {
        $videoEntry = $yt->getVideoEntry($entry);
        $newComment = $yt->newCommentEntry();
        $newComment->content = $yt->newContent()->setText($comment);
        // post the comment to the comments feed URL for the video
        $commentFeedPostUrl = $videoEntry->getVideoCommentFeedUrl();
        $updatedVideoEntry = $yt->insertEntry($newComment, $commentFeedPostUrl, 'Zend_Gdata_YouTube_CommentEntry');
        return true;
    } catch (Exception $e) {
        return false;
    }
}
コード例 #11
0
ファイル: video.php プロジェクト: sauravpratihar/fcms
 /**
  * displayRemoveVideoSubmit 
  * 
  * Remove video doesn't actually physically delete the video from FCMS, it 
  * just sets the video to in-active in the DB, which removes it from view.
  * 
  * We don't want to delete these entries from the db, because the cron importer
  * will just continue to import them.
  * 
  * @return void
  */
 function displayRemoveVideoSubmit()
 {
     if (!isset($_POST['id']) || !isset($_POST['source_id'])) {
         $this->displayHeader();
         echo '<div class="error_alert">' . T_('Can\'t remove video.  Missing video id.') . '</div>';
         $this->displayFooter();
         return;
     }
     $userId = (int) $_GET['u'];
     $id = (int) $_POST['id'];
     $sourceId = $_POST['source_id'];
     $sql = "UPDATE `fcms_video`\n                SET `active` = 0,\n                    `updated` = NOW(),\n                    `updated_id` = ?\n                WHERE `id` = ?";
     if (!$this->fcmsDatabase->update($sql, array($this->fcmsUser->id, $id))) {
         $this->displayFooter();
         $this->fcmsError->displayError();
         $this->displayFooter();
         return;
     }
     if (isset($_POST['delete_youtube'])) {
         $sessionToken = $this->getSessionToken($this->fcmsUser->id);
         $youtubeConfig = getYouTubeConfigData();
         $httpClient = getYouTubeAuthSubHttpClient($youtubeConfig['youtube_key'], $sessionToken);
         if ($httpClient === false) {
             // Error message was already displayed by getYouTubeAuthSubHttpClient()
             $this->displayFooter();
             return;
         }
         $youTubeService = new Zend_Gdata_YouTube($httpClient);
         $videoEntry = $youTubeService->getVideoEntry($sourceId);
         // Set message
         $_SESSION['message'] = 'delete_video_youtube';
         $youTubeService->delete($videoEntry);
     }
     // Set message
     if (!isset($_SESSION['message'])) {
         $_SESSION['message'] = 'remove_video';
     }
     // Send back to user's video listing
     header("Location: video.php?u={$userId}");
 }
コード例 #12
0
ファイル: IndexController.php プロジェクト: hoalangoc/ftf
 public function handleInformation($type, $code)
 {
     switch ($type) {
         //youtube
         case "1":
             $yt = new Zend_Gdata_YouTube();
             $youtube_video = $yt->getVideoEntry($code);
             $information = array();
             $information['title'] = $youtube_video->getTitle();
             $information['description'] = $youtube_video->getVideoDescription();
             $information['duration'] = $youtube_video->getVideoDuration();
             //http://img.youtube.com/vi/Y75eFjjgAEc/default.jpg
             return $information;
             //vimeo
         //vimeo
         case "2":
             //thumbnail_medium
             $data = simplexml_load_file("http://vimeo.com/api/v2/video/" . $code . ".xml");
             $thumbnail = $data->video->thumbnail_medium;
             $information = array();
             $information['title'] = $data->video->title;
             $information['description'] = $data->video->description;
             $information['duration'] = $data->video->duration;
             //http://img.youtube.com/vi/Y75eFjjgAEc/default.jpg
             return $information;
     }
 }
コード例 #13
0
function player_shortcode($atts)
{
    $username = get_option('youtube_user');
    //gets the username that was entered in the admin screen
    //declares the attributes for the video player shortcode
    $atts = shortcode_atts(array('width' => '450', 'height' => '253', 'videocode' => '', 'description' => 'yes', 'title' => 'yes', 'descriptionlength' => '1000', 'classname' => ''), $atts);
    global $descriptionlength;
    //makes $descriptionlength a global variable so the right length descriptions can be passed from the feed function
    $descriptionlength = $atts['descriptionlength'];
    //assigns $descriptionlength the desired value.
    //YouTube classes for Gdata
    $yt = new Zend_Gdata_YouTube();
    $yt->setMajorProtocolVersion(2);
    //if there is a defined video to display on page load, load that video.
    if ($atts['videocode'] != '') {
        $videoEntry = $yt->getVideoEntry($atts['videocode']);
        //get Gdata for all the desired video
        $descriptionlong = $videoEntry->getVideoDescription();
        $description = substr($descriptionlong, 0, $atts['descriptionlength']) . "...";
        //description set to the desired length
        //print HTML for the video player
        $videoplayer = '<div id="playerchart" class="' . $atts['classname'] . '" >';
        if ($atts['title'] == 'yes' || $atts['title'] == 'true') {
            $videoplayer = $videoplayer . '<div id="titlediv" ><b class="title_player" id="title_player">' . $titleplayer . '</b></div>';
        }
        $videoplayer = $videoplayer . '<div class="video_player"><iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" id="playingvideo" src="http://www.youtube.com/embed/' . $atts['videocode'] . '" frameborder="0" allowfullscreen></iframe></div>';
        if ($atts['description'] == 'yes' || $atts['description'] == 'true') {
            $videoplayer = $videoplayer . '<div class="player_description" id="player_description">' . $description . '</div>';
        }
        $videoplayer = $videoplayer . '</div>';
        return $videoplayer;
        goto a;
        //skip out the rest of the function
    } else {
        $url = 'http://gdata.youtube.com/feeds/api/users/' . $username . '/uploads?orderby=viewCount&max-results=1';
        //url for video feed of one video
    }
    Zend_Loader::loadClass('Zend_Gdata_YouTube');
    $videoFeed = @$yt->getVideoFeed($url);
    //create feed from URL
    //loop through feed
    foreach ($videoFeed as $videoEntry) {
        $descriptionlong = $videoEntry->getVideoDescription();
        //get video description
        $titleplayer = $videoEntry->getVideoTitle();
        //get video title
        //change video length if longer than desired amount
        if (strlen($descriptionlong) > $atts['descriptionlength']) {
            $descriptionlong = $videoEntry->getVideoDescription();
            $description = substr($descriptionlong, 0, $atts['descriptionlength']) . "...";
            //... to the end of cut description
        } else {
            $description = $videoEntry->getVideoDescription();
            //if description is shorter than maximum amount assign full description
        }
        //print video player from feed data
        $videoplayer = '<div id="playerchart" class="' . $atts['classname'] . '" >';
        $videoplayer = $videoplayer . '<div id="titlediv" ><b id="title_player">' . $titleplayer . '</b></div>';
        $videoplayer = $videoplayer . '<div style="margin-right:20px;"><iframe width="450" height="253" id="playingvideo" src="http://www.youtube.com/embed/' . $videoEntry->getVideoId() . '" frameborder="0" allowfullscreen></iframe></div>';
        $videoplayer = $videoplayer . '<div id="player_description">' . $description . '</div>';
        $videoplayer = $videoplayer . '</div>';
        return $videoplayer;
        break;
        //end the loop after one cycle to make sure only one player appears.
    }
    a:
    //where the process skips to if specific video is defined for page load.
}
コード例 #14
0
 /**
  * getselectedvideoAction
  * @author Dominik Mößlang <*****@*****.**>
  * @version 1.0
  */
 public function getselectedvideoAction()
 {
     $this->core->logger->debug('core->controllers->VideoController->getselectedvideoAction()');
     $strVideoTypeName = '';
     $intVideoTypeId = '';
     $objSelectedVideo = '';
     try {
         $objRequest = $this->getRequest();
         $intChannelId = $objRequest->getParam('channelId');
         $strElementId = $objRequest->getParam('elementId');
         $strValue = $objRequest->getParam('value');
         $strChannelUserId = $objRequest->getParam('channelUserId');
         $arrSelectedVideo = array();
         switch ($intChannelId) {
             /**
              * Vimeo Controller
              */
             case $this->core->sysConfig->video_channels->vimeo->id:
                 require_once GLOBAL_ROOT_PATH . 'library/vimeo/vimeo.class.php';
                 $intVideoTypeId = 1;
                 $strVideoTypeName = "Vimeo";
                 /**
                  * Get the selected Video
                  */
                 if (isset($strValue)) {
                     $objResponse = VimeoVideosRequest::getInfo($strValue);
                     $objSelectedVideo = $objResponse->getVideo();
                 }
                 break;
                 /**
                  * Youtube Controller
                  */
             /**
              * Youtube Controller
              */
             case $this->core->sysConfig->video_channels->youtube->id:
                 $intVideoTypeId = 2;
                 $strVideoTypeName = "YouTube";
                 $objResponse = new Zend_Gdata_YouTube();
                 $objResponse->setMajorProtocolVersion(2);
                 /**
                  * Get the selected Video
                  */
                 if (isset($strValue)) {
                     $objSelectedVideo = $objResponse->getVideoEntry($strValue);
                 }
                 break;
         }
         $this->view->strVideoTypeName = $strVideoTypeName;
         $this->view->intVideoTypeId = $intVideoTypeId;
         $this->view->objSelectedVideo = $objSelectedVideo;
         $this->view->strValue = $strValue;
         $this->view->strElementId = $strElementId;
         $this->view->strChannelUserId = $strChannelUserId;
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
         exit;
     }
 }
コード例 #15
0
ファイル: index.php プロジェクト: jorgenils/zend-framework
/**
 * 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); 
}
コード例 #16
0
ファイル: upload_srts.php プロジェクト: tpsy/class2go
<?php

require_once '/usr/share/php/libzend-framework-php/Zend/Gdata.php';
require_once '/usr/share/php/libzend-framework-php/Zend/Gdata/ClientLogin.php';
require_once '/usr/share/php/libzend-framework-php/Zend/Gdata/YouTube.php';
// Enter your Google account credentials
$username = '******';
$passwd = 'parseitup';
$authenticationURL = 'https://www.google.com/accounts/ClientLogin';
try {
    $httpClient = Zend_Gdata_ClientLogin::getHttpClient($username, $passwd, $service = 'youtube', $client = null, $source = 'MySource', $loginToken = null, $loginCaptcha = null, $authenticationURL);
} catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
    echo 'URL of CAPTCHA image: ' . $cre->getCaptchaUrl() . "\n";
    echo 'Token ID: ' . $cre->getCaptchaToken() . "\n";
} catch (Zend_Gdata_App_AuthException $ae) {
    echo 'Problem authenticating: ' . $ae->exception() . "\n";
}
$developerKey = "AI39si5GlWcy9S4eVFtajbVZk-DjFEhlM4Zt7CYzJG3f2bwIpsBSaGd8SCWts6V5lbqBHJYXAn73-8emsZg5zWt4EUlJJ4rpQA";
$applicationId = "class2go";
$clientId = "";
$yt = new Zend_Gdata_YouTube($httpClient, $applicationId, $clientId, $developerKey);
$yt->setMajorProtocolVersion(2);
$dirs_ary = glob('*', GLOB_ONLYDIR);
foreach ($dirs_ary as $dir) {
    $myVideoEntry = new Zend_Gdata_YouTube_VideoEntry();
    $filestring = file_get_contents($dir . '/vidID.json');
    $vidID = substr($filestring, 1, -1);
    echo "{$dir}: {$vidID}\n";
    $videoEntry = $yt->getVideoEntry($vidID);
    echo 'Edit: ' . $videoEntry->getVideoWatchPageUrl() . "\n";
}
コード例 #17
0
 /**
  * Get VideoEntry from a videoId
  * @param string $videoId
  * @return Zend_Gdata_YouTube_VideoEntry
  */
 public function getVideo($videoId)
 {
     return $this->yt->getVideoEntry($videoId);
 }