views:

1271

answers:

3

I haven't be able to find a resource explaining if this is possible at all. The apple documentation found here

http://developer.apple.com/safari/library/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/AudioandVideoTagBasics/AudioandVideoTagBasics.html#//apple_ref/doc/uid/TP40009523-CH2-SW1

...doesn't mention such features.

I also tried embedding audio with the tag which pulls up the same modal quicktime player.

Is there a way to do this or alternatively – is there a way to play audio files in an iphone webapp without opening a modal external player?

Thanks!

A: 

I'm not aware of any such customisation ability. You could perhaps instead add a bit of script that completely hides the <audio> element, and provides alternative JavaScript interaction controls styled to your choosing.

bobince
Thanks for your answer. This is however not possible in MobileSafari since all content linked from the <audio> and <video> tags is played in an external quicktime player. What you are suggesting does work in other html5-capable browsers.
canfan
Wow, seems you're right, the Mobile Safari implementation of `<audio>`/`<video>` isn't a proper embedded player at all. It's completely contrary to the spirit of HTML5's HTMLMediaElement; I wonder why they implemented it at all.
bobince
It's hard to say, but I imagine it has to do with memory management within the MobileSafari app on the iPhone/iPod touch. The Apple docs suggest that the tag has been implemented as such so it can play only one media file at a time. On the iPad it is supposedly not an issue and embedded <video> and <audio> content play inline.
canfan
+2  A: 

I found a workaround for achieving this functionality by using Apple's mediafilesegmenter command line tool to prepare an mp3 for "HTTP Live Streaming" – Apple's new protocol for streaming media through HTTP.

More info here: http://developer.apple.com/iphone/library/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008332-CH1-DontLinkElementID_29

By using the arguments --audio-only --meta-file poster.png --meta-type picture you can create an mp3 stream that will display the poster.png image in the external quicktime player while the audio is playing.

canfan
Just a note, the filestreamsegmenter tool referenced in Apple's documentation has been recently renamed to "mediafilesegmenter". It provides the same functionality.
canfan
A: 

You can play audio inline using jPlayer, a jQuery MP3 plugin.

Demo (try on iPhone): http://happyworm.com/jPlayerLab/single-page-app/#first

Sean O