在 safari iPhone 4.3 上通过 HTTPS 播放 HTML5 音频
我编写了一个简单的 HTML 代码,用于在 iPhone 上使用 HTML5 音频标签播放音频文件。
<audio controls="controls" autoplay="autoplay">
<source src="http://192.168.1.130/ab.wav>" type="audio/wav" preload="auto"/>
Your browser does not support the audio element.
</audio>
上面的代码在 Safari 上运行得非常好。当我将源 URL 从 HTTP 更改为 HTTPS 时,问题就出现了。
我开始收到“这部电影无法播放”错误消息。
我使用的证书链如下:
VeriSign Trial Secure Server Root CA - G2 -> VeriSign 试用安全服务器 CA - G2 -> ucbu-aricent-vm200
默认情况下,根 CA 的证书(上面)在 Safari 中不可用。
因此,我将证书颁发机构的证书(根证书和中级证书)附加到电子邮件中,然后通过单击电子邮件中的附件将它们添加到 iPhone 中。
但当 Safari 创建 TCP 会话来传输 WAV 文件时,我仍然看到 SSL 握手失败。
注意:当创建 TCP 会话以从服务器获取 HTML 文件时,SSL 握手成功。我比较了 HTML 和 WAV 文件场景的 SSL 握手的网络数据包,两者是相同的。
I have written a simple HTML code to play an audio file using the HTML5 audio tag on IPhone.
<audio controls="controls" autoplay="autoplay">
<source src="http://192.168.1.130/ab.wav>" type="audio/wav" preload="auto"/>
Your browser does not support the audio element.
</audio>
The above code works perfectly fine over safari. The problem comes when I change the Source URL from HTTP to HTTPS.
I started getting "This movie could not be played" error message.
I am using a certificate chain which is as follows:
VeriSign Trial Secure Server Root CA - G2 -> VeriSign Trial Secure Server CA - G2 -> ucbu-aricent-vm200
The certificate of the Root CA (above) is not available in Safari by default.
So I had attached the certificate for the certificate authority (both Root and Intermediate) to an email, and then added them in IPhone by clicking the attachments in the email.
But still I see that the SSL Handshake fails when Safari created a TCP session to transfer the WAV file.
NOTE: The SSL handshake goes successful when the TCP session is created to fetch the HTML file from the server. I had compared the network packets of the SSL handshake of HTML and WAV file scenarios and both of them were identical.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
上面 ceejoyez 和 OP 都提到了这一点(谢谢你们!),但我几乎错过了它,因为它不是一个实际的答案:
如果您通过 https 提供内容,则需要拥有有效的证书,否则无法在 iOS 设备(或 Mac 上的 Safari)上播放。
有关相关问题,请参阅此处。
This was mentioned above by ceejoyez and again by the OP (Thank you both!), but I almost missed it as it wasn't an actual answer:
If you are serving the content over https you need to have a valid certificate or it will not play on iOS devices (or on Safari on a Mac).
See here for a related question.