适用于 Android 的 HTML5 中的视频和音频标签
我在使用 Android 浏览器的 HTML5 将视频和音频嵌入网页时遇到问题。 有两件事我不确定:
- android 浏览器支持的编解码器
- 我应该使用什么 javascript 回调
这是我写的,但它不起作用。 (但是,它可以在桌面上运行。)
<audio src="x.mp3" controls>
Your browser does not support the audio element.
</audio>
<br/>
<video src="y.mp4" controls>
your browser does not support the video tag
</video>
我尝试使用 jQuery 的 jPlayer 插件。它可以与音频 (.mp3) 和演示视频 (.m4v) 配合使用。但是它不适用于我的视频。我尝试对其进行编码但没有成功。 这是演示视频的规格(有效):
major_brand : M4VP
minor_version : 1
compatible_brands: M4VPM4A mp42isom
Duration: 00:00:33.04, start: 0.000000, bitrate: 941 kb/s
Stream #0.0(eng): Audio: aac, 44100 Hz, stereo, s16, 127 kb/s
Stream #0.1(eng): Video: h264, yuv420p, 480x270, 824 kb/s, 25 fps, 25 tbr, 600 tbn, 1200 tbc
这是我的视频:(
major_brand : mp42
minor_version : 0
compatible_brands: mp42isom
Duration: 00:00:30.24, start: 0.000000, bitrate: 534 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 480x320 [PAR 1:1 DAR 3:2], 404 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 127 kb/s
这是 ffmpeg 的输出)
I'm having problems with embedding video and audio into a web page using HTML5 for Android browser.
Two things i'm not sure about:
- The codecs that android browser supports
- What javascript callbacks should I use
This is what I wrote, and it’s not working. (However, it works on the desktop.)
<audio src="x.mp3" controls>
Your browser does not support the audio element.
</audio>
<br/>
<video src="y.mp4" controls>
your browser does not support the video tag
</video>
I tried to use jPlayer plugin for jQuery. It works fine with the audio (.mp3) and with the demo video(.m4v). However it don't work with my video. I tried encoding it with no success.
Thats the spec of the demo video(that works):
major_brand : M4VP
minor_version : 1
compatible_brands: M4VPM4A mp42isom
Duration: 00:00:33.04, start: 0.000000, bitrate: 941 kb/s
Stream #0.0(eng): Audio: aac, 44100 Hz, stereo, s16, 127 kb/s
Stream #0.1(eng): Video: h264, yuv420p, 480x270, 824 kb/s, 25 fps, 25 tbr, 600 tbn, 1200 tbc
and this is my video:
major_brand : mp42
minor_version : 0
compatible_brands: mp42isom
Duration: 00:00:30.24, start: 0.000000, bitrate: 534 kb/s
Stream #0.0(eng): Video: h264, yuv420p, 480x320 [PAR 1:1 DAR 3:2], 404 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0.1(eng): Audio: aac, 44100 Hz, stereo, s16, 127 kb/s
(it's the output from ffmpeg)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
呵呵。我没有使用 Android 的经验,但根据 Dive into HTML5 的说法,这看起来确实应该可行。
视频的格式/配置文件等是否正确?是否使用正确的 MIME 类型提供服务?您正在哪个版本的 Android 上进行测试?
Huh. I’ve no experience with Android, but that does look like it should work, according to Dive into HTML5.
Is the video in the right format/profile etc? Is it being served with the right MIME type? Which version of Android are you testing on?