diff --git a/data/pages/wiki/syntax.txt b/data/pages/wiki/syntax.txt index 02b49dc3de9c4bd9114859234a53af8a592f7711..86ad815e4dedb6dcb6bdd85625b564d779ac58ae 100644 --- a/data/pages/wiki/syntax.txt +++ b/data/pages/wiki/syntax.txt @@ -121,9 +121,9 @@ By using four or more dashes, you can make a horizontal line: ---- -===== Images and Other Files ===== +===== Media Files ===== -You can include external and internal [[doku>images]] with curly brackets. Optionally you can specify the size of them. +You can include external and internal [[doku>images|images, videos and audio files]] with curly brackets. Optionally you can specify the size of them. Real size: {{wiki:dokuwiki-128.png}} @@ -157,10 +157,31 @@ Of course, you can add a title (displayed as a tooltip by most browsers), too. {{ wiki:dokuwiki-128.png |This is the caption}} -If you specify a filename (external or internal) that is not an image (''gif, jpeg, png''), then it will be displayed as a link instead. - For linking an image to another page see [[#Image Links]] above. +==== Supported Media Formats ==== + +DokuWiki can embed the following media formats directly. + +| Image | ''gif'', ''jpg'', ''png'' | +| Video | ''webm'', ''ogv'', ''mp4'' | +| Audio | ''ogg'', ''mp3'', ''wav'' | +| Flash | ''swf'' | + +If you specify a filename that is not a supported media format, then it will be displayed as a link instead. + +==== Fallback Formats ==== + +Unfortunately not all browsers understand all video and audio formats. To mitigate the problem, you can upload your file in different formats for maximum browser compatibility. + +For example consider this embedded mp4 video: + + {{video.mp4|A funny video}} + +When you upload a ''video.webm'' and ''video.ogv'' next to the referenced ''video.mp4'', DokuWiki will automatically add them as alternatives so that one of the three files is understood by your browser. + +Additionally DokuWiki supports a "poster" image which will be shown before the video has started. That image needs to have the same filename as the video and be either a jpg or png file. In the example above a ''video.jpg'' file would work. + ===== Lists ===== Dokuwiki supports ordered and unordered lists. To create a list item, indent your text by two spaces and use a ''*'' for unordered lists or a ''-'' for ordered ones. diff --git a/inc/media.php b/inc/media.php index 56fa5d54bd2a595a0965bfe37a8091a5e4b0d68e..fe155f0f3007e76720080bd7abd8b19f97ac63b2 100644 --- a/inc/media.php +++ b/inc/media.php @@ -2164,7 +2164,7 @@ function media_alternativefiles($src, $exts){ /** * Check if video/audio is supported to be embedded. * - * @param string $src - mimetype of media file + * @param string $mime - mimetype of media file * @param string $type - type of media files to check ('video', 'audio', or none) * @return boolean * diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 80701cd2ebc6711aefb875ddc73dc6e018e00092..9d75c271d4952b2396ad60b99bb77119398061ee 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -1096,48 +1096,30 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $ret .= ' />'; - }elseif(media_supportedav($mime, 'video')){ + }elseif(media_supportedav($mime, 'video') || media_supportedav($mime, 'audio')){ // first get the $title - if (!is_null($title)) { - $title = $this->_xmlEntities($title); - } - if (!$title) { - // just show the sourcename - $title = $this->_xmlEntities(utf8_basename(noNS($src))); - } + $title = !is_null($title) ? $this->_xmlEntities($title) : false; if (!$render) { - // if the video is not supposed to be rendered - // return the title of the video - return $title; + // if the file is not supposed to be rendered + // return the title of the file (just the sourcename if there is no title) + return $title ? $title : $this->_xmlEntities(utf8_basename(noNS($src))); } $att = array(); $att['class'] = "media$align"; - - //add video(s) - $ret .= $this->_video($src, $width, $height, $att); - - }elseif(media_supportedav($mime, 'audio')){ - // first get the $title - if (!is_null($title)) { - $title = $this->_xmlEntities($title); + if ($title) { + $att['title'] = $title; } - if (!$title) { - // just show the sourcename - $title = $this->_xmlEntities(utf8_basename(noNS($src))); + + if (media_supportedav($mime, 'video')) { + //add video + $ret .= $this->_video($src, $width, $height, $att); } - if (!$render) { - // if the video is not supposed to be rendered - // return the title of the video - return $title; + if (media_supportedav($mime, 'audio')) { + //add audio + $ret .= $this->_audio($src, $att); } - $att = array(); - $att['class'] = "media$align"; - - //add audio - $ret .= $this->_audio($src, $att); - }elseif($mime == 'application/x-shockwave-flash'){ if (!$render) { // if the flash is not supposed to be rendered @@ -1282,7 +1264,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @return string */ function _video($src,$width,$height,$atts=null){ - // prepare width and height if(is_null($atts)) $atts = array(); $atts['width'] = (int) $width; @@ -1309,7 +1290,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // output source for each alternative video format foreach($alternatives as $mime => $file) { $url = ml($file,array('cache'=>$cache),true,'&'); - $title = $this->_xmlEntities(utf8_basename(noNS($file))); + $title = $atts['title'] ? $atts['title'] : $this->_xmlEntities(utf8_basename(noNS($file))); $out .= '<source src="'.hsc($url).'" type="'.$mime.'" />'.NL; // alternative content (just a link to the file) @@ -1345,7 +1326,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // output source for each alternative audio format foreach($alternatives as $mime => $file) { $url = ml($file,array('cache'=>$cache),true,'&'); - $title = $this->_xmlEntities(utf8_basename(noNS($file))); + $title = $atts['title'] ? $atts['title'] : $this->_xmlEntities(utf8_basename(noNS($file))); $out .= '<source src="'.hsc($url).'" type="'.$mime.'" />'.NL; // alternative content (just a link to the file)