From c3edc667f127b9e36ecc08eb790f6c754e413e8f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 30 Nov 2010 12:40:23 +0300 Subject: use html5 audio player instead of flash when possible --- functions.php | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index 175817892..90e23d897 100644 --- a/functions.php +++ b/functions.php @@ -4463,14 +4463,38 @@ $entry = ""; - if ($ctype == "audio/mpeg") { - - $entry .= " - "; + if (strpos($ctype, "audio/") === 0) { + + if ($_SESSION["hasAudio"] && (strpos($ctype, "ogg") !== false || + strpos($_SERVER['HTTP_USER_AGENT'], "Chrome") !== false || + strpos($_SERVER['HTTP_USER_AGENT'], "Safari") !== false )) { + + $id = 'AUDIO-' . uniqid(); + + $entry .= ""; + + $entry .= "".__("Play").""; + + } else { + + $entry .= " + + "; + } } + $filename = substr($url, strrpos($url, "/")+1); + + $entry .= " " . + $filename . " (" . $ctype . ")" . ""; + return $entry; } @@ -6792,12 +6816,12 @@ if (!$ctype) $ctype = __("unknown type"); - $filename = substr($url, strrpos($url, "/")+1); +# $filename = substr($url, strrpos($url, "/")+1); $entry = format_inline_player($link, $url, $ctype); - $entry .= " " . - $filename . " (" . $ctype . ")" . ""; +# $entry .= " " . +# $filename . " (" . $ctype . ")" . ""; array_push($entries_html, $entry); -- cgit v1.2.3