Exemplo n.º 1
0
 public static function renderYouTubePlayer($options, $width, $height, &$videolist_row, &$theme_row, $startsecond, $endsecond)
 {
     $videoidkeyword = '****youtubegallery-video-id****';
     VideoSource_YouTube::ygPlayerTypeController($options, $theme_row);
     $playerapiid = 'ygplayerapiid_' . $videolist_row->id;
     $playerid = 'youtubegalleryplayerid_' . $videolist_row->id;
     $settings = VideoSource_YouTube::ygPlayerPrepareSettings($options, $theme_row, $playerapiid, $startsecond, $endsecond);
     $initial_volume = (int) $theme_row->volume;
     $playlist = '';
     $full_playlist = '';
     $youtubeparams = $options['youtubeparams'];
     $p = explode(';', $youtubeparams);
     if ($options['allowplaylist'] == 1) {
         foreach ($p as $v) {
             $pair = explode('=', $v);
             if ($pair[0] == 'playlist') {
                 $playlist = $pair[1];
             }
             if ($pair[0] == 'fullplaylist') {
                 $full_playlist = $pair[1];
             }
         }
     }
     if ($options['allowplaylist'] != 1 or $options['playertype'] == 5 or $options['playertype'] == 2) {
         $p_new = array();
         foreach ($p as $v) {
             $pair = explode('=', $v);
             if ($pair[0] != 'playlist') {
                 $p_new[] = $v;
             }
         }
         $youtubeparams = implode(';', $p_new);
     }
     YouTubeGalleryMisc::ApplyPlayerParameters($settings, $youtubeparams);
     $settingline = YouTubeGalleryMisc::CreateParamLine($settings);
     if (isset($_SERVER["HTTPS"]) and $_SERVER["HTTPS"] == "on") {
         $http = 'https://';
     } else {
         $http = 'http://';
     }
     if ($theme_row->nocookie) {
         $youtubeserver = $http . 'www.youtube-nocookie.com/';
     } else {
         $youtubeserver = $http . 'www.youtube.com/';
     }
     $result = '';
     switch ($options['playertype']) {
         case 1:
             //new HTML 5 player
             $result = VideoSource_YouTube::ygHTML5Player($width, $height, $youtubeserver, $videoidkeyword, $settingline, $options, $videolist_row->id, $playerid, $theme_row->responsive);
             break;
         case 5:
             //new HTML 5 player API
             $result = VideoSource_YouTube::ygHTML5PlayerAPI($width, $height, $youtubeserver, $videoidkeyword, $settingline, $options, $videolist_row->id, $playerid, $theme_row, $full_playlist, $initial_volume, $playerapiid, false);
             break;
         case 0:
             //Flash AS3.0 Player
             $result = VideoSource_YouTube::ygFlashPlayerWithoutDetection($width, $height, $youtubeserver, $videoidkeyword, $settingline, $options, $videolist_row->id, $playerid, $theme_row->responsive, $playlist);
             break;
         case 2:
             //Flash Player with detection v.3 and v.2, run Iframe Player if no Flash found.
             $result = VideoSource_YouTube::ygHTML5PlayerAPI($width, $height, $youtubeserver, $videoidkeyword, $settingline, $options, $videolist_row->id, $playerid, $theme_row, $full_playlist, $initial_volume, $playerapiid, true);
             $result .= VideoSource_YouTube::ygFlashPlayerWithDetection($width, $height, $youtubeserver, $videoidkeyword, $settingline, $options, $videolist_row->id, $playerid, $theme_row, $full_playlist, $initial_volume, $http, $playerapiid, $startsecond, $endsecond);
             break;
     }
     return $result;
 }