背景视频无法在手机上玩?(Background video does not play on mob

2019-10-24 03:13发布

我做了其中视频播放在窗体的背景的登陆页。
它的工作在台式机上正常,但我使用Chrome,背景视频不能发挥它检查了我的Android设备上。

谁能帮我解决这个问题。

这里是链接到我的小提琴 。

HTML:

   <p>
<video autoplay="" id="video" loop=""><source src="http://www.mygreencity.in/Enquiry.mp4" type="video/webm" /> <source src="Enquiry.mp4" type="video/mp4" /></video>
</p>  

<form action="" class="form" method="post">


<p><input name="enq_name" placeholder="Full Name" required="" type="text" autocomplete="off" alt="Full Name" title="Full Name"/></p>

<p><input name="enq_mobile" placeholder="Mobile Number" required="" type="number" autocomplete="off" alt="Number" title="Number"/></p>

<p><input name="enq_email" placeholder="Email" required="" type="email" autocomplete="off" alt="Email ID" title="Email ID"/></p>
<input class="button button-block" name="enq_submit" type="submit" value="Go To Site" alt="Go To Site" title="Go To Site"/></form>

CSS:

    *, *:before, *:after {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
}

body {
  background: #fff;
  font-family: 'Titillium Web', sans-serif;
}

a {
  text-decoration: none;
  color: #1ab188;
  -webkit-transition: .5s ease;
          transition: .5s ease;
}
a:hover {
  color: #179b77;
}

.form {
  background: rgba(19, 35, 47, 0.9);
  padding: 40px;
  max-width: 600px;
  margin: 80px auto;

  border-radius: 4px;
  box-shadow: 0 4px 10px 4px rgba(19, 35, 47, 0.3);
}


h1 {
  text-align: center;
  color: #ffffff;
  font-weight: 300;
  margin: 0 0 40px;
}

label {
  position: absolute;
  -webkit-transform: translateY(6px);
      -ms-transform: translateY(6px);
          transform: translateY(6px);
  left: 13px;
  color: rgba(255, 255, 255, 0.5);
  -webkit-transition: all 0.25s ease;
          transition: all 0.25s ease;
  -webkit-backface-visibility: hidden;
  pointer-events: none;
  font-size: 22px;
}

input, textarea {

  font-size: 22px;
  display: block;
  width: 100%;
  height: 100%;
  padding: 5px 10px;
  background: none;
  background-image: none;
  border: 1px solid #a0b3b0;
  color: #ffffff;
  border-radius: 0;
  -webkit-transition: border-color .25s ease, box-shadow .25s ease;
          transition: border-color .25s ease, box-shadow .25s ease;
}
input:focus, textarea:focus {
  outline: 0;
  border-color: #1ab188;
}

textarea {
  border: 2px solid #a0b3b0;
  resize: vertical;
}


.button {
  border: 0;
  outline: none;
  border-radius: 0;
  padding: 15px 0;
  font-size: 2rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  background: #1ab188;
  color: #ffffff;
  -webkit-transition: all 0.5s ease;
          transition: all 0.5s ease;
  -webkit-appearance: none;
}
.button:hover, .button:focus {
  background: #179b77;
}

.button-block {
  display: block;
  width: 100%;
}

.forgot {
  margin-top: -20px;
  text-align: right;
}

p {
margin-bottom: 40px;
}


video { 
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    transform: translateX(-50%) translateY(-50%);
  background: #fff;
  background-size: cover;
  transition: 1s opacity;
}

div{
margin:20px;
}

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}

input[type=number] {
-moz-appearance: textfield;
}

Answer 1:

你应该有这样的一看jQuery插件 。

否则,而不是仅由具有.mp4格式,你应该提供一些.webm.ogv格式的替代方案以及有过浏览器和设备更好的兼容性 。 你也应该有这样的一个“后备”形象poster="videos/poster.png"在下面的例子。 如果没有这些格式将与所使用的浏览器/平台的作品,这个图像显示,而不是视频。

您将有您的视频转换.webm.ogv

正如我还是我自己找一个好的转换工具(转换和东西后没有多余的丑陋一面旗帜),我不能给你这个了一些建议。

<video id="bgVideo" autoplay poster="videos/poster.png">
    <source src="http://www.mygreencity.in/Enquiry.mp4" type="video/mp4"/>
    <source src="http://www.mygreencity.in/Enquiry.webm" type="video/webm"/>
    <source src="http://www.mygreencity.in/Enquiry.ogv" type="video/ogg"/>    
</video>

祝好运'



Answer 2:

CSS:

#section-video video {
   display: block; 
}

给diplay块,而不是在没有相应的css文件。



Answer 3:

您需要为您的视频元素的情侣更多的属性

<video autoplay loop muted playsinline id="video-background" poster="images/poster.jpg">

Safari和Chrome浏览器在移动设备上的行为如何视频移动所做的更改。 默认情况下,当视频静音它只能自动播放。 但对于WebKit的/ IOS还需要第二个属性; playsinline。 此属性使得它,使它发挥内联,而不是跳跃到全屏视频。

另外,请确保您的移动设备没有在低功耗模式下运行,如果你如果你对Android版Chrome,数据保护模式也可以防止自动播放中定位iOS 11.因而不会显示视频。 有没有无论如何解决这个问题。



文章来源: Background video does not play on mobile?