Video and audio tag in HTML5 for android
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)
Huh. I’ve no experience with Android, but that does look like it should work, according to Dive into HTML5.
- http://fortuito.us/diveintohtml5/video.html
- http://fortuito.us/diveintohtml5/video.html#what-works
- http://fortuito.us/diveintohtml5/video.html#android
- http://fortuito.us/diveintohtml5/video.html#video-mime-types
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?
精彩评论