简体   繁体   中英

html5 video tag on Android gives black screen

I'm trying to setup a mobile website and testing Android devices. I can get the h264 video to load and play but I have a black screen. The code is quite simple:

<video id='myfileplayer2' src='mysite/mobile/video.mp4' width='280' height='200'  controls></video>

Any ideas?

I also tried some javascript as suggested from some searches:

var video = document.getElementById('myfileplayer2');
  video.addEventListener('click',function(){
  video.play();
},false);

This works for me:

<style type="text/css">       
    #Video1
    {
     position:fixed;
     top: 0px;
     left:0px;        
     width: 100%;       
     border:0px;
     display:block;
     }

    </style>
</head>
    <body>        
       <video id="Video1" preload="metadata" autobuffer autoplay>
        <source src="5xyz.mp4" type="video/mp4" />
        <source src="//5xyz.webm" type="video/webm"/>
<source src="//5xyz.ogv" type="video/ogg"/>
       </video>

<script>
var Video1 = document.getElementById('Video1');
Video1.addEventListener('click',function(){
  Video1.play();
},false);
</script>

This work for me, just click in the black screen. My question is the same of your, how to CHANGE this black screen for some "play button" image.... Anyone?

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