summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-06-17 11:16:44 +0400
committerAndrew Dolgov <[email protected]>2009-06-17 11:16:44 +0400
commit95f67d2ebcb367bc5d06b802bdffb5642dac8f81 (patch)
tree92ea9f758d30936497a18db586b4109f236b9760 /functions.php
parent70c9b173145a9f3cb74f681afcc4dee9e1a2314d (diff)
add support for HTML5 way of playing audio/video enclosures (closes #246)
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php40
1 files changed, 30 insertions, 10 deletions
diff --git a/functions.php b/functions.php
index c89f11a13..6a8e85628 100644
--- a/functions.php
+++ b/functions.php
@@ -4692,11 +4692,21 @@
$entry = "";
- if (($ctype == __("audio/mpeg")) &&
- (get_pref($link, "ENABLE_FLASH_PLAYER")) ) {
-
- $entry .= "<object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object> ";
-
+ if (substr($ctype,0,6)=="audio/" || $ctype=="application/ogg" || $ctype=="application/x-ogg") {
+ $entry .= "<audio controls=\"controls\"><source src=\"$url\" type=\"$ctype\" />";
+ if (($ctype == __("audio/mpeg")) &&
+ (get_pref($link, "ENABLE_FLASH_PLAYER")) ) {
+ $entry .= "<div><object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object></div>";
+ }
+ $entry .= "</audio>";
+ if (($ctype == __("audio/mpeg")) &&
+ (get_pref($link, "ENABLE_FLASH_PLAYER")) ) {
+ $entry .= "<a id='switchToFlashLink' href='#' onclick='return switchToFlash(this)'>".__('Switch to Flash Player')."</a><br />";
+ $entry .= "<script type='text/javascript'>html5AudioOrFlash('$ctype');</script>";
+ }
+ } elseif (substr($ctype,0,6)=="video/") {
+ $entry .= "<video controls=\"controls\"><source src=\"$url\" type=\"$ctype\" />";
+ $entry .= "</video>";
}
$entry .= "<a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" .
@@ -5236,11 +5246,21 @@
$entry = "";
- if (($ctype == __("audio/mpeg")) &&
- (get_pref($link, "ENABLE_FLASH_PLAYER")) ) {
-
- $entry .= "<object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object> ";
-
+ if (substr($ctype,0,6)=="audio/" || $ctype=="application/ogg" || $ctype=="application/x-ogg") {
+ $entry .= "<audio controls=\"controls\"><source src=\"$url\" type=\"$ctype\" />";
+ if (($ctype == __("audio/mpeg")) &&
+ (get_pref($link, "ENABLE_FLASH_PLAYER")) ) {
+ $entry .= "<div><object type=\"application/x-shockwave-flash\" data=\"extras/button/musicplayer.swf?song_url=$url\" width=\"17\" height=\"17\"> <param name=\"movie\" value=\"extras/button/musicplayer.swf?song_url=$url\" /> </object></div>";
+ }
+ $entry .= "</audio>";
+ if (($ctype == __("audio/mpeg")) &&
+ (get_pref($link, "ENABLE_FLASH_PLAYER")) ) {
+ $entry .= "<a id='switchToFlashLink' href='#' onclick='return switchToFlash(this)'>".__('Switch to Flash Player')."</a><br />";
+ $entry .= "<script type='text/javascript'>html5AudioOrFlash('$ctype');</script>";
+ }
+ } elseif (substr($ctype,0,6)=="video/") {
+ $entry .= "<video controls=\"controls\"><source src=\"$url\" type=\"$ctype\" />";
+ $entry .= "</video>";
}
$entry .= "<a target=\"_blank\" href=\"" . htmlspecialchars($url) . "\">" .