From b44a5dce182bb65063dd1868e92954520e8fab88 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sat, 3 Aug 2013 16:56:16 +0100 Subject: added support for html5 audio Similar to videos, all .ogg, .mp3 and .wav 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 | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'inc/parser/xhtml.php') diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index b1bfaae5d..c6e5a8e22 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -1114,6 +1114,27 @@ class Doku_Renderer_xhtml extends Doku_Renderer { //add video(s) $ret .= $this->_video($src, $width, $height, $att); + }elseif($mime == 'audio/ogg' || $mime == 'audio/mpeg' || $mime == 'audio/wav' ){ + // 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))); + } + if (!$render) { + // if the video is not supposed to be rendered + // return the title of the video + return $title; + } + + $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 @@ -1253,8 +1274,6 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * @author Anika Henke * * @param string $src - ID of video to embed - * @param string $title - title of the video - * @param string $mime - mimetype of the video * @param int $width - width of the video in pixels * @param int $height - height of the video in pixels * @param array $atts - additional attributes for the '.NL; } + /** + * Embed audio in HTML + * + * @author Anika Henke + * + * @param string $src - ID of audio to embed + * @param array $atts - additional attributes for the