From 38d6ca1e4fe4e2077cbc878778a183922b92f69c Mon Sep 17 00:00:00 2001 From: Heckyel Date: Sat, 10 Dec 2016 18:55:30 -0500 Subject: =?UTF-8?q?flexibilidad=20con=20subt=C3=ADtulos=20-=20A=C3=BAn=20n?= =?UTF-8?q?o=20solucionado=20compatilidad=20de=20subt=C3=ADtulos=20con=20i?= =?UTF-8?q?ntefaz=20gr=C3=A1fica=20|=20beta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- librevideojs-html5-player.php | 104 +++++++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 47 deletions(-) (limited to 'librevideojs-html5-player.php') diff --git a/librevideojs-html5-player.php b/librevideojs-html5-player.php index c6215e1..7807a2e 100644 --- a/librevideojs-html5-player.php +++ b/librevideojs-html5-player.php @@ -106,7 +106,7 @@ function librevideojs_html5_player_header() { } } -function librevideojs_html5_video_embed_handler($atts) { +function librevideojs_html5_video_embed_handler($atts, $content=null) { extract(shortcode_atts(array( 'url' => '', 'rsd' => '', @@ -123,13 +123,7 @@ function librevideojs_html5_video_embed_handler($atts) { 'muted' => '', 'poster' => '', 'class' => '', - 'subten' => '', - 'subtes' => '', - 'subtpt' => '', - 'subtit' => '', - 'subtfr' => '', - 'subtgl' => '', - 'subteo' => '', + ), $atts)); if(empty($url)){ @@ -154,43 +148,6 @@ function librevideojs_html5_video_embed_handler($atts) { $src = $src.$umsd; } - //subtitles - if (!empty($subtes)) { - $subtitl_es = ''; - }else { - $subtitl_es = ""; - } - - if (!empty($subten)){ - $subtitl_en = ''; - } else { - $subtitl_en = ""; - } - - if (!empty($subtpt)){ - $subtitl_pt = ''; - } else { - $subtitl_pt = ""; - } - - if (!empty($subtfr)){ - $subtitl_fr = ''; - } else { - $subtitl_fr = ""; - } - - if (!empty($subtgl)){ - $subtitl_gl = ''; - } else { - $subtitl_gl = ""; - } - - if (!empty($subteo)){ - $subtitl_eo = ''; - } else { - $subtitl_eo = ""; - } - //resolution selector if (!empty($selector)) { $resolution = "$selector"; @@ -237,6 +194,14 @@ function librevideojs_html5_video_embed_handler($atts) { else{ $muted = ""; } + // Tracks + if(!is_null( $content )){ + $track = do_shortcode($content); + } + else{ + $track = ""; + } + //poster if(!empty($poster)) { $poster = ' poster="'.$poster.'"'; @@ -256,9 +221,10 @@ EOT; } $output = << $style
+ EOT; return $output; } + +/*Trayendo los subtitulos mediante [track]*/ +function track_shortcode($atts, $content=null){ + extract(shortcode_atts(array( + 'kind' => '', + 'subt' => '', + 'srclang' => '', + 'label' => '', + 'default' => '', + ), $atts)); + + if($kind){ + $kind = " kind='" . $kind . "'"; + } + + if($subt){ + $subt = " src='" . $subt . "'"; + } + + if($srclang){ + $srclang = " srclang='" . $srclang . "'"; + } + + if($label){ + $label = " label='" . $label . "'"; + } + + if($default == "true" || $default == "default"){ + $default = " default"; + } + else{ + $default = ""; + } + + $track = " + + "; + + return $track; +} +add_shortcode('track', 'track_shortcode'); + +?> -- cgit v1.2.3