如何禁用视频标签上的自动海报图像生成?
我在视频标签上使用“海报”属性,它至少在 webkit 浏览器中的工作方式似乎是加载海报图像,然后一旦加载了足够的视频,它就会用自动替换该海报从视频文件本身生成海报。
然而,我的海报图像与自动生成的海报不匹配,这导致了一种奇怪的体验:加载一张图像,然后在几秒钟内被自动生成的图像替换。有什么办法可以防止自动生成的图像被使用吗?
I'm using the 'poster' attribute on a video tag and the way it seems to work at least in webkit browsers is that it loads the poster image and then once enough of the video has loaded, it replaces that poster with an auto-generated poster from the video file itself.
However, my poster images don't match the auto-generated posters which results in a weird experience of one image loading, then being replaced in a few seconds by the auto-generated image. Is there any way to prevent the auto-generated image from being used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们设法在 JW Player for HTML5。最简单的方法如下:
这会工作得很好,但它仍然意味着您在重播时会遇到问题,因为重新出现的海报图像不会与原始图像相同,除非您执行更多 JS 魔法。
另外值得注意的是,您不能在上放置任何内容。移动 Safari 中的标签。解决这个问题的方法:
希望这有帮助!
最佳,
扎克
开发者,长尾视频
We managed to get around this in the JW Player for HTML5. The easiest way is as follows:
This will work fine, but it still means that you'll have issues on replay, as the poster image that re-appears won't be the same as the original, unless you do some more JS magic.
Also worth noting that you can't place anything on top of the <video> tag in mobile Safari. The way to get around this:
Hopefully that helps!
Best,
Zach
Developer, LongTail Video
这就是 webkit 浏览器决定实现规范的方式(如上所述)。我同意你的观点,这不是很直观,而且我自己也更喜欢保留海报图像,直到用户点击播放按钮。我建议您向 webkit 提交错误报告(或功能请求)https://bugs.webkit.org/< /a> .
This is the way in which webkit browsers have decided to implement the spec (as cited above). I agree with you that it is not very intuitive and would myself also prefer to keep the poster image up until the user hits the play button. I suggest you submit a bug report (or feature request) to webkit for it https://bugs.webkit.org/ .
唯一的选择是确保视频的第一帧与海报相同,或者根本不使用它。
“当视频元素暂停并且当前播放位置是视频的第一帧时,该元素表示与当前播放位置对应的视频帧或海报帧,具体由用户代理决定。” -- http://www.w3.org/TR/ html5/video.html#attr-video-poster
Only option is to make sure first frame of your video is same as poster or not to use it at all.
"When a video element is paused and the current playback position is the first frame of video, the element represents either the frame of video corresponding to the current playback position or the poster frame, at the discretion of the user agent." -- http://www.w3.org/TR/html5/video.html#attr-video-poster