HTML html5 tag not working on android phone

I have created an app in android phonegap. I want to play video using html5 video player. My code:

<!DOCTYPE html>
      <title>Video.js | HTML5 Video Player</title>
      <link href="" rel="stylesheet" type="text/css"> 
      <script src=""></script>
      <video id="example_video_1" class="video-js vjs-default-skin" controls preload="none" width="640" height="264" poster="" data-setup='{"controls":true}'>
        <source src="" type='video/mp4' />
        <source src="" type='video/webm' />
        <source src="" type='video/ogg' />


This code shows the video player. but the video doesn't play when the play button is pressed. What mistake? please guide me. thanks in advance.


source to share

6 answers

You said it didn't work on the emulator, right? Don't you think the video isn't playing mainly because you probably don't have hardware acceleration on the Android SDK emulator? Some things don't work as expected (sometimes don't work at all) unless you have HW acceleration and a device powerful enough for it.

If this is the case, the workaround is using 3GP video. This should work the Android SDK emulator as well on older Android mobiles with weak hardware. I used this on my project.



When you use Video tag to play video in phonegap app, it works fine on iphone but not Android.



In addition to what ghostCoder says below (adding a video playback click handler you need to do for Android), also try uninstalling type='video/mp4'

as it confuses Android sometimes.



Add android: hardwareAccelerated = "true" as a child in the activity manifest file. It plays html5 videos inside webviews without any workarounds.


    android:configChanges="keyboardHidden|orientation|screenSize" >




try something like this

var video = document.getElementById('video');




Are you sure the video stream is "H.264" and the "AAC" audio stream for MP4. Because I assume Android MP4 support



All Articles