Fix jplayer

1.10.x
Julio Montoya 9 years ago
parent d5fc0aa2fe
commit c0908defcd
  1. 47
      main/document/showinframes.php
  2. 8
      main/inc/lib/display.lib.php
  3. 47
      main/inc/lib/document.lib.php

@ -104,7 +104,7 @@ if (!api_is_allowed_to_edit() && !$is_visible) {
}
$pathinfo = pathinfo($header_file);
$jplayer_supported_files = array('mp4', 'ogv','flv');
$jplayer_supported_files = array('mp4', 'ogv', 'flv', 'm4v');
$jplayer_supported = false;
if (in_array(strtolower($pathinfo['extension']), $jplayer_supported_files)) {
@ -250,33 +250,38 @@ if ($isChatFolder) {
}
$execute_iframe = true;
if ($jplayer_supported) {
$extension = api_strtolower($pathinfo['extension']);
if ($extension == 'mp4') {
$extension = 'm4v';
}
$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
$htmlHeadXtra[] = '<link rel="stylesheet" href="'.$js_path.'jquery-jplayer/skin/blue.monday/css/jplayer.blue.monday.css" type="text/css">';
$htmlHeadXtra[] = '<script type="text/javascript" src="'.$js_path.'jquery-jplayer/jplayer/jquery.jplayer.min.js"></script>';
$jquery = ' $("#jquery_jplayer_1").jPlayer({
ready: function() {
$(this).jPlayer("setMedia", {
'.$extension.' : "'.$document_data['direct_url'].'"
});
},
errorAlerts: false,
warningAlerts: false,
swfPath: "'.$js_path.'jquery-jplayer/jplayer/",
//supplied: "m4a, oga, mp3, ogg, wav",
supplied: "'.$extension.'",
//wmode: "window",
solution: "flash, html", // Do not change this setting
cssSelectorAncestor: "#jp_container_1",
});';
$jquery = '
$("#jquery_jplayer_1").jPlayer({
ready: function() {
$(this).jPlayer("setMedia", {
'.$extension.' : "'.$document_data['direct_url'].'"
});
},
cssSelectorAncestor: "#jp_container_1",
swfPath: "'.$js_path.'jquery-jplayer/jplayer/",
supplied: "'.$extension.'",
useStateClassSkin: true,
autoBlur: false,
smoothPlayBar: true,
keyEnabled: false,
remainingDuration: true,
toggleDuration: true
});
';
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
//Experimental changes to preview mp3, ogg files
'.$jquery.'
'.$jquery.'
});
</script>';
$execute_iframe = false;
@ -356,9 +361,11 @@ if ($show_web_odf) {
echo '</div>';
if ($jplayer_supported) {
echo '<br /><div class="span12" style="margin:0 auto; width:100%; text-align:center;">';
echo '<br /><div class="span12" style="margin:0 auto 0 auto; width:640px; text-align:center;">';
echo DocumentManager::generate_video_preview($document_data);
echo '</div>';
// media_element blocks jplayer disable it
Display::$global_template->assign('show_media_element', 0);
}
if ($is_freemind_available) {
@ -442,7 +449,7 @@ if ($execute_iframe) {
$content = Security::remove_XSS(file_get_contents($file_url_sys));
echo $content;
} else {
echo '<iframe id="mainFrame" name="mainFrame" border="0" frameborder="0" scrolling="no" style="width:100%;" height="600" src="'.$file_url_web.'&rand='.mt_rand(1, 10000).'" height="500" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>';
echo '<iframe id="mainFrame" name="mainFrame" border="0" frameborder="0" scrolling="no" style="width:100%;" height="600" src="'.$file_url_web.'&rand='.mt_rand(1, 10000).'" height="500" allowfullscreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>';
}
}
Display::display_footer();

@ -20,7 +20,7 @@ use ChamiloSession as Session;
*/
class Display
{
/* The main template*/
/** @var Template */
public static $global_template;
public static $preview_style = null;
@ -756,12 +756,12 @@ class Display
}
$icon = api_get_cdn_path($icon);
if ($return_only_path) {
return $icon;
}
$img = self::img($icon, $alt_text, $additional_attributes);
if (SHOW_TEXT_NEAR_ICONS == true and !empty($alt_text)) {
if ($show_text) {

@ -3199,15 +3199,15 @@ class DocumentManager
* @param array $document_data
* @return string
*/
static function generate_video_preview($document_data = array())
public static function generate_video_preview($document_data = array())
{
$html = '
<div id="jp_container_1" class="jp-video">
<div id="jp_container_1" class="jp-video" role="application" aria-label="media player">
<div class="jp-type-single">
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
<a href="javascript:;" class="jp-video-play-icon" tabindex="1">play</a>
<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
</div>
<div class="jp-interface">
<div class="jp-progress">
@ -3215,30 +3215,27 @@ class DocumentManager
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time"></div>
<div class="jp-current-time" role="timer" aria-label="time">&nbsp;</div>
<div class="jp-duration" role="timer" aria-label="duration">&nbsp;</div>
<div class="jp-controls-holder">
<ul class="jp-controls">
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
<li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li>
<li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li>
<li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li>
<li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li>
</ul>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
<ul class="jp-toggles">
<li><a href="javascript:;" class="jp-full-screen" tabindex="1" title="full screen">full screen</a></li>
<li><a href="javascript:;" class="jp-restore-screen" tabindex="1" title="restore screen">restore screen</a></li>
<li><a href="javascript:;" class="jp-repeat" tabindex="1" title="repeat">repeat</a></li>
<li><a href="javascript:;" class="jp-repeat-off" tabindex="1" title="repeat off">repeat off</a></li>
</ul>
<div class="jp-controls">
<button class="jp-play" role="button" tabindex="0">play</button>
<button class="jp-stop" role="button" tabindex="0">stop</button>
</div>
<div class="jp-volume-controls">
<button class="jp-mute" role="button" tabindex="0">mute</button>
<button class="jp-volume-max" role="button" tabindex="0">max volume</button>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
</div>
<div class="jp-toggles">
<button class="jp-repeat" role="button" tabindex="0">repeat</button>
<button class="jp-full-screen" role="button" tabindex="0">full screen</button>
</div>
</div>
<div class="jp-title">
<ul>
<li>' . $document_data['title'] . '</li>
</ul>
<div class="jp-details">
<div class="jp-title" aria-label="title">&nbsp;</div>
</div>
</div>
</div>

Loading…
Cancel
Save