Video auto adjustable

0

I'm using HTML5 which in turn has a tag called <video> but I'm having a hard time using my video in the header of my site because I can not manipulate my video correctly I would like my video to stay like the site  I even have to put the values of the height in my code soon if I get a smaller screen the video becomes great if I put in a bigger screen my video becomes small realize that the video of this site there he is self adjustable and he is always 100% of width and height follows an example of the way I did it, but not very sure, because cast height values with the tag transform:scale(); I think it's wrong:

header {
  position: relative;
  top: 0;
  overflow: hidden;
  width: 100%;
  height: 90%;
  min-height: 850px;
}
video {
  height: 760.4375px;
  width: 100%;
  z-index: -10;
  top: 0;
  left: 0;
  -webkit-transform: scaley(1.72);
  -o-transform: scaley(1.72);
  -ms-transform: scaley(1.72);
  -moz-transform: scaley(1.72);
  transform: scaley(1.72);
  z-index: -2;
  position: absolute;
}
#bg-video {
  overflow-y: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url(../images/overlay.png);
  z-index: 1
}
.texto-header {
  position: absolute;
  top: 20%;
  left: 50%;
  margin-left: -280px;
  width: 630px;
  text-align: center;
  z-index: 2;
  color: #FFF;
}
.texto-header h1 {
  font-family: Gabriola;
  font-size: 4em;
}
.texto-header strong {
  color: #f80;
}
.texto-header p {
  /*font-family: 'Scada', sans-serif;*/
  font-family: Gabriola;
  font-size: 1.2em;
  line-height: 20px;
  margin-top: -5%;
}
.texto-header a {
  color: #fff;
  background: transparent;
  border: 2px solid #fff;
  padding: 13px;
  font-family: Gabriola;
  font-size: 1.2em;
  border-radius: 5px;
}
.texto-header a:hover {
  color: #000;
  background-color: #fff;
}
<header>
  <div id="video">
    <video id="Video1" class="bgvid" loop autoplay>
      <source src="video/League-warrios.mp4" type="video/mp4" />desculpe mais seu navegador não suporta este formato ou esta desatualizado :(
    </video>
  </div>
  <div id="bg-video"></div>

  <div class="texto-header">
    <h1>Olá amigos somos a <strong>Nova Era !</strong></h1>
    <p>dolor sit amet, consectetur adipiscing elit. Sed at risus neque.
      <br>Cras sit amet ligula ut justo commodo porta id ut enim. Nulla est lectus, mollis sit amet vehicula id, volutpat eget mauris.</p>
    <br/>
    <a href="#circulo">Então podemos começar ???</a>
  </div>



</header>

NOTE: My video has a background like the one mentioned above that is called overlay and I do not care if I have to manipulate the video via java script because I no longer know what to do to get the result I want. >     

asked by anonymous 22.07.2015 / 16:57

1 answer

0

I found the answer I could do, I'll answer my own post because if anyone needs it one day this post can help:

<div id="video-bg">
      <video autoplay loop id="volume-js">
        <!-- Default video source: -->
        <source type="video/mp4" src="video/myvid.mp4"
                media="(orientation:landscape)">
      </video>
    </div>

o css:

#video-bg {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
}

#bg-video{
  background-image: url(../images/overlay.png);
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
}

#video-bg > video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}

/* 1. No object-fit support: */
@media (min-aspect-ratio: 16/9) {
  #video-bg > video { height: 300%; top: -100%; }
}

@media (max-aspect-ratio: 16/9) {
  #video-bg > video { width: 300%; left: -100%; }
}

/* 2. If supporting object-fit, overriding (1): */
@supports (object-fit: cover) {
  #video-bg > video {
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
  }
}

This code will leave the video full screen 100% x 100% without losing resolution or quality it does not stretch the video and does not distort (however the video has to be of quality) = 3

    
23.07.2015 / 13:58