我有一个
html5视频应该在ipad上工作.控件必须隐藏,用户点击ipad,html5视频必须播放.
我正在使用html5video.js我可以看到在ipad只是海报的形象,当我点击ipad,没有任何反应.下面是我的代码
<!doctype html>
<html>
<head>
<Meta name="viewport" content="width=768px,minimum-scale=1.0,maximum-scale=1.0" />
<link href="http://vjs.zencdn.net/c/video-js.css" rel="stylesheet">
<script src="http://vjs.zencdn.net/c/video.js"></script>
<script>
var video = document.getElementById('video');
video.addEventListener('touchstart',function(){
video.play();
},false);
</script>
</head>
<body>
<video id="video" class="video-js vjs-default-skin" preload="auto" width="620" height="860" poster="img/poster.png" data-setup="{}">
<source src="video/Motion.mp4" type='video/mp4'>
</video>
</body>
</html>
解决方法
您正在使用正确的MIME类型投放视频吗? dive Into HTML 5中出色的
Video On The Web文章涵盖了您需要了解有关投放视频的所有内容.文章底部的方式(过去所有的编码帮助)涵盖
issues with iPhones and iPads以及
need for the correct MIME type.值得全面阅读.
编辑
要使用iOS,必须包括Accept-Ranges:bytes HTTP响应头,请参阅:Safari Web Content Guide – Configuring Your Server