From 3d7a9e0a1cba0b173b6b03f5c88a8eb975286cc7 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Fri, 2 Aug 2013 23:13:41 +0100 Subject: Add several alternative formats to video for better browser compatibility All .webm, .ogv and .mp4 files with the same filename are automatically chosen as alternative sources when only one of them is mentioned in the media syntax. --- inc/parser/xhtml.php | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'inc/parser') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 747f0e8a0..bb5f6a4d2 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -1095,9 +1095,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer { }elseif(substr($mime,0,5) == 'video'){ + $origTitle = ''; // first get the $title if (!is_null($title)) { $title = $this->_xmlEntities($title); + $origTitle = $title; } if (!$title) { // just show the sourcename @@ -1113,7 +1115,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $att['class'] = "media$align"; //add video(s) - $ret .= $this->_video($src, $title, $mime, $width, $height, $att); + $ret .= $this->_video($src, $origTitle, $mime, $width, $height, $att); }elseif($mime == 'application/x-shockwave-flash'){ if (!$render) { @@ -1269,16 +1271,30 @@ class Doku_Renderer_xhtml extends Doku_Renderer { if(!$atts['width']) $atts['width'] = 320; if(!$atts['height']) $atts['height'] = 240; - $url = ml($src,array('cache'=>$cache),true,'&'); + // prepare alternative formats + $extensions = array('webm', 'ogv', 'mp4'); + $types['webm'] = 'video/webm; codecs="vp8, vorbis"'; + $types['ogv'] = 'video/ogg; codecs="theora, vorbis"'; + // mp4 would be 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"', but Android doesn't like it + $types['mp4'] = ''; + $alternatives = media_alternativefiles($src, $extensions); // @todo: add poster $this->doc .= ''.NL; -- cgit v1.2.3