简体   繁体   English

ios上的html5视频背景视频

[英]html5 video background video on ios

I have the following video that is part of a slider. 我有以下视频是滑块的一部分。

<div class="slide video-bg">
    <video muted webkit-playsinline playsinline poster="/video/3/4_Marching_band-HD_1080p.jpg">
        <source src="/video/3/4_Marching_band-HD_1080p.webm" type="video/webm">
        <source src="/video/3/4_Marching_band-HD_1080p.mp4" type="video/mp4">
        <source src="/video/3/4_Marching_band-HD_1080p.ogv" type="video/ogg">
    </video>
</div>

When the page loads, play() is called on the video. 页面加载后,将在视频上调用play() On every desktop browser I've tried this works great. 在所有台式机浏览器上,我都尝试过这种方法。 But on iOS the video never plays. 但是在iOS上,视频无法播放。

I've read https://webkit.org/blog/6784/new-video-policies-for-ios/ and tried to follow each requirement. 我已阅读https://webkit.org/blog/6784/new-video-policies-for-ios/并尝试遵循每个要求。 I even added the autoplay attribute to the video even though I want to control it with js. 即使我想用js控制它,我甚至将autoplay属性添加到视频中。 The video has no audio and is visible when the page loads. 视频没有音频,并且在页面加载时可见。 Any idea why it won't play on iOS? 知道为什么它不能在iOS上播放吗?

Page in question: http://heartland.thinkersites.com/products/ 有问题的页面: http//heartland.thinkersites.com/products/

Add this to your CSS to remove the unsightly play button from iOS devices: 将此添加到CSS即可从iOS设备上删除难看的播放按钮:

                *::-webkit-media-controls-panel {
                  display: none!important;
                  -webkit-appearance: none;
                }

                *::--webkit-media-controls-play-button {
                  display: none!important;
                  -webkit-appearance: none;
                }

                *::-webkit-media-controls-start-playback-button {
                  display: none!important;
                  -webkit-appearance: none;
                }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM