HTML5 音频标签是否支持从另一个域提供 mp3?
因此,我有一个带有 domian“www.example.com”的 Web 应用程序,需要提供来自“www.example2.com”的音频,但由于某种原因,这不起作用(音频只是不流式传输)
< ;audio src="http://www.example2.com/song.mp3" 控制预加载>
鉴于如果我将声源 url 直接放入浏览器中,则
任何人都 可以使用音频试过这个吗?谢谢瓦埃尔
So I am having a web application with domian "www.example.com" that needs to serve audio from "www.example2.com", but for some reason this is not working (the audio just does not stream)
<audio src="http://www.example2.com/song.mp3" controls preload></audio>
Given that if I put the sound source url directly into the browser the audio will be available
Anyone tried this? thanks
Wa'el
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
显然我不能投票赞成 CyberK 的回应(还没有这样做的声誉),但我同意他的观点。您不能进行
或
跨域。我在 Chrome 和 Firefox 上都尝试过这个方法。关于此的文章不止几篇。今天我自己找出来;对限制不满意。
http://www.bluishcoder.co .nz/2008/11/video-audio-and-cross-domain-usage.html
Apparently I cannot vote up CyberK's response (don't have the reputation yet to do so) but I agree with him. You cannot do
<audio>
or<video>
cross-domain. I have tried this exact thing on both Chrome and Firefox. There are more than a couple of articles about this. Finding this out for myself today; not happy with the restriction.http://www.bluishcoder.co.nz/2008/11/video-audio-and-cross-domain-usage.html
我认为 HTML5 不允许您从其他托管提供商/服务器获取源。也许它仅限于您的域,但我不是 100% 确定...我确实提醒,这个 html5 元素有一点限制...
I think HTML5 does not allow you to take a source from another hosting provider / server. Maybe it's limited to your domain but I'm not 100% sure... I do remind that there was a little limitation about this html5 element...
您需要做一些测试,但我认为它确实有效,但您可能在某些操作和查询方面遇到困难
例如,您可能能够开始/暂停/停止,但不能检查标题或长度,因为可能是 XSS 的一种形式
You would need to do some tests but I reckon that it does work, but you may have difficulties with certain actions and queries
Example, you may be able to start/pause/stop but not check the title or the length since that could be a form of XSS
FF 和 Chrome 不支持,但 IE11 支持。
我认为W3C应该有一个关于跨域的解决方案,毕竟这是一个完全合理的要求。
FF and Chrome do not support it, but the IE11 do.
I think W3C should have an solution about cross domain, after all it is a completely reasonable request.