HTML5视频不能在iPad上工作 [英] html5 video not working on ipad

查看:429
本文介绍了HTML5视频不能在iPad上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应该在ipad上运行的html5视频。控件必须隐藏,用户点击ipad时,必须播放html5视频。

我正在使用html5video.js我在ipad上看到的只是海报图片,当我点击ipad时,没有任何反应。下面是我的代码

 <!doctype html> 
< html>
< head>
< meta name =viewportcontent =width = 768px,minimum-scale = 1.0,maximum-scale = 1.0/>
< link href =http://vjs.zencdn.net/c/video-js.css =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 =videoclass =video-js vjs-default-skinpreload =autowidth =620height =860poster =img / poster.pngdata-设置= {} >
< source src =video / Motion.mp4type ='video / mp4'>
< / video>
< / body>
< / html>


解决方案

您是否使用正确的MIME类型提供视频? Dive Into HTML 5中出色的 Video On The Web 文章涵盖了您需要了解的有关提供视频服务的所有信息。沿着文章的底部(通过所有编码帮助)覆盖 iPhone和iPad问题以及需要正确的MIME类型。这是非常值得的完整阅读。



编辑



Accept-Ranges:bytes 必须包含HTTP响应标头,请参阅: Safari Web内容指南 - 配置您的服务器


I have an html5 video that should work on ipad. Controls must be hide and on user tap on the ipad, the html5 video must play.

I am using html5video.js What I can see on ipad is only the poster image and when I tap the ipad, nothing happens. below is my code

<!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>

解决方案

Are you serving the video with the correct MIME type? The excellent Video On The Web article by Dive Into HTML 5 covers everything you need to know about serving Video. Way down the bottom of the article (past all the encoding help) covers issues with iPhones and iPads as well as the need for the correct MIME type. It's well worth the full read.

EDIT

To work with iOS the Accept-Ranges: bytes HTTP response header must be included, see: Safari Web Content Guide - Configuring Your Server

这篇关于HTML5视频不能在iPad上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆