diff --git a/admin/helpers/html/fancybox.php b/admin/helpers/html/fancybox.php index c3072b07b..684395287 100644 --- a/admin/helpers/html/fancybox.php +++ b/admin/helpers/html/fancybox.php @@ -47,7 +47,7 @@ public static function framework($option = false, $mouseweel = false) } HTMLHelper::_('jquery.framework'); - HTMLHelper::_('jwplayer.framework'); + // HTMLHelper::_('jwplayer.framework'); HTMLHelper::script('media/com_proclaim/fancybox/jquery.fancybox.min.js'); HTMLHelper::script('media/com_proclaim/js/fancybox.min.js'); diff --git a/site/src/Helper/CWMMedia.php b/site/src/Helper/CWMMedia.php index dc93b3a7d..a5fc46018 100644 --- a/site/src/Helper/CWMMedia.php +++ b/site/src/Helper/CWMMedia.php @@ -659,6 +659,15 @@ public function getPlayerCode(Registry $params, object $player, string $image, o switch ($player->type) { + case 1: // Popup window + $playercode = "toObject()->player . + "&view=cwmpopup&t=" . $template . "&mediaid=" . $media->id . "&tmpl=component', 'newwindow','width=" . + $player->playerwidth . ",height=" . $player->playerheight . "'); return false\" class=\"jbsmplayerlink\">" + . $image . ""; + break; + case 2: // New window - popup code added here because new window code does not work (Tom 10-12-2022) $return = base64_encode($path); $playercode = 'toObject()->player . - "&view=cwmpopup&t=" . $template . "&mediaid=" . $media->id . "&tmpl=component', 'newwindow','width=" . - $player->playerwidth . ",height=" . $player->playerheight . "'); return false\" class=\"jbsmplayerlink\">" - . $image . ""; - break; } return $playercode; - case 7: + case 7: // legacy internal player case 1: // Internal $playercode = ''; switch ($player->type) { - case 3: // Squeezebox view - - return $this->rendersb($media, $params, $player, $image, $path); + case 1: // Popup + // Add space for popup window + $diff = $params->get('player_width') - $params->get('playerwidth'); + $player->playerwidth += abs($diff) + 10; + $player->playerheight += $params->get('popupmargin', '50'); + $playercode = "player + . "&view=cwmpopup&t=" . $template . "&mediaid=" . $media->id . "&tmpl=component', 'newwindow', 'width=" + . $player->playerwidth . ", height=" . + $player->playerheight . "'); return false\" class=\"jbsmplayerlink\">" . $image . ""; break; case 2: // Inline @@ -728,17 +736,9 @@ public function getPlayerCode(Registry $params, object $player, string $image, o break; - case 1: // Popup - // Add space for popup window - $diff = $params->get('player_width') - $params->get('playerwidth'); - $player->playerwidth += abs($diff) + 10; - $player->playerheight += $params->get('popupmargin', '50'); - $playercode = "player - . "&view=cwmpopup&t=" . $template . "&mediaid=" . $media->id . "&tmpl=component', 'newwindow', 'width=" - . $player->playerwidth . ", height=" . - $player->playerheight . "'); return false\" class=\"jbsmplayerlink\">" . $image . ""; + case 3: // Squeezebox view + + return $this->rendersb($media, $params, $player, $image, $path); break; } @@ -761,6 +761,8 @@ public function getPlayerCode(Registry $params, object $player, string $image, o $mediacode = $this->getAVmediacode($media->mediacode, $media); $playercode = HtmlHelper::_('content.prepare', $mediacode); break; + + // no squeezebox available } return $playercode; @@ -802,7 +804,7 @@ public function rendersb(object $media, Registry $params, object $player, string { HtmlHelper::_('fancybox.framework', true, true); - if ($player->player === '7' && !$direct) + if (($player->player === '7' && !$direct) || (preg_match('/audio/', $media->params->get('mime_type')) === 1 && $direct)) { $player->playerheight = '40'; } @@ -818,12 +820,27 @@ public function rendersb(object $media, Registry $params, object $player, string if (preg_match('(youtube.com|youtu.be|vimeo.com)', $path) === 1) { + HTMLHelper::_('jwplayer.framework'); + return 'get('autostart', false) . '", "controls" : "' . (int) $params->get('controls') . '", "caption" : "' . $media->studytitle . ' - ' . $media->teachername . '"}\' href="javascript:;">' . $image . ''; } + if ($direct) + { + // use data-type=video for both video and audio, this is a suggestion of fancyapps. See issue 2244 in github project fancybox + return 'get('controls') . + '", "caption" : "' . $media->studytitle . ' - ' . $media->teachername . + '"}\' href="javascript:;">' . $image . ''; + } + + HTMLHelper::_('jwplayer.framework'); + return '