ipad html5 player not found,html5 video not working on ipad

问题

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

var video = document.getElementById(\'video\');

video.addEventListener(\'touchstart\',function(){

video.play();

},false);

回答1:

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

回答2:

Try this trick (void user to tap screen):

document.addEventListener('touchstart', function(event) {

video.play();

// They use this first touch/click event for buffering others video.

// with this trick

video2.play();

video2.pause();

// After in your program you can call from 'code' play video.

// Sum of success buffering per one click is 3 ~ 6 ( android or ios ).

}, false);

For me works on android tablet samsung , iphone and ipad 2/3.

Updated :

With new version of browsers also autoplay is enabled by default, you need to put attribute mute for success.

There is no final solution. For example firefox version 64 on mac don't support but same version on linux support autoplay. And so long...

回答3:

In my case the MIME type was correct but my server was not allowing the client to request partial files with the Range HTTP header.

So the server must send "Accept-Ranges: bytes" when you request that mp4 file, the iPad will refuse to download that file if it is forced to download it entirely.

回答4:

I had the same problem. The video wasn't playing only on iPad and iPhone4. Nothing worked. Finally I discovered that my .mp4 file was in wrong format. I didn't create that file. After I converted it once again to mp4 format it worked.

来源:https://stackoverflow.com/questions/10511006/html5-video-not-working-on-ipad

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值