aboutsummaryrefslogtreecommitdiffstats
path: root/librevideojs-html5-player.php
diff options
context:
space:
mode:
Diffstat (limited to 'librevideojs-html5-player.php')
-rw-r--r--librevideojs-html5-player.php104
1 files changed, 57 insertions, 47 deletions
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 = '<track kind="captions" src="'.$subtes.'" srclang="es" label="Español"/>';
- }else {
- $subtitl_es = "";
- }
-
- if (!empty($subten)){
- $subtitl_en = '<track kind="captions" src="'.$subten.'" srclang="en" label="English"/>';
- } else {
- $subtitl_en = "";
- }
-
- if (!empty($subtpt)){
- $subtitl_pt = '<track kind="captions" src="'.$subtpt.'" srclang="pt" label="Portuguese"/>';
- } else {
- $subtitl_pt = "";
- }
-
- if (!empty($subtfr)){
- $subtitl_fr = '<track kind="captions" src="'.$subtfr.'" srclang="fr" label="Français"/>';
- } else {
- $subtitl_fr = "";
- }
-
- if (!empty($subtgl)){
- $subtitl_gl = '<track kind="captions" src="'.$subtgl.'" srclang="gl" label="Galego"/>';
- } else {
- $subtitl_gl = "";
- }
-
- if (!empty($subteo)){
- $subtitl_eo = '<track kind="captions" src="'.$subteo.'" srclang="eo" label="Esperanto"/>';
- } 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 = <<<EOT
+ <!-- Begin Video.js -->
<video id="$player" class="cliplibre-js-responsive-container librevjs-hd cliplibre-js librevjs-libre-skin" {$controls}{$preload}{$autoplay}{$loop}{$muted}{$poster} width="100%" height="auto" data-setup='{}'>
- $src
- $subtitl_es $subtitl_en $subtitl_pt $subtitl_fr $subtitl_gl $subtitl_eo
+ {$src}
+ {$track}
</video>
<script type="text/javascript">
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
@@ -267,6 +233,50 @@ EOT;
</script>
$style
<br>
+ <!-- End Video.js -->
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 = "
+ <track" . $kind . $subt . $srclang . $label . $default . " />
+ ";
+
+ return $track;
+}
+add_shortcode('track', 'track_shortcode');
+
+?>