-1

i want to make a full screen ?

my old code is like this

    <div id="test"></div>


    <div id="body">lorem ipusm dolor sue lorem ipusm dolor sue lorem ipusm dolor sue lorem ipusm dolor sue lorem ipusm dolor sue lorem ipusm dolor sue</div>


with css

#test{
  width: 100%;
  height: 100vh;
    background: url('https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97150&w=350&h=150') no-repeat center center;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover; 
  background-size: 100% 100%;
}

and now i want to change the image with video but full screen so i change like this

<div id="video">
  <div class="embed-responsive embed-responsive-16by9">
      <video id="video1">
          <source src="video/inspiration-1.mp4" type="video/mp4">
      </video>
      </div>
</div>

    <div id="body">lorem ipusm dolor sue lorem ipusm dolor sue lorem ipusm dolor sue lorem ipusm dolor sue lorem ipusm dolor sue lorem ipusm dolor sue</div>

how to make it full screen with css because it leave like padding-top when i try to run this code??

heres my work https://jsfiddle.net/f0Lcdfrt/4/

vicario
  • 233
  • 1
  • 6
  • 18

4 Answers4

2

You can activating fullscreen mode this way

var elem = document.getElementById("video1");
if (elem.requestFullscreen) {
  elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
  elem.msRequestFullscreen();
} else if (elem.mozRequestFullScreen) {
  elem.mozRequestFullScreen();
} else if (elem.webkitRequestFullscreen) {
  elem.webkitRequestFullscreen();
}

see MDN doc for more https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
1

Video elements can't be made full screen with css. The best you can do is make it width="100%" height = "100%" in the <video> tag. See w3 schools If you truly need full screen you will have to do javascript to request full screen from the browser.

var video = document.getElementById("myvideo");
if (video.requestFullscreen) {
  video.requestFullscreen();
} else if (video.mozRequestFullScreen) {
  video.mozRequestFullScreen();
} else if (video.webkitRequestFullscreen) {
  video.webkitRequestFullscreen();
}
jagler
  • 185
  • 1
  • 6
  • You padding issue is due to the `
    ` tag at the top of the html code. More than likely that is causing your issue.
    – jagler Mar 21 '16 at 17:37
0

In your fiddle video src is just not correct. In your code try to change this:

<div class="embed-responsive embed-responsive-16by9">
  <video id="video1">
      <source src="video/inspiration-1.mp4" type="video/mp4">
  </video>
  </div>

to this:

<video id="video1" class="embed-responsive embed-responsive-16by9">
    <source src="video/inspiration-1.mp4" type="video/mp4">
</video>

Or just add css:

video {
    width: 100%;
    height: 100%;
}
Undefitied
  • 747
  • 5
  • 14
0
.wrapper {
    width:100%;
    height:100vh;
    overflow: hidden;
    background-image: url(http://www.webestools.com/page/media/videoTag/BigBuckBunny.png);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
}

.wrapper video {
    object-fit: cover;
    width:100%;
    height:100%;
}

from Garconis

vicario
  • 233
  • 1
  • 6
  • 18