public static function renderVimeoPlayer($options, $width, $height, &$videolist_row, &$theme_row) { $videoidkeyword = '****youtubegallery-video-id****'; $playerid = 'youtubegalleryplayerid_' . $videolist_row->id; $settings = array(); $settings[] = array('loop', (int) $options['repeat']); $settings[] = array('autoplay', (int) $options['autoplay']); if ($options['showinfo'] == 0) { $settings[] = array('portrait', 0); $settings[] = array('title', 0); $settings[] = array('byline', 0); } else { $settings[] = array('portrait', 1); $settings[] = array('title', 1); $settings[] = array('byline', 1); } if ($options['color1'] != '') { $settings[] = array('color', $options['color1']); } if ($options['playertype'] == 100) { if (YouTubeGalleryMisc::check_user_agent_for_apple()) { $options['playertype'] = 1; } else { $options['playertype'] = 0; } //0= Flash } YouTubeGalleryMisc::ApplyPlayerParameters($settings, $options['youtubeparams']); $settingline = YouTubeGalleryMisc::CreateParamLine($settings); $border_width = 3; if ((int) $options['border'] == 1 and $options['color1'] != '') { $width = (int) $width - $border_width * 2; $height = (int) $height - $border_width * 2; } if (isset($_SERVER["HTTPS"]) and $_SERVER["HTTPS"] == "on") { $http = 'https://'; } else { $http = 'http://'; } $vimeoserver = $http . 'vimeo.com/'; if ($options['playertype'] == 1 or $options['playertype'] == 5) { $data = $http . 'player.vimeo.com/video/' . $videoidkeyword . '?' . $settingline; $result = '<iframe src="' . $data . '"'; $result .= '' . ' id="' . $playerid . '"' . ' width="' . $width . '" height="' . $height . '" frameborder="' . (int) $options['border'] . '"' . ($theme_row->responsive == 1 ? ' onLoad="YoutubeGalleryAutoResizePlayer' . $videolist_row->id . '();"' : ''); if ((int) $options['border'] == 1 and $options['color1'] != '') { $result .= ' style="border: ' . $border_width . 'px solid #' . $options['color1'] . '"'; } $result .= '></iframe>'; } elseif ($options['playertype'] == 0 or $options['playertype'] == 3) { //if($options['playertype']==0 or $options['playertype']==3) //Flash AS 2.0 or 3.0 Player //elseif($options['playertype']==0 or $options['playertype']==3) //Flash AS 2.0 or 3.0 Player $data = $vimeoserver . 'moogaloop.swf?clip_id=' . $videoidkeyword . '&' . $settingline; $result = '<object' . ' id="' . $playerid . '"' . ' width="' . $width . '"' . ' height="' . $height . '"' . ' data="' . $data . '"' . ' type="application/x-shockwave-flash"' . ($theme_row->responsive == 1 ? ' onLoad="YoutubeGalleryAutoResizePlayer' . $videolist_row->id . '();"' : '') . '>' . '<param name="id" value="' . $playerid . '" />' . '<param name="movie" value="' . $data . '" />' . '<param name="wmode" value="transparent" />' . '<param name="allowfullscreen" value="' . ($options['fullscreen'] ? 'true' : 'false') . '" />' . '<param name="allowscriptaccess" value="always" />' . '<embed src="' . $data . '"' . ' type="application/x-shockwave-flash"' . ' allowfullscreen="' . ($options['fullscreen'] ? 'true' : 'false') . '"' . ' allowscriptaccess="always"' . ' width="' . $width . '"' . ' height="' . $height . '">' . '</embed>'; $result .= '</object>'; } elseif ($options['playertype'] == 2 or $options['playertype'] == 4) { $data = $vimeoserver . 'moogaloop.swf?clip_id=' . $videoidkeyword . '&' . $settingline; $alternativecode = 'You need Flash player 8+ and JavaScript enabled to view this video.'; //<script src="'.$http.'www.google.com/jsapi" type="text/javascript"></script> $result_head = ' <!-- Youtube Gallery - Vimeo Flash Player With Detection --> <script src="' . $http . 'ajax.googleapis.com/ajax/libs/swfobject/2/swfobject.js" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function youtubegallery_updateplayer_vimeo_' . $videolist_row->id . '(videoid) { var playerVersion = swfobject.getFlashPlayerVersion(); if (playerVersion.major>0) { var playercode=\'' . $result . '\'; playercode=playercode.replace("****youtubegallery-video-id****",videoid); document.getElementById("YoutubeGallerySecondaryContainer' . $videolist_row->id . '").innerHTML=playercode; } else document.getElementById("YoutubeGallerySecondaryContainer' . $videolist_row->id . '").innerHTML="' . $alternativecode . '"; } //]]> </script> <!-- end of Youtube Gallery - Vimeo Flash Player With Detection --> '; $document = JFactory::getDocument(); $document->addCustomTag($result_head); if ($options['videoid'] != '****youtubegallery-video-id****') { $result = ' <script type="text/javascript"> //<![CDATA[ youtubegallery_updateplayer_vimeo_' . $videolist_row->id . '("' . $options['videoid'] . '"); //]]> </script> '; } else { $result = '<!--DYNAMIC PLAYER-->'; } } return $result; }
protected static function ygPlayerTypeController(&$options, &$theme_row) { $initial_volume = (int) $theme_row->volume; if ($options['playertype'] == 100) { //auto $options['playertype'] = 2; } elseif ($options['playertype'] == 4) { //Flash Version 2 is depricated (api) $options['playertype'] = 2; } elseif ($options['playertype'] == 3) { //Flash Version 2 is depricated $options['playertype'] = 0; } //Flash Version 3 //Change to HTML5 if for Apple if ($options['playertype'] == 0) { if (YouTubeGalleryMisc::check_user_agent_for_apple()) { $options['playertype'] = 1; } //Flash Player not supported use IFrame Instead } //Change to HTML5 API if for Apple if ($options['playertype'] == 2) { if (YouTubeGalleryMisc::check_user_agent_for_apple()) { $options['playertype'] = 5; } //Flash Player not supported use IFrame API Instead } //Change to API if needed if ($options['playertype'] == 0) { //Note - not available for IE if (($theme_row->muteonplay or $initial_volume != -1) and $options['playertype'] != 5) { $options['playertype'] = 2; } //because other types of player doesn't support this functionality. } //Change to API if needed if ($options['playertype'] == 1) { //Note - not available for IE if (($theme_row->muteonplay or $initial_volume != -1) and $options['playertype'] != 5) { $options['playertype'] = 5; } //because other types of player doesn't support this functionality. } //Disable API for IE (Flash) if ($options['playertype'] == 2) { if (YouTubeGalleryMisc::check_user_agent_for_ie()) { $options['playertype'] = 0; } //Disable API for IE (so sad!) } //Disable API for IE (IFrame) if ($options['playertype'] == 5) { if (YouTubeGalleryMisc::check_user_agent_for_ie()) { $options['playertype'] = 1; } //Disable API for IE (so sad!) } }