iPhone 和 iPad/浏览器上的 HTML5 内嵌视频 [英] HTML5 inline video on iPhone vs iPad/Browser

查看:36
本文介绍了iPhone 和 iPad/浏览器上的 HTML5 内嵌视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个 HTML5 视频播放器(非常简单),可以在 iPad 和浏览器上完美运行.

I've created an HTML5 video player (very simple) that works perfectly on the iPad and the browser.

但是,当我在 iPhone 上打开它时,我只会得到一个播放按钮,按下该按钮时,会在我所有内容的顶部打开本机视频播放器.

However, when I open it on the iPhone, I only get a play button which, when pressed, opens the native video player on a new window, on top of all my stuff.

这意味着我无法访问我的自定义控件和时间跟踪(用 Javascript 编写),因为视频现在是孤立运行的.

That means I lose access to my custom controls and time tracking (written in Javascript), since the video is now running isolated.

有什么方法可以在 iPhone 上覆盖 Apple 对 HTML5 视频的控制并让它像在 iPad 上一样工作?

Is there any way to override Apple's control of HTML5 video on the iphone and get it working like on the ipad?

干杯

推荐答案

对了,

我对此无能为力,并向 Apple 提交了一个错误.

I was going nowhere with this and filed a bug with Apple.

几周后,他们回复我说,非常简单,我应该在 HTML 的视频标签中添加webkit-playsinline",并在 UIWebView 上添加allowsInlineMediaPlayback"属性.

After a couple of weeks they got back to me saying, very simply, that I should add "webkit-playsinline" to the video tag on the HTML, as well as adding the "allowsInlineMediaPlayback" property on the UIWebView.

最后,这是它的样子:

HTML

<video id="player" width="480" height="320" webkit-playsinline>

对象-C

webview.allowsInlineMediaPlayback = YES;

一切正常:)

希望这对某人有所帮助,因为它几乎没有记录,而且我能找到对webkit-playsinline"的唯一引用是在 iAds 参考中,它说:仅 iAds JS".

Hope this helps someone, as it's virtually undocumented and the only place I could find a reference to "webkit-playsinline" was in the iAds reference, where it says: "iAds JS only".

这篇关于iPhone 和 iPad/浏览器上的 HTML5 内嵌视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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