简体   繁体   English

Android上的html5视频标签显示黑屏

[英]html5 video tag on Android gives black screen

I'm trying to setup a mobile website and testing Android devices. 我正在尝试建立一个移动网站并测试Android设备。 I can get the h264 video to load and play but I have a black screen. 我可以加载和播放h264视频,但是我有黑屏。 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: 我还尝试了一些搜索所建议的一些javascript:

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? 我的问题与您相同,如何更改某些“播放按钮”图像的黑屏...。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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