HTML5 和音频标签:不包含文件扩展名的重定向链接无法在 FF/Chromium 中加载
我有一个关于
我们有要使用相应的 HTML5
以下代码是网页中应显示 HTML5 播放器的部分:
<div class="mainContent">
<audio id="aud1" height="360" width="640" autoplay="false" controls="controls" tabindex="0">
<source type="audio/ogg" src="http://localhost:1234/a/b/cdefg/Xyz"></source>
Your browser does not support HTML5.
</audio>
<div class="divider"></div>
<a class="homeLink" href="/index.html">Take me back to the Homepage</a>
</div>
正在播放的媒体肯定是纯音频 OGG 文件。
我已经在 Ubuntu 10.04 FF5.0、Chromium 12.0.742.91 (87961) 和 Opera 11.50 上测试了此代码,结果如下:
- FF: 不播放
- Chromium: 不播放
- Opera: 好的
我集成了一个小的脚本来显示 HTMLMediaElement 的不同属性(属性:networkState、readyState,请参阅),产生以下结果:
- FF => networkState: NETWORK_LOADED(媒体源加载完毕),readyState: HAVE_NOTHING(没有可播放的媒体)
- Chromium => networkState: NETWORK_LOADED(媒体源加载完毕),readyState: HAVE_NOTHING(没有可播放的媒体)
- Opera => networkState:NETWORK_IDLE,readyState:HAVE_ENOUGH_DATA
(请注意,不同状态的描述来自 Safari 开发站点:http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLMediaElementClassReference/HTMLMediaElement/HTMLMediaElement.html)
如果我插入src 直接指向纯音频 OGG 文件(例如 http://en.wikipedia.org/wiki/File:Tromboon-sample.ogg),然后它按预期工作。 FF 和 Chromium 似乎在不包含最终文件名的链接方面存在问题?
有人对此有想法或提示吗?
干杯, 克里斯
I have an annoying problem regarding the <audio> tag and FF/Chromium as media won't be played back when I would expect it to. Opera seems to handle it correctly.
We have audio media to be played back using the corresponding HTML5 <audio> tag. The <source> tag includes media in an audio-only OGG container.
However, the file-extension ogg is not in the src-attribute, so src-links look like http://localhost:1234/a/b/cdefg/Xyz (Restful API using redirection to get the actual media file).
The following code is the part of the web page that should display the HTML5 player:
<div class="mainContent">
<audio id="aud1" height="360" width="640" autoplay="false" controls="controls" tabindex="0">
<source type="audio/ogg" src="http://localhost:1234/a/b/cdefg/Xyz"></source>
Your browser does not support HTML5.
</audio>
<div class="divider"></div>
<a class="homeLink" href="/index.html">Take me back to the Homepage</a>
</div>
The media being played back is definitely a audio-only OGG file.
I have tested this code on Ubuntu 10.04 FF5.0, Chromium 12.0.742.91 (87961) and Opera 11.50 with the following results:
- FF: doesn't play back
- Chromium: doesn't play back
- Opera: OK
I've integrated a small script to display different attributes of the HTMLMediaElement (attributes: networkState, readyState, see) yielding the following results:
- FF => networkState: NETWORK_LOADED (media source finished loading), readyState: HAVE_NOTHING (no media available for playback)
- Chromium => networkState: NETWORK_LOADED (media source finished loading), readyState: HAVE_NOTHING (no media available for playback)
- Opera => networkState: NETWORK_IDLE, readyState: HAVE_ENOUGH_DATA
(Note that the descriptions for the different states are from the Safari Dev site: http://developer.apple.com/library/safari/#documentation/AudioVideo/Reference/HTMLMediaElementClassReference/HTMLMediaElement/HTMLMediaElement.html)
If I insert a src which directly points to an audio-only OGG file (like http://en.wikipedia.org/wiki/File:Tromboon-sample.ogg), then it works as expected.
It seems as if FF and Chromium seems to have issues with links not including the final file name?
Does anyone have an idea or hint about this?
Cheers,
Chris
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我知道您已经修复了它,但请确保您没有错过任何 MIME 类型:
HTML5
HTML5
HTML5
I know you already fixed it, but make sure you didnt miss any MIME types:
HTML5
<video>
HTML5
<audio>
HTML5
<video>
<audio>