iPad Audio

Discussion in 'iPad Development' started by DarthMambo, Jul 9, 2010.

  1. DarthMambo

    DarthMambo iPF Noob

    Joined:
    Jul 9, 2010
    Messages:
    4
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    San Diego
    Ratings:
    +0 / 0
    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?
     
  2. MikesTooLz

    MikesTooLz Super Moderator Staff Member

    Joined:
    May 7, 2010
    Messages:
    2,361
    Thanks Received:
    19
    Trophy Points:
    0
    Location:
    Miami, FL
    Ratings:
    +21 / 0
    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: Jul 9, 2010
  3. DarthMambo

    DarthMambo iPF Noob

    Joined:
    Jul 9, 2010
    Messages:
    4
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    San Diego
    Ratings:
    +0 / 0
    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..
     
  4. DarthMambo

    DarthMambo iPF Noob

    Joined:
    Jul 9, 2010
    Messages:
    4
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    San Diego
    Ratings:
    +0 / 0
    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<......
     
  5. DarthMambo

    DarthMambo iPF Noob

    Joined:
    Jul 9, 2010
    Messages:
    4
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    San Diego
    Ratings:
    +0 / 0
    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.
     

Share This Page

Search tags for this page
cannot play wav files on ipad
,
error on ipad cannot play audio file
,
how to play wav files on ipad quick time byte error message
,
html5 audio in ipad cannot play audio file wav
,
html5 ios audio wav cannot play audio file
,
iis ipad byte-range error message
,

ipad cannot play audio file

,
ipad cannot play audio file wav
,
playing wav