1
I put a video as background of a site with HTML 5, I open in Chrome and Firefox on Windows and the video rolls normal, but when I open on Mac (Chrome version 67.0.3396.40, and Safari 11.1) the video does not roll... Does anyone know any solution?
HTML:
<div class="wrap">
<div class="bg-video">
<video autoplay loop src="images/video-serv.mp4"></video>
</div>
</div>
CSS:
.wrap {
/*Ajuste a largura e altura desejadas aqui*/
width: 100%;
height: 100%;
/*isto fará o elemento video e o .container se adaptarem ao .wrap*/
position: relative;
}
.wrap > .bg-video {
position: absolute;
top: 0;
left: 0;
z-index: -1; /*apenas um -1 é necessário quando se trabalha com relative + absolute, sendo pai e filho*/
width: 100%;
height: 100%;
overflow: hidden; /* evita do video passar a altura desejada do .wrap */
}
.wrap > .bg-video > video {
width: 100%;
}
Hi Hugo, I put the source inside the video tag and it worked on safari and firefox on Mac, but Chrome is not working yet...
– Thayna Rocha
Are you even listening to the sound in Chrome, or not even that? If the sound is appearing very likely your video is there, but it is hidden outside the visible area or behind another element...
– hugocsl
The video I’m using has no sound... I’m going to do a test with some video with sound.
– Thayna Rocha
The video with sound did not work either and can not hear the sound in Chrome... It is very strange in other browsers worked normal and in Windows Chrome too.
– Thayna Rocha
Ollie, I got it fixed! i left HTML only with the video tag like this: <video autoplay muted loop id="myVideo"> <source src="images/video-Serv.mp4" type="video/mp4"> </video> CSS like this: #Xa;#myVideo { position: Fixed; right: 0; bottom: 0; min-width: 100%; min-height: 100%; } And it worked... I think my previous css was influencing something... Thanks for the help :)
– Thayna Rocha
@Because it is I was suspicious that it would be the CSS, the problem is that I do not have a Mac on hand to do these rss tests, but how nice that solved! Only one thing, if you used
position:fixed
be sure to test on iPhone, because until a while ago this type of position didn’t used to work well in Safari, dps do the test there if your page needs to be mobile tb– hugocsl