IOS 11上的HTML5视频标签 [英] HTML5 video tag on IOS 11
问题描述
我的网站中有一个视频元素的工作代码,该代码在ios 9/10和所有常规浏览器(chrome/ff/ie)等上均可正常运行.
I have working code for a video element within my site thats fully functioning on ios 9/10 and all the normal browsers (chrome/ff/ie) etc.
我注意到,由于ios 11更新,视频不再播放甚至无法播放.它们显示为带有控件的空白框,但是按Play键不起作用,而全屏打开视频则不起作用.
I've noticed that since the ios 11 update the videos no longer play or even work at all. They appear as a blank box with the controls but pressing play does nothing and opening the video full screen does nothing.
这是我相对简单的代码
<video playsinline onclick="play()" controls autoplay
controlsList="nodownload">
<source src="assets/images/video_im.mp4" type="video/mp4">
</video>
我尝试了使用playsinline ="true"和controls ="true"的不同变体.它们没有效果.
I've tried different variations of using playsinline="true" and controls="true". They have no effect.
我已经尝试过搜索该问题,但是除了播客有关ios 11删除了html5视频支持外,似乎什么都没有,当然有解决办法了吗?
I've tried to google the issue but there seems to be nothing except a podcast taking about ios 11 removing html5 video support, surely there is a fix?
任何见解/帮助将不胜感激.
Any insight/help would be much appreciated.
欢呼
推荐答案
它看起来像下面的代码:
It looks like the following code:
<video>
<source src="path/to/video.mp4">
</video>
停止在ios11上工作(也具有许多其他功能...).我确认source
标记在ios9上确实起作用).尝试直接将src="path/to/video.mp4"
放入video
标记中,它应可在ios11上使用.
stopped working on ios11 (with many other features too...). I confirm that source
tag did work on ios9 here). Try placing the src="path/to/video.mp4"
into the video
tag directly, it should work on ios11.
摘自关于新视频的webkit.org帖子的工作示例iOS政策:
<div id="either-gif-or-video">
<video src="image.mp4" autoplay loop muted playsinline></video>
<img src="image.gif">
</div>
MacOS上的Safari似乎也有类似的问题,也许在那里进行测试更容易.看来我们失去了多个来源功能tho:(
Safari on MacOS seems to have a similar problem, maybe it's easier to test there. Looks like we lost the multiple source feature tho :(
这篇关于IOS 11上的HTML5视频标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!