Skip to content
Browse files

v0.3 - Output cleanup.

  • Loading branch information...
1 parent d66cefa commit 8bc4e833ac907c8c2879bdf4d529747e1a69b397 @emirpprime committed
View
10 Joomla 1.5/language/en-GB.plg_content_pb_mediael.ini
@@ -2,7 +2,7 @@
# License GNU/GPL http://www.gnu.org/copyleft/gpl.html
# pb_mediael.xml
-PLUGIN DESC=<h1>pb:MediaEl 0.2 [Plugin]</h1><strong>Based on Media Element.JS 2.2.3 (<a href="http://mediaelementjs.com" title="Homepage of Media Element.JS" target="_blank">http://mediaelementjs.com</a>)</strong><p><strong>Description:</strong><br />Content Plugin which provides a HTML5 Video Player for Joomla! 1.5.</p><p><strong>Syntax:</strong><br />Place the following code in an article: <pre wrap="wrap">{pb_mediael media=[video] width=[640] height=[480] autoplay=[true] preload=[true] loop=[true] video_mp4=[http://video-js.zencoder.com/oceans-clip.mp4] video_webm=[http://video-js.zencoder.com/oceans-clip.webm] video_ogg=[http://video-js.zencoder.com/oceans-clip.ogg] flash=[http://video-js.zencoder.com/oceans-clip.mp4] image=[http://video-js.zencoder.com/oceans-clip.png] image_visibility=[true]}</pre></p><p>These are all parameters. Minimum required is media, width, height and a source file.</p>
+PLUGIN DESC=<h1>pb:MediaEl 0.3 [Plugin]</h1><strong>Based on Media Element.JS 2.2.3 (<a href="http://mediaelementjs.com" title="Homepage of Media Element.JS" target="_blank">http://mediaelementjs.com</a>)</strong><p><strong>Description:</strong><br />Content Plugin which provides a HTML5 Video Player for Joomla! 1.5.</p><p><strong>Syntax:</strong><br />Place the following code in an article: <pre wrap="wrap">{pb_mediael media=[video] width=[640] height=[480] autoplay=[true] preload=[true] loop=[true] video_mp4=[http://video-js.zencoder.com/oceans-clip.mp4] video_webm=[http://video-js.zencoder.com/oceans-clip.webm] video_ogg=[http://video-js.zencoder.com/oceans-clip.ogg] flash=[http://video-js.zencoder.com/oceans-clip.mp4] image=[http://video-js.zencoder.com/oceans-clip.png] image_visibility=[true]}</pre></p><p>These are all parameters. Minimum required is media, width, height and a source file.</p>
# Video
DEFAULT AUDIO PARAMETER=<strong>Audio Parameter</strong>
@@ -18,15 +18,15 @@ LABEL VIDEO MP4=Video [mp4]
LABEL VIDEO WEBM=Video [webm]
LABEL VIDEO OGG=Video [ogg]
LABEL FLASH=Flash Fallback [mp4]
-LABEL IMAGE=Poster Image
-LABEL IMAGE VISIBILITY=Image visible
+LABEL IMAGE=Poster / Fallback Image
+LABEL IMAGE VISIBILITY=Poster / Fallback visible
DESC VIDEO MP4=Default video [mp4]. Leave blank for no default Video.
DESC VIDEO WEBM=Default video [webm]. Leave blank for no default Video.
DESC VIDEO OGG=Default video [ogg]. Leave blank for no default Video.
DESC FLASH=If video cannot display in HTML5, here you can set a default fallback video for flash. Leave blank for no default flash video.
-DESC IMAGE=Default poster image. Types: gif, jpg, png.
-DESC IMAGE VISIBILITY=Hide/display the poster image.
+DESC IMAGE=Default poster / fallback image. Types: gif, jpg, png.
+DESC IMAGE VISIBILITY=Hide/display the poster/fallback image.
# Player
DEFAULT PLAYER PARAMETER=<strong>Player Parameter</strong>
View
79 Joomla 1.5/pb_mediael.php
@@ -21,6 +21,21 @@ function pluginPbMediaEl(&$row, &$params) {
if (!empty($hits)) {
$document =& JFactory::getDocument();
+
+ // Check if mediaelsentials stylesheets are loaded
+ $styleSheets = array_keys($document->_styleSheets);
+
+ $foundmediaelStyles = false;
+ for ($i = 0; $i<count($styleSheets); $i++) {
+ if (stripos($styleSheets[$i], 'mediaelementplayer.css') !== false) {
+ $foundmediaelStyles = true;
+ }
+ }
+ if (!$foundmediaelStyles) {
+ $document->addStyleSheet(JURI::base().'plugins/content/pb_mediael/mediaelementplayer.css');
+ }
+
+
// Check if mediaelsentials script is loaded
$scripts = array_keys($document->_scripts);
$foundJqueryScripts = false;
@@ -47,51 +62,31 @@ function pluginPbMediaEl(&$row, &$params) {
$foundMediaeljsScripts = true;
}
}
- if (!$foundMediaelJScripts) {
-
-
- for ($i=$GLOBALS['plg_pb_mediael']; $i<$GLOBALS['plg_pb_mediael']+$hits; $i++) {
- $document->addScriptDeclaration('
- var $j = jQuery.noConflict();
- $j(document).ready(function() {
- //$j(".PbMediaEl").hide();
- $j("video,audio").mediaelementplayer({
- startVolume: '.$pluginParams->get('defaultVolume', '0.85').',
- enableAutosize: true,
- });
- });
- ');
+ $document->addScriptDeclaration(' var $j = jQuery.noConflict();
+ $j(document).ready(function() {
+ $j("video,audio").mediaelementplayer({
+ startVolume: '.$pluginParams->get('defaultVolume', '0.85').',
+ enableAutosize: true,
+ });
+ });');
- for ($j=0; $j<$hits; $j++) {
- $videoParams = $matches[1][$j];
- $videoParamsList = contentPbMediaEl_getParams($videoParams, $pluginParams);
- $html = contentPbMediaEl_createHTML($i+$j, $pluginParams, $videoParamsList);
- $pattern = str_replace('[', '\[', $matches[0][$j]);
- $pattern = str_replace(']', '\]', $pattern);
- $pattern = str_replace('/', '\/', $pattern);
- $row->text = preg_replace('/'.$pattern.'/', $html, $row->text, 1);
+ // Parse shortcodes in content
+ for ($i=$GLOBALS['plg_pb_mediael']; $i<$GLOBALS['plg_pb_mediael']+$hits; $i++) {
+ for ($j=0; $j<$hits; $j++) {
+ $videoParams = $matches[1][$j];
+ $videoParamsList = contentPbMediaEl_getParams($videoParams, $pluginParams);
+ $html = contentPbMediaEl_createHTML($i+$j, $pluginParams, $videoParamsList);
+ $pattern = str_replace('[', '\[', $matches[0][$j]);
+ $pattern = str_replace(']', '\]', $pattern);
+ $pattern = str_replace('/', '\/', $pattern);
+ $row->text = preg_replace('/'.$pattern.'/', $html, $row->text, 1);
+ }
}
- }
-
- }
// Count instances
$GLOBALS['plg_pb_mediael'] += $hits;
-
- // Check if mediaelsentials stylesheets are loaded
- $styleSheets = array_keys($document->_styleSheets);
-
- $foundmediaelStyles = false;
- for ($i = 0; $i<count($styleSheets); $i++) {
- if (stripos($styleSheets[$i], 'mediaelementplayer.min.css') !== false) {
- $foundmediaelStyles = true;
- }
- }
- if (!$foundmediaelStyles) {
- $document->addStyleSheet(JURI::base().'plugins/content/pb_mediael/mediaelementplayer.min.css');
- }
} else {
return false;
@@ -196,19 +191,19 @@ function contentPbMediaEl_createHTML($id, &$pluginParams, &$videoParamsList) {
$html = '<'.$media.' width="'.$width.'" height="'.$height.'" controls="controls"'.$autoplay_html.$preload_html.$loop_html.$poster_html.'">';
if ($audio_mp3 != "") {
- $html .= '<source src="'.$audio_mp3.'" type=\'audio/mp3\' />';
+ $html .= '<source src="'.$audio_mp3.'" type="audio/mp3" />';
}
if ($video_mp4 != "") {
- $html .= '<source src="'.$video_mp4.'" type="video/mp4; codecs=\'avc1.42E01E, mp4a.40.2\'" />';
+ $html .= '<source src="'.$video_mp4.'" type="video/mp4" />';
}
if ($video_webm != "") {
- $html .= '<source src="'.$video_webm.'" type=\'video/webm; codecs="vp8, vorbis"\' />';
+ $html .= '<source src="'.$video_webm.'" type="video/webm" />';
}
if ($video_ogg != "") {
- $html .= '<source src="'.$video_ogg.'" type=\'video/ogg; codecs="theora, vorbis"\' />';
+ $html .= '<source src="'.$video_ogg.'" type="video/ogg" />';
}
if ($flash != "") {
View
2 Joomla 1.5/pb_mediael.xml
@@ -7,7 +7,7 @@
<license>GNU/GPL http://www.gnu.org/copyleft/gpl.html</license>
<authorEmail>pb@mrc-lmb.cam.ac.uk</authorEmail>
<authorUrl>www2.mrc-lmb.cam.ac.uk</authorUrl>
- <version>0.2</version>
+ <version>0.3</version>
<description>PLUGIN DESC</description>
<files>
<filename plugin="pb_mediael">pb_mediael.php</filename>
View
10 Joomla 1.6/pb_mediael/language/en-GB/en-GB.plg_content_pb_mediael.ini
@@ -3,7 +3,7 @@
; pb_mediael.xml
PLG_PB_MEDIAEL="Content - pb:MediaEl"
-PLG_PB_MEDIAEL_XML_DESCRIPTION="<h1>pb:MediaEl 0.2 [Plugin]</h1><strong>Based on Media Element.JS 2.2.3 (<a href="_QQ_"http://mediaelementjs.com"_QQ_" title="Homepage of Media Element.JS"_QQ_" target="_QQ_"_blank"_QQ_">http://mediaelementjs.com</a>)</strong><p><strong>Description:</strong><br />Content Plugin which provides a HTML5 Video Player for Joomla! 1.6.</p><p><strong>Syntax:</strong><br />Place the following code in an article: <pre wrap="_QQ_"wrap"_QQ_">{pb_mediael media=[video] width=[640] height=[480] autoplay=[true] preload=[true] loop=[true] video_mp4=[http://myvideo.mp4] video_webm=[http://myvideo.webm] video_ogg=[http://myvideo.ogg] flash=[http://myvideo.mp4] image=[http://myvideo.png] image_visibility=[true]}</pre></p><p>These are all parameters. Minimum required is media, width, height and a source file.</p>"
+PLG_PB_MEDIAEL_XML_DESCRIPTION="<h1>pb:MediaEl 0.3 [Plugin]</h1><strong>Based on Media Element.JS 2.2.3 (<a href="_QQ_"http://mediaelementjs.com"_QQ_" title="Homepage of Media Element.JS"_QQ_" target="_QQ_"_blank"_QQ_">http://mediaelementjs.com</a>)</strong><p><strong>Description:</strong><br />Content Plugin which provides a HTML5 Video Player for Joomla! 1.6.</p><p><strong>Syntax:</strong><br />Place the following code in an article: <pre wrap="_QQ_"wrap"_QQ_">{pb_mediael media=[video] width=[640] height=[480] autoplay=[true] preload=[true] loop=[true] video_mp4=[http://myvideo.mp4] video_webm=[http://myvideo.webm] video_ogg=[http://myvideo.ogg] flash=[http://myvideo.mp4] image=[http://myvideo.png] image_visibility=[true]}</pre></p><p>These are all parameters. Minimum required is media, width, height and a source file.</p>"
; Audio
LABEL_AUDIO_MP3="Audio [mp3]"
@@ -15,15 +15,15 @@ LABEL_VIDEO_MP4="Video [mp4]"
LABEL_VIDEO_WEBM="Video [webm]"
LABEL_VIDEO_OGG="Video [ogg]"
LABEL_FLASH="Flash Fallback [mp4]"
-LABEL_IMAGE="Poster Image"
-LABEL_IMAGE_VISIBILITY="Image visible"
+LABEL_IMAGE="Poster / Fallback Image"
+LABEL_IMAGE_VISIBILITY="Poster / Fallback visible"
DESC_VIDEO MP4="Default video [mp4]. Leave blank for no default Video."
DESC_VIDEO WEBM="Default video [webm]. Leave blank for no default Video."
DESC_VIDEO OGG="Default video [ogg]. Leave blank for no default Video."
DESC_FLASH="If video cannot display in HTML5, here you can set a default fallback video for flash. Leave blank for no default flash video."
-DESC_IMAGE="Default poster image. Types: gif, jpg, png."
-DESC_IMAGE VISIBILITY="Hide/display the poster image."
+DESC_IMAGE="Default poster / fallback image. Types: gif, jpg, png."
+DESC_IMAGE VISIBILITY="Hide/display the poster/fallback image."
; Player
LABEL_MEDIA="Media Type"
View
107 Joomla 1.6/pb_mediael/pb_mediael.php
@@ -25,6 +25,21 @@ public function onContentPrepare($context, &$article, &$params, $limitstart) {
if (!empty($hits)) {
$document =& JFactory::getDocument();
+
+ // Check if mediaelsentials stylesheets are loaded
+ $styleSheets = array_keys($document->_styleSheets);
+
+ $foundmediaelStyles = false;
+ for ($i = 0; $i<count($styleSheets); $i++) {
+ if (stripos($styleSheets[$i], 'mediaelementplayer.min.css') !== false) {
+ $foundmediaelStyles = true;
+ }
+ }
+ if (!$foundmediaelStyles) {
+ $document->addStyleSheet(JURI::base().'plugins/content/pb_mediael/mediaelementplayer.min.css');
+ }
+
+
// Check if mediaelsentials script is loaded
$scripts = array_keys($document->_scripts);
$foundJqueryScripts = false;
@@ -51,59 +66,39 @@ public function onContentPrepare($context, &$article, &$params, $limitstart) {
$foundMediaeljsScripts = true;
}
}
- if (!$foundMediaelJScripts) {
-
-
- for ($i=$GLOBALS['plg_pb_mediael']; $i<$GLOBALS['plg_pb_mediael']+$hits; $i++) {
- $document->addScriptDeclaration('
- var $j = jQuery.noConflict();
- $j(document).ready(function() {
- //$j(".PbMediaEl").hide();
- $j("video,audio").mediaelementplayer({
- startVolume: '.$pluginParams->get('defaultVolume', '0.85').',
- enableAutosize: true,
- });
- });
- ');
-
-
- for ($j=0; $j<$hits; $j++) {
- $videoParams = $matches[1][$j];
- $videoParamsList = contentPbMediaEl_getParams($videoParams, $pluginParams);
- $html = contentPbMediaEl_createHTML($i+$j, $pluginParams, $videoParamsList);
- $pattern = str_replace('[', '\[', $matches[0][$j]);
- $pattern = str_replace(']', '\]', $pattern);
- $pattern = str_replace('/', '\/', $pattern);
- $row->text = preg_replace('/'.$pattern.'/', $html, $row->text, 1);
- }
- }
-
- }
-
- // Count instances
- $GLOBALS['plg_pb_mediael'] += $hits;
-
- // Check if mediaelsentials stylesheets are loaded
- $styleSheets = array_keys($document->_styleSheets);
-
- $foundmediaelStyles = false;
- for ($i = 0; $i<count($styleSheets); $i++) {
- if (stripos($styleSheets[$i], 'mediaelementplayer.min.css') !== false) {
- $foundmediaelStyles = true;
- }
- }
- if (!$foundmediaelStyles) {
- $document->addStyleSheet(JURI::base().'plugins/content/pb_mediael/mediaelementplayer.min.css');
- }
-
- } else {
- return false;
- }
-
- return true;
-
- }
+ $document->addScriptDeclaration(' var $j = jQuery.noConflict();
+ $j(document).ready(function() {
+ $j("video,audio").mediaelementplayer({
+ startVolume: '.$pluginParams->get('defaultVolume', '0.85').',
+ enableAutosize: true,
+ });
+ });');
+
+ // Parse shortcodes in content
+ for ($i=$GLOBALS['plg_pb_mediael']; $i<$GLOBALS['plg_pb_mediael']+$hits; $i++) {
+ for ($j=0; $j<$hits; $j++) {
+ $videoParams = $matches[1][$j];
+ $videoParamsList = contentPbMediaEl_getParams($videoParams, $pluginParams);
+ $html = contentPbMediaEl_createHTML($i+$j, $pluginParams, $videoParamsList);
+ $pattern = str_replace('[', '\[', $matches[0][$j]);
+ $pattern = str_replace(']', '\]', $pattern);
+ $pattern = str_replace('/', '\/', $pattern);
+ $row->text = preg_replace('/'.$pattern.'/', $html, $row->text, 1);
+ }
+ }
+
+
+ // Count instances
+ $GLOBALS['plg_pb_mediael'] += $hits;
+
+ } else {
+ return false;
+ }
+
+ return true;
+
+ }
protected function contentPbMediaEl_getParams($videoParams, $pluginParams) {
@@ -200,19 +195,19 @@ protected function contentPbMediaEl_createHTML($id, &$pluginParams, &$videoParam
$html = '<'.$media.' width="'.$width.'" height="'.$height.'" controls="controls"'.$autoplay_html.$preload_html.$loop_html.$poster_html.'">';
if ($audio_mp3 != "") {
- $html .= '<source src="'.$audio_mp3.'" type=\'audio/mp3\' />';
+ $html .= '<source src="'.$audio_mp3.'" type="audio/mp3" />';
}
if ($video_mp4 != "") {
- $html .= '<source src="'.$video_mp4.'" type="video/mp4; codecs=\'avc1.42E01E, mp4a.40.2\'" />';
+ $html .= '<source src="'.$video_mp4.'" type="video/mp4" />';
}
if ($video_webm != "") {
- $html .= '<source src="'.$video_webm.'" type=\'video/webm; codecs="vp8, vorbis"\' />';
+ $html .= '<source src="'.$video_webm.'" type="video/webm" />';
}
if ($video_ogg != "") {
- $html .= '<source src="'.$video_ogg.'" type=\'video/ogg; codecs="theora, vorbis"\' />';
+ $html .= '<source src="'.$video_ogg.'" type="video/ogg" />';
}
if ($flash != "") {
View
2 Joomla 1.6/pb_mediael/pb_mediael.xml
@@ -7,7 +7,7 @@
<license>GNU/GPL http://www.gnu.org/copyleft/gpl.html</license>
<authorEmail>pb@mrc-lmb.cam.ac.uk</authorEmail>
<authorUrl>www2.mrc-lmb.cam.ac.uk</authorUrl>
- <version>0.2</version>
+ <version>0.3</version>
<description>PLUGIN DESC</description>
<files>
<folder>media</folder>
View
9 README.markdown
@@ -39,11 +39,16 @@ If you don't want to encode multiple versions of a movie, MP4 can be played in a
Coming Next
-----------
-- Clean up and check code.
-- Try to improve flexibilty.
+- Add support for more MEJS variables.
+- Add support for each player having different setup variables.
+- (Permenant..) Clean up and check code.
Changelog
---------
+0.3 (2011-10-13)
+
+- Cleaned up output in Head. Removed codec declaration from <video> src.
+
0.2 (2011-10-13)
- Added support for Joomla v1.6 (untested)

0 comments on commit 8bc4e83

Please sign in to comment.
Something went wrong with that request. Please try again.