禁用全屏iphone视频 [英] Disable fullscreen iphone video
问题描述
现在连续几天都在为这个问题苦苦挣扎...
Struggling with this problem for a few days in a row now...
有什么方法或黑客"可以禁用在 iPhone 上的 Safari 上全屏播放视频.当然,我已经尝试过 'webkit-playsinline' 属性,但这只能在您自己的应用中使用.
Is there any way or 'hack' to disable playing video fullscreen on Safari on a iPhone. Of course I already tried the 'webkit-playsinline' attribute, but this will only work in your own app.
见:
<video class="" poster="" webkit-playsinline>
<source src="" type="video/ogg" preload="auto">
<source src="" type="video/mp4" preload="auto">
</video>
我也尝试将视频放在画布上,但由于它看起来像视频作为画布 drawImage() 方法的来源,目前在 iOS 上不受支持.
Also I've tried to put the video on canvas, but as it looks video as a source for the canvas drawImage() method is not currently supported on iOS.
我可以使用任何其他方式或替代技术吗?还是我最近几天真的浪费了时间?
Is there any other way or alternative technique I can use? Or did I really waste my time the last few days?
推荐答案
在 iOS 10+ 中
Apple 终于在 iOS 10 的所有浏览器中启用了 playsinline
属性,因此这将无缝运行:
In iOS 10+
Apple finally enabled the attribute playsinline
in all browsers on iOS 10, so this will work seamlessly:
<video src="file.mp4" playsinline>
在 iOS 8 和 iOS 9 中
您可以通过浏览视频而不是实际.play()
来模拟播放来解决这个问题.
In iOS 8 and iOS 9
You can work around this issue by simulating the playback by skimming the video instead of actually .play()
'ing it.
简而言之,使用iphone-inline-video,它负责播放和音频同步(如果有),并保持 正常工作.
In short, use iphone-inline-video, it takes care of the playback and audio sync (if any), and it keeps the <video>
working as it should.
这篇关于禁用全屏iphone视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!