What's new

iPad Audio

DarthMambo

iPF Noob
This is driving me nuts.

I'm building an HTML application for my iPad, but I can't make it play .wav files which are returned from either a Java servlet or an ASP handler (I'm sure I'm setting the "content-type" correctly - "audio/wav" or "audio/x-wav")

In either HTML5 or Quicktime, if you set the data source for the object to a static file it works fine e.g. "/foo/bar/baz.wav", but if you set it to a dynamic source e.g. "/foo/bar/GetWav?audioFileId=123" the component just goes into an error state and doesn't play anything.

Does anyone know if this is a formal restriction of Quicktime and the HTML5 <audio/> tag? Any workarounds?
 
are you running an apache server?

You could try setting up a .htaccess rule for when a file doesn't exist a PHP script is run instead.

So lets say you have an empty folder at /mainsite/files/audio/.
the webpage tries to download /mainsite/files/audio/123.wav

That file doesnt exist, php script runs and looks at the file name "123" and returns the proper audio file as 123.wav


I have done this before to create dynamic pitures. Example I have a weather script that returns an image with the currnt weather status/temps/ and a background of the current conditions.
file requests look something like /weather/33178.png
now that file doesnt exist but the script looks at the file name which is a zipcode and then generates the correct image.
 
Last edited:
I'm on IIS and tried to do the same thing before I left work today and it didn't work. Have you tried doing this with Quicktime/HTML5 tags before?

I will double-check that tomorrow that I didn't do anything silly and that the response for a static and dynamic resources are identical. If you have any other ideas..
 
They're identical! Any ideas?


Request #1 (Real Wav)

GET /Views/MyWav.wav HTTP/1.1
Host localhost:50854
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Cookie ASP.NET_SessionId=uei4...EB0
Cache-Control max-age=0


Request #2 (Dynamically Fetched Wav)

GET /Views/VoiceClip.wav HTTP/1.1
Host localhost:50854
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6
Accept text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Cookie ASP.NET_SessionId=uei4v...2CD5EB0
Cache-Control max-age=0


Response #1 (Real Wav)

HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Fri, 09 Jul 2010 16:09:00 GMT
X-AspNet-Version: 4.0.30319
Cache-Control: private
Content-Type: audio/wav
Content-Length: 110546
Connection: Close

RIFFÊ...

Reponse #2 (Dynamically Fetched Wav)

HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Fri, 09 Jul 2010 16:09:01 GMT
X-AspNet-Version: 4.0.30319
Content-Length: 100676
Cache-Control: private
Content-Type: audio/wav
Connection: Close

RIFF<......
 
It turns out that it's because the iPad etc. demand that any audio/video come from service endpoints which support byte-range HTTP headers i.e. "fetch me byes 50-100". If the endpoint doesn't support this it just fails. I had to go add this support to my ASP.net handler/java servlet.
 

Most reactions

Back
Top