Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 <video> element on Android does not play

Video tags like below plays fine with iPhone, but not Android:

<video id="video" width="320" height="240" poster="video/placeholder.jpg" autobuffer controls>
  <source src="pr6.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
  <source src="pr6.ogv" type='video/ogg; codecs="theora, vorbis"'>
</video>

With the above code, Android can't even click the clip. It would just see the poster image.

Video tag like below however works with Android:

<video src="vpr6.mp4" poster="video/placeholder.jpg" onclick="this.play();"/>

However, I still need to multiple sources capability (for Firefox ogv support…). Below code does not work (nor do they work if I stick the javascript into the source tags):

<video id="video" width="320" height="240" autobuffer controls onclick="this.play();">
  <source src="pr6.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
  <source src="pr6.ogv" type='video/ogg; codecs="theora, vorbis"'>
</video>

With above code, the clip is clickable in Android, but still does nothing.

Can anyone help?

like image 480
T1000 Avatar asked May 26 '10 08:05

T1000


People also ask

Does HTML5 video work on mobile?

What Is the HTML5 Video Tag? The `<video>` element is simply a tag used to embed video content in an HTML document. As of 2022 it is excellently supported across all modern browsers (both mobile and desktop), except for Opera Mini.

Why video is not playing in HTML5?

If you come across an HTML5 page with the following error message “file not found,” then it means your browser doesn't have the proper video codec installed. For example, if you are using Google Chrome and you come across an HTML5 MP4 video, then you may get an error message because you don't have an MP4 codec.

Why HTML video tag is not working?

There are 3 things to check: make sure your video files are properly encoded for web delivery. make sure the server where the videos are hosted is properly configured for web delivery. make sure your others scripts on the page do not interfere with video playback.


1 Answers

Try to remove the codecs from the source listings.. It might be that the codecs you're listing are not present on Android, so it's choking.

If you use the src attribute, it'll auto-detect the codec, so it's using something else :)

like image 66
Artiom Chilaru Avatar answered Sep 29 '22 21:09

Artiom Chilaru