playing a WAV file on iOS Safari

前端 未结 3 1212
说谎
说谎 2021-02-19 01:45

I\'m struggling to get a WAV file to play on a HTML page as either an HTML5 audio tag or via a regular downloadable link in mobile Safari (iPad/iPhone):



        
相关标签:
3条回答
  • 2021-02-19 02:17

    It works great. I used Content-Range: bytes XX-XX/XX and Content-Length: XX

    0 讨论(0)
  • 2021-02-19 02:18

    Through a run of trial and error I found that you need a content-range header for it to work. Here's an example of my headers that allows a wav file to play in Safari for iOS:

    Content-Range: bytes XX-XX/XX
    Content-Type: audio/wav 
    Content-Disposition: attachment; filename="whatever.WAV" 
    Content-Length: XX    
    

    Hope this helps!

    0 讨论(0)
  • 2021-02-19 02:35

    Well, you've certainly gotten me on the right track at least... it's apparently not the file at all... it's the web server. Same exact content from stockley works, but on my web server it doesn't. I'll have to look over the HTTP response in detail I suppose. My web server is returning Content-Type: audio/x-wav so it's not that...

    Checking the headers for the test site I set up, you want to be returning Content-Type: text/html for the page containing the HTML data you need:

    enter image description here

    And Content-Type: audio/x-wav for the actual audio file (http://www.test.com/file.wav)

    enter image description here

    0 讨论(0)
提交回复
热议问题