diff options
Diffstat (limited to 'librevideojs-html5-player.php')
-rw-r--r-- | librevideojs-html5-player.php | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/librevideojs-html5-player.php b/librevideojs-html5-player.php index b3a9f82..4ba5ba6 100644 --- a/librevideojs-html5-player.php +++ b/librevideojs-html5-player.php @@ -1,7 +1,7 @@ <?php /* Plugin Name: LibreVideoJS HTML5 Player -Version: 1.0.3 +Version: 1.1.0 Plugin URI: https://wordpress.org/plugins/librevideojs-html5-player Author: <a href="https://conocimientoslibres.tuxfamily.org">Jesús Eduardo</a>, <a href="http://www.freakspot.net/">Jorge Maldonado</a> Description: Reproductor de vídeo Libre en Responsive Desing HTML5 para WordPress, construido sobre el ampliamente utilizado <a href="https://notabug.org/Heckyel/LibreVideoJS">LibreVideoJS</a> de la biblioteca del reproductor de vídeo HTML5. Le permite incrustar vídeo en tu post o página con HTML5 para los navegadores principales. Es compatible con <a href="https://www.gnu.org/software/librejs/free-your-javascript.html">LibreJS</a> de acuerdo con la filosofía <a href="https://www.gnu.org">GNU</a>. @@ -20,7 +20,7 @@ if (!class_exists('LIBREVIDEOJS_HTML5_PLAYER')) { class LIBREVIDEOJS_HTML5_PLAYER { - var $plugin_version = '1.0.3'; + var $plugin_version = '1.1.0'; function __construct() { define('LIBREVIDEOJS_HTML5_PLAYER_VERSION', $this->plugin_version); @@ -84,19 +84,23 @@ if (!class_exists('LIBREVIDEOJS_HTML5_PLAYER')) { } function librevideojs_html5_player_enqueue_scripts() { - if (!is_admin()) { + global $post; + if (!is_admin() && strpos($post->post_content, '[librevideojs_video') !== false){ $plugin_url = plugins_url('', __FILE__); - wp_enqueue_script('jquery'); - wp_register_script('librevideojs', $plugin_url . '/librevideojs/js/cliplibrejs.dev.js', true); + wp_register_script('librevideojs', $plugin_url . '/librevideojs/js/cliplibrejs.dev.js', array(), LIBREVIDEOJS_HTML5_PLAYER_VERSION); wp_enqueue_script('librevideojs'); - wp_register_style('librevideojs', $plugin_url . '/librevideojs/css/librevideojs-material/libre-skin-teal.min.css'); - wp_enqueue_style('librevideojs'); + wp_register_style('librevideojs-mix-master-style', $plugin_url . '/librevideojs/css/mix-material/master.css', array(), $ver='1.4'); + wp_enqueue_style('librevideojs-mix-master-style'); + wp_register_style('librevideojs-material-style', $plugin_url . '/librevideojs/css/librevideojs-material/master.css', array(), $ver='1.4'); + wp_enqueue_style('librevideojs-material-style'); wp_register_style('librevideojs-style', $plugin_url . '/librevideojs-html5-player.css'); wp_enqueue_style('librevideojs-style'); - wp_register_script('librevideojs-selector', $plugin_url . '/librevideojs/selector/video-quality-selector.min.js', true); + wp_register_script('librevideojs-selector', $plugin_url . '/librevideojs/selector/video-quality-selector.js', array(), LIBREVIDEOJS_HTML5_PLAYER_VERSION); wp_enqueue_script('librevideojs-selector'); - wp_register_style('librevideojs-selector', $plugin_url . '/librevideojs/selector/video-quality-selector.min.css'); + wp_register_style('librevideojs-selector', $plugin_url . '/librevideojs/selector/video-quality-selector.css', array(), $ver = '1.4'); wp_enqueue_style('librevideojs-selector'); + } else{ + return false; } } @@ -120,8 +124,8 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { 'loop' => '', 'muted' => '', 'poster' => '', + 'skin' => '', 'class' => '', - ), $atts)); if(empty($url)){ @@ -145,6 +149,7 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { else{ $controls = " controls"; } + //preload if($preload == "metadata") { $preload = ' preload="metadata"'; @@ -155,6 +160,7 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { else{ $preload = ' preload="auto"'; } + //autoplay if($autoplay == "true"){ $autoplay = " autoplay"; @@ -162,6 +168,7 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { else{ $autoplay = ""; } + //loop if($loop == "true"){ $loop = " loop"; @@ -169,6 +176,7 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { else{ $loop = ""; } + //muted if($muted == "true"){ $muted = " muted"; @@ -176,15 +184,16 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { else{ $muted = ""; } - // Tracks + + //Tracks if(!is_null( $content )){ $track = do_shortcode($content); } else{ - $track = ""; + $track = ""; } - // Calidades + //Qualities if(!is_null( $content = '' )){ $calidades = do_shortcode($content); } @@ -192,6 +201,14 @@ function librevideojs_html5_video_embed_handler($atts, $content=null) { $calidades = ""; } + //skin theme + if (!empty($skin)) { + $_skin = "$skin"; + } + else{ + $_skin= "materialteal"; + } + //poster if(!empty($poster)) { $poster = " poster='$poster'"; @@ -212,9 +229,11 @@ EOT; } $output = <<<EOT <!-- Begin LibreVideoJS --> - <video id="$player" class="cliplibre-js-responsive-container librevjs-hd cliplibre-js librevjs-libre-skin" {$controls}{$preload}{$autoplay}{$loop}{$muted}{$poster} data-setup='{}'> + <div class="LibreVideoJS"> + <video id="$player" class="cliplibre-js-responsive-container librevjs-hd cliplibre-js librevjs-libre-{$_skin}-skin" {$controls}{$preload}{$autoplay}{$loop}{$muted}{$poster} data-setup='{}'> {$src}\n\t\t{$calidades}{$track}<p class="no_html5">Sorry, this video will not work because your web browser does not support HTML5 video.<br>We recommend that you install a <a href='https://libreplanet.org/wiki/Libre_Browsers_Libre_Formats' target='_blank'> browser that respects the freedom and support free formats</a>!</p> </video> + <div> <script type="text/javascript"> // @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later cliplibrejs('$player',{plugins:{resolutionSelector:{force_types:['video/webm','video/ogg','video/mp4'],default_res:"$resolution"}},nativeControlsForTouch: false}); @@ -227,7 +246,7 @@ EOT; return $output; } -/*Trayendo los subtitulos mediante [track]*/ +/*Adding subtitles using... [track]*/ function track_shortcode($atts, $content=null){ extract(shortcode_atts(array( 'kind' => '', @@ -266,8 +285,7 @@ function track_shortcode($atts, $content=null){ } add_shortcode('track', 'track_shortcode'); - -/*Trayendo las calidades*/ +/*Adding qualities*/ function calidades_shortcode($atts, $content=null){ extract(shortcode_atts(array( 'lvjs_calidad' => '', @@ -286,7 +304,6 @@ function calidades_shortcode($atts, $content=null){ return $calidades; } - add_shortcode('calidades', 'calidades_shortcode'); ?> |