在iOS Safari上播放WAV文件 [英] playing a WAV file on iOS Safari

查看:691
本文介绍了在iOS Safari上播放WAV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b $我努力让WAV文件作为HTML5音频标签或通过移动Safari(iPad / iPhone)中的常规可下载链接在HTML页面上播放: b

 < audio controls src =audio-pcm_s16le-8k.wav/>< / audio> 
< a href =audio-pcm_s16le-8k.wav>音频< / a>

HTML5 音频对象仅显示无法播放音频文件,当我点击下载引用的锚时,我会在中间出现一个带有无法播放此圆圈的黑色页面。我已经尝试了各种频率(8000,11025,16000,32000,44100),各种编码(mu-law,线性签名的16位LE和BE),各种容器(.wav,.caf,.aiff)和各种各样的容器音频转换程序(Audacity,ffmpeg和Apple自己的afconvert)...我无法播放音频(除非我制作MP3 - 否则,我不能只使用MP3或AAC,我需要一个raw 格式的原因太长,无法进入这里)。



我研究了iOS支持的格式,它似乎支持WAV ...任何人都可以获得任何经验这个问题?我使用的是最新版本的iOS 6.0.1



编辑:选定的回答者让我知道问题,但原因在于答案。底线是它需要HTML范围头文件来播放这些文件。

至少让我在正确的轨道上......这显然不是文件......它是网络服务器。 stockley的工作内容完全相同,但在我的Web服务器上却没有。我将不得不详细查看HTTP响应。我的网络服务器正在返回 Content-Type:audio / x-wav ,所以不是这样...


检查我设置的测试网站的标题,您希望为包含HTML数据的页面返回 Content-Type:text / html 你需要:

对于实际的音频文件( http: c), $ b

Content-Type:audio / x-wav //www.test.com/file.wav




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):

<audio controls src="audio-pcm_s16le-8k.wav"/></audio>
<a href="audio-pcm_s16le-8k.wav">audio</a>

The HTML5 audio object just shows Cannot play audio file in it, and when I click to download the anchor referenced one I get a black page with a "can't play this circle" in the middle. I've tried various frequencies (8000, 11025, 16000, 32000, 44100), various encodings (mu-law, Linear Signed 16-bit LE and BE), various containers (.wav, .caf, .aiff), and various audio conversion programs (Audacity, ffmpeg, and Apple's own afconvert)... I can't get audio to play (unless I make it MP3 -- and no, I can't just use MP3 or AAC, I need a "raw" format for reasons too long to get in to here).

I looked at the supported formats for iOS and it appears to support WAV... anyone got any experience with this issue? I'm on latest iOS 6.0.1

EDIT: The selected answerer got me to the issue, but the reason is in the comments of the answer. Bottom line is it requires HTML range headers for playing the files.

解决方案

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:

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

这篇关于在iOS Safari上播放WAV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆