我可以在 iPhone 或 android 上避免使用 HTML5 的原生全屏视频播放器吗? [英] Can I avoid the native fullscreen video player with HTML5 on iPhone or android?

查看:24
本文介绍了我可以在 iPhone 或 android 上避免使用 HTML5 的原生全屏视频播放器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个网络应用程序,它使用 HTML5 标记和 JavaScript 代码呈现与正在运行的视频同步的其他内容.它适用于桌面浏览器:Firefox、Chrome 和 Safari.在 iPhone 或 DroidX 上,原生视频播放器会弹出并接管屏幕,从而遮蔽了我想与视频同时显示的其他动态内容.

I've built a web app that uses the HTML5 tag and JavaScript code that renders other content synchronized with the running video. It works great in desktop browsers: Firefox, Chrome, and Safari. On an iPhone or a DroidX, the native video player pops up and takes over the screen, thus obscuring the other dynamic content that I want to display simultaneously with the video.

有什么办法可以解决这个问题吗?如有必要,我会弄清楚如何为这两个平台编写本机应用程序,但如果我能坚持使用 HTML5/JavaScript,我将节省大量精力.

Is there any way around this? If necessary, I'll figure out how to write native apps for both those platforms, but it would save me a ton of effort if I could just stick with HTML5/JavaScript.

推荐答案

在 iOS 10+ 中

Apple 在 iOS 10 的所有浏览器中启用了属性 playsinline,因此可以无缝运行:

<video src="file.mp4" playsinline>

在 iOS 8 和 iOS 9 中

简短回答:使用 iphone-inline-video,它启用内嵌播放并同步音频.

In iOS 8 and iOS 9

Short answer: use iphone-inline-video, it enables inline playback and syncs the audio.

长答案:您可以通过浏览视频而不是实际.play()来模拟播放来解决此问题

Long answer: You can work around this issue by simulating the playback by skimming the video instead of actually .play()'ing it.

这篇关于我可以在 iPhone 或 android 上避免使用 HTML5 的原生全屏视频播放器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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