javascript - 全屏 API 不适用于 Chrome/iOS

标签 javascript ios google-chrome video

我试图在用户点击链接/按钮时全屏显示视频。这在桌面上运行良好,但在使用 chrome 的 iPad 上运行不佳。

根据这个http://caniuse.com/fullscreen有一些限制,但我在那张 table 上找不到 chrome/ios。

如果有人告诉我这是一个操作系统限制,我将非常感谢来自良好来源的链接。

这是一些代码:

HTML:

<video id="video1" width="420" controls>
    <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4" />
    <source src="http://www.w3schools.com/html/mov_bbb.ogg" type="video/ogg" />Your browser does not support HTML5 video.</video>

<button onclick="PlayFunction();">PLAY</button>

Javascript:

 function PlayFunction()
{
        launchFullScreen(document.getElementById("video1")); // any individual element);
    $("#video1")[0].play();

}function launchFullScreen(element) {  
      if (element.requestFullScreen) {
        element.requestFullScreen();
    } else if (element.mozRequestFullScreen) {
        element.mozRequestFullScreen();
    } else if (element.webkitRequestFullScreen) {

        element.webkitRequestFullScreen();
    }
    else if (element.msRequestFullscreen) {
        element.msRequestFullscreen();
    } else if (element.webkitRequestFullscreen) {

        element.webkitRequestFullscreen();
    } else {

        alert("no cai en ningun lado");
    }
}

JSfiddle:http://jsfiddle.net/9aSjn/16/

最佳答案

根据此链接http://www.mobilexweb.com/blog/chrome-ios-android-4-1-jelly-bean-html5 :

That’s is because Chrome for iOS is not Chrome. What?? It has a Chrome-style UI, onmibox, search by voice and it has Chrome synching. However, the rendering and execution engine are not Chrome.

I called them pseudo-browsers and you can see my opinion and a good discussion on the comments area in my previous post. So Chrome for iOS is in fact using the iOS Web View that share most of the code with Safari.

The User Agent that Chrome for iOS is using is the Safari one with one addition: “CriOS” (Chrome for iOS I guess). There is no “Chrome” word inside the User Agent, so if you are doing something special for Chrome, you are safe and it’s not going to be executed on Chrome on iOS.

结论,当您在 iOS 上使用 Chrome 时,您正在使用 Safari,这就是它没有出现在 caniuse 表中的原因。

关于javascript - 全屏 API 不适用于 Chrome/iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20602467/

相关文章:

google-chrome - 资源解释为文档,但使用 MIME 类型 image/jpeg 传输

javascript - Ember.js 中的 SortBy 不适用于新创建的项目

ios - CGAffineTransform 应用附加旋转

javascript - 在 Leaflet 的事件回调中设置图层类名

ios - com.apple.developer.icloud-container-identifiers 和 com.apple.developer.ubiquity-container-identifiers 之间的区别

ios - 我不断收到使用未解析的标识符错误

java - Chrome 和 Firefox 中的 httpServletResponse 行为

php - HTML:单引号在本网站上显示为空格,但仅在某些浏览器中显示(即在桌面上的 Chrome 中,但在 iOS 上的 Safari 中不显示)

javascript - 带有 Gmail 和 NodeJS 的 Nodemailer

javascript - 将表单输入传递给 highcharts 然后重建图表