简体   繁体   中英

HTML5 Video works in browser - but not in Android emulator

I am new to HTML5 Android development.

I am trying to play a local mp4 video file. The code is as follows:

<!DOCTYPE html>
<html>
<head>
<script src="scripts/jquery.mobile.min.js"></script>
</head>
<body>
  <video src="videos/video1.mp4" poster="videos/ph.jpg" onclick="this.play();"/>            
</body>
</html>

This works perfectly in browser, but in the Android emulator it brings the error:

MediaPlayer Error (1, -2147483648)

I've tried many different options, but nothing seems to work.

Video in emulators has been a fairly unreliable testing scenario. A lot depends on the capabilities and performance of your machine as well as the emulator. I have had more luck with x86 optimized images with hardware acceleration enabled and a robust codec set installed but it seems to be an area that's lacking in comprehensive support.

I've not been able to find a definitive set of MediaPlayer error return code that will help track down where the problems I've seen lie so on the whole I've given up trying to test video playback beyond very simple low bitrate mp4 on anything other than real devices

Try this,

 <video width="320" height="240" controls>
<source src="VIDEO.mp4" type="video/mp4">
</video> 

Also add the other jQuery sources.

What is the resolution of your video? The video may not play of it's too high. Also make sure it is correctly encoded for android devices.

http://developer.android.com/guide/appendix/media-formats.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM