HTML5 Audio Player

Hearing Voices uses the WPAudioPlayer plug, which, since it’s Flash, the iPhone can’t see. But iPhone Safari is HTML 5 aware, and supports mp3 play. So here’s our quick&filthy fix. In the file: /plugins/audio-player/audio-player.php, find the: function getPlayer, and w/in that the variable: $playerCode.

You’ll be inserting code that look something like this PHP/HTML:

'<audio src="' . $source . '" controls>Flash stuff&hellip;</audio>'

So, where the original read:

$playerCode = '<p class="audioplayer_container"><span style="display:block;padding:5px;border:1px solid #dddddd;background:#f8f8f8" id="' . $playerElementID . '">' . sprintf(__('Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version <a href="%s" title="Download Adobe Flash Player">here</a>. You also need to have JavaScript enabled in your browser.', $this->textDomain), 'http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&amp;promoid=BIOW') . '</span></p>';

Substitute this (we shortened the no-Flash text too):

$playerCode = '<p class="audioplayer_container"><span style="display:block;padding:5px;border:1px solid #dddddd;background:#f8f8f8" id="' . $playerElementID . '">' . sprintf(__('<audio src="' . $source . '" controls><br /><em>Audio player needs Flash9+ (<a href="%s" title="Download Adobe Flash Player">download</a>) and JavaScript.</em>', $this->textDomain), 'http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&amp;promoid=BIOW') . '</audio></span></p>';

‘Course, this is a bonehead way to do it, b/c:

  1. It needs redoing after every upgrade of this plugin.
  2. We should really should check first to see:
    1. Does browser supports the html 5 audio tag? (IE8: no.)
    2. If so, will it play an mp3? (Firefox & Opera: no, Safari & Chrome: yes.)
  3. Then, according to above conditions, the script should:
    1. If yes to both, write only the HTML5 audio tag (w/ src), not the Flash stuff.
    2. If no to either, write only the Flash stuff, not the HTML5. (More info and scripts at HTML 5 Doctor.)

But, for now at least, iPhoney folk can hear us.

Bookmark and Share
« | HV NEWS | »




Leave a comment:

(required)

(required) (will be hidden)


(Allowed tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> )