I have created a custom video toolbar for displaying of video controls for HTML video tag.
i have positioned my custom toolbar to display over the video in full screen mode which displays correctly for Chrome but doesn't work for Firefox
HTML
<div class="wrapper-video">
<video id="player" data-setup="{}" class='video-js vjs-default-skin' width='635' height='432'>
<source src="" type="video/mp4">
</video>
<div class="playpause"></div>
</div>
<div class="info-video-title-bar">//Custom toolbar with video controls
<progress value="0" max="1000" id="lecture_progress_bar" class="time-tooltip">
<div class="progress-bar" id="progress-bar">
<span style="width: 0%;">Progress: 0%</span>
</div>
</progress>
<style>
</style>
<div class="audio-controls-container">
<span id="video-control-play" class="lecture-icon icon-WebFont-55"></span>
<span id="control-seek" class="lecture-icon icon-WebFont-57" onclick="mixpanel.track('Lecture Seek');"></span>
<span id="control-playback-rate" class="lecture-icon icon-WebFont-60">
</span>
<span class="icon-WebFont-77 full-screen">
</div>
</div>
JS
$(document).on('click', ".full-screen", function(){
if($(this).hasClass("icon-WebFont-77")){
$(".video-js")[0].player.requestFullscreen();
$(".info-video-title-bar").addClass("fixed");
$("progress").addClass("fixed-progress");
$(".audio-controls-container").addClass("fixed-controls");
$(".full-screen").removeClass("icon-WebFont-77").addClass("icon-WebFont-79");
}else if($(this).hasClass("icon-WebFont-79")){
exitFullScreen();
}
});
CSS
.fixed-progress{
width: 100% !important;
}
.fixed{
position: absolute;
z-index: 999999999999;
left: 0px;
line-height: 1px !important;
}
.fixed-controls{
max-width: 100%;
}
.video-js{
position: absolute;
}
.wrapper-video{
position: relative;
}
Related
I have the specification load load a modal window with a video using amp-html.
We are trying to achieve this using amp-lightbox with a amp-video inside the modal window. However, the video is not responding to the size of the modal window (I assume this is down to the initial display:none on the lightbox when the page is loaded).
I have the following amp-html;
<a class="travel-results-result-link block relative" on="tap:video-1">
<amp-img class="block rounded" width="346" height="200" noloading="" src="/images/video/image01.jpg"></amp-img>
</a>
//...
<amp-lightbox id="video-1" layout="nodisplay">
<div class="lightbox"
on="tap:video-1.close"
role="button"
tabindex="0">
<div class="modal-body">
<amp-video controls
width="320" height="240"
layout="responsive"
poster="images/video/image01.jpg">
<source src="videos/gail-video-1.mp4" type="video/mp4" />
<div fallback>
<p>This browser does not support the video element.</p>
</div>
</amp-video>
</div>
</div>
</amp-lightbox>
The css for my modal body is simply;
.modal-body {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 90%;
margin-top: 75px;
height: calc(100% - 200px);
}
When I click to load the modal both the preload image and video are loading outside the boundaries of the modal-body div? can anyone suggest a way around this?
I am trying to set a background video to full screen.
I can achieve this with height: 100vh; and width: 100%; but as soon as the ratio changes from 16:9, I start to get whitespace.
I have also tried using object object-fit: cover; but this seems to overflow all over the place and I struggle to contain it. It also isn't as widely supported (I.E 11 and and edge 15 don't support it).
I'm not sure if I am complicating things using bootstrap 4 as well.
My HTML is layed out like so
<div class="container-fluid home-page">
<video playsinline autoplay muted loop poster="polina.jpg" id="bgvid">
<source src="/wp-content/themes/_underscores/assets/Placeholder-Video.mp4" type="video/mp4">
</video>
<div class="row clients">
<div class="client-slider col-12">
<?php foreach($clients as $key => $client) : ?>
<div class="client-logo" style="background-image: url(<?php echo $client->featured_image; ?>)"></div>
<?php endforeach; ?>
</div>
</div>
<div class="row">
<div class="col-md-6 col-xs-12 info-text">
<h3>Title</h3>
<p>Content....</p>
SEE HOW IT WORKS
</div>
<div class="col-md-6 col-xs-12 backgroundg">
</div>
</div>
</div>
As soon as I position the video element, everything below it (i.e. .clients) float up to the top because the video element is taken out of the regular document flow. I can give .clients margin-top: 100vh; but then I need to give the video element object-fit: cover; and it floods the whole document as the background.
Just to give you an idea of my css (sass) so far:
video {
object-fit: cover;
width: 100vw;
height: 100vh;
z-index: 0;
position: absolute;
top: 0;
left: 0;
}
.clients{
margin-top: 100vh;
}
I have been looking at a couple of tutorials like https://slicejack.com/fullscreen-html5-video-background-css/ and http://thenewcode.com/777/Create-Fullscreen-HTML5-Page-Background-Video but I don't think in there example, they have content below the full screen video.
Thanks.
Ended up doing this:
HTML:
<div class="video-container">
<video playsinline autoplay muted loop poster="" id="bgvid">
<source src="/wp-content/themes/_quander/assets/QUANDER_PITCH_CUT_3.mp4" type="video/mp4">
</video>
</div>
<div class="container-fluid home-page">
<div class="row clients">
<div class="client-slider col-12">
<?php foreach($clients as $key => $client) : ?>
<div class="client-logo" style="background-image: url(<?php echo $client->featured_image; ?>)"></div>
<?php endforeach; ?>
</div>
</div>
<div class="row">
<div class="col-md-6 col-xs-12 info-text">
<h3>Title</h3>
<p>Content....</p>
SEE HOW IT WORKS
</div>
<div class="col-md-6 col-xs-12 backgroundg">
</div>
</div>
</div>
css:
.video-container{
position: absolute;
width: 100%;
height: 100vh;
overflow: hidden;
video {
object-fit: cover;
width: 100vw;
height: 100vh;
position: absolute;
top: 0;
left: 0;
}
}
.home-page{
margin-top: 100vh;
}
So keeping the .home-page margin-top to 100vh stops the content riding up and overlapping the video.
The video is then dynamic (to the extent of being 100% vw and vh). Then having the overflow: hidden; on the .video-container stops the video flowing all over the page.
It is possible to add responsive video with the below code:
<div class="video_wrapper">
<video width="640" height="360" controls="" autoplay="">
<!-- MP4 must be first for iPad! -->
<source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/mp4">
<!-- Safari / iOS, IE9 -->
<source src="http://clips.vorwaerts-gmbh.de/VfE.webm" type="video/webm">
<!-- Chrome10+, Ffx4+, Opera10.6+ -->
<source src="http://clips.vorwaerts-gmbh.de/VfE.ogv" type="video/ogg">
<!-- Firefox3.6+ / Opera 10.5+ -->
</video>
</div>
.video_wrapper {
position: relative;
padding-bottom: 56.25%;
padding-top: 25px;
height: 0;
}
.video_wrapper video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
This should work for you. I have removed the padding from the container-fluid and used bootstrap class embed-responsive.
.home-page{
padding: 0 !important;
overflow: hidden;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet"/>
<div class="container-fluid home-page">
<div class="embed-responsive embed-responsive-16by9">
<video playsinline autoplay muted loop poster="polina.jpg">
<source src="https://player.vimeo.com/external/158148793.hd.mp4?s=8e8741dbee251d5c35a759718d4b0976fbf38b6f&profile_id=119&oauth2_token_id=57447761" type="video/mp4">
</video>
</div>
<div class="row clients">
<div class="client-slider col-12">
<?php foreach($clients as $key => $client) : ?>
<div class="client-logo" style="background-image: url(<?php echo $client->featured_image; ?>)"></div>
<?php endforeach; ?>
</div>
</div>
<div class="row">
<div class="col-md-6 col-xs-12 info-text">
<h3>Title</h3>
<p>Content....</p>
SEE HOW IT WORKS
</div>
<div class="col-md-6 col-xs-12 backgroundg">
</div>
</div>
</div>
I having been trying for days now to move a video on top of a <div> which includes an <img>
Effectively I am trying to make the image of a TV show a video on its screen.
Could somebody help me in positioning the video so it is central to the image inside the screen. I can't even get the video to position on top of the <img> let alone making it the correct size and centering it.
Thanks in advance. Much appreciated.
<div class="videocontainer">
<h1 class="videosheading"><strong>VIDEOS</strong></h1>
<div class="videogallery">
<div class="row">
<div class="col-xs-12">
<img class="img-responsive" src="img/TVWALLTWO.jpg">
<video controls="" height="330" width="440">
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg"> Your browser does not support the video tag.
</video>
</div>
<div class="row">
<div class="col-xs-12"></div>
</div>
</div>
</div>
.videosheading {
color: #E3A750;
text-align: center;
}
.videogallery {
height: auto;
}
video {
background-color: red;
z-index:-1;
position:relative
}
To center the video over the responsive image, you need a container that has position: relative, than the video must have position: absolute. Look at the snippet bellow, hope you get the idea:
.video-cell {
positon: relative;
}
.video-cell img {
width: 100%;
}
.video-cell video {
position: absolute;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
max-width: 100%;
}
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="videocontainer">
<h1 class="videosheading"><strong>VIDEOS</strong></h1>
<div class="videogallery">
<div class="row">
<div class="col-xs-12 video-cell">
<img class="img-responsive" src="https://placehold.it/880x660">
<video controls width="440" height="330">
<source src=http://techslides.com/demos/sample-videos/small.webm type=video/webm>
<source src=http://techslides.com/demos/sample-videos/small.ogv type=video/ogg>
<source src=http://techslides.com/demos/sample-videos/small.mp4 type=video/mp4>
<source src=http://techslides.com/demos/sample-videos/small.3gp type=video/3gp>
</video>
</div>
</div>
Also on JSFiddle.
I can't get the container to correctly wrap around the video in firefox. Chrome and IE work fine. This is the site: http://www3.carleton.ca/clubs/sissa/html5/video.html
HTML:
<div id="video_container">
<video id="trailers" poster="poster.jpg">
<source src="vLast.mp4" type="video/mp4">
<source src="vLast.webm" type="video/webm">
</video>
<nav>
<div id="controls">
<button id="playButton">Play</button>
<div id="vol" onclick="showSlider()">Vol
<div id="containSlider">
<input type="range" id="vSlider" min="0" max="1" step="0.1" value="0.5"/>
</div>
</div>
<div id="defaultBar">
<div id="progressBar"></div>
</div>
<button id="mute">Mute</button>
<button id="full" onclick="toggleFullScreen()">Full</button>
</div>
<div id="playlist" class="animated fadeInRight">
<div class="thumb" id="tb1"><img src="TbGow.jpg" onClick="changeTrailer('vGow')"/></div>
<div class="thumb" id="tb2"><img src="TbLast.jpg" onClick="changeTrailer('vLast')"/></div>
<div class="thumb" id="tb3"><img src="TbTwo.jpg" onClick="changeTrailer('vTwo')"/></div>
</div>
</nav>
</div>
CSS:
#video_container{
-webkit-box-flex: 1;
-moz-box-flex: 1;
border:5px solid black;
margin: 20px;
padding: 0px;
width:100%;
height:100%;
position: relative;
background-color:white;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
#video_container video{
width: 100%;
height: auto;
display: block;
z-index: 9999;
}
FYI Mozilla Firefox is the only browser that still doesn't support flex-wrap. It supports inly single-line flexbox. (flex-wrap needs multi-line flexbox).
Feature Firefox (Gecko)
- Not supported
Chrome
- 21.0-webkit
Internet Explorer
- 10.0-moz
Opera
- full support 12.10
Maxthon
- full support 4.0
https://developer.mozilla.org/en-US/docs/CSS/flex-wrap
I am currently looking for solution...
Alright then Batman :)
Try this
<style>
#-moz-document url-prefix() {
#video_container{
min-height:1px;
max-height:1px;
}
}
</style>
Add this in your html document!
Try #-moz-document url-prefix(), which is a Gecko layout engine rule. Documentation can be found here. Enjoy.
I have a video player on my site and im trying to get the entire site to go dark when the video plays. I've put a div to wrap all content and made sure the z-index of the video and video container where higher than the div. However it's not working like I'd hoped.
It's also screwing up the alignment of my wrapper. This is my site: http://www3.carleton.ca/clubs/sissa/html5/video.html
When I wrap everything in the Shadow div. Everything moves to the left:
HTML:
<body>
<div id="shadow">
<div id="wrapper">
<a href="index.html">
<header id="top_header">
<h1>MacroPlay Games</h1>
</header>
</a>
<nav id="topnav">
<ul>
<li>Home</li>
<li>About</li>
<li>Trailers</li>
<button type="button" data-state="0" style="float:right">Cinema Mode</button>
</ul>
</nav>
<div id="body_div">
<div id="video_container">
<video id="trailers" poster="poster.jpg">
<source src="vLast.mp4" type="video/mp4">
<source src="vLast.webm" type="video/webm">
</video>
<nav>
<div id="controls" class="cAnimated cFadeInRight">
<div id="defaultBar">
<div id="progressBar"></div>
</div>
<button id="playButton">Play</button>
<button id="vol" onclick="showSlider()">Vol</button>
<button id="containSlider">
<input type="range" id="vSlider" min="0" max="1" step="0.1" value="0.5"/></button>
<div id='containTime'><span id='timeDisplay'>0:00</span><span>/</span><span id='duration'>0:00</span></div>
<button id="full">Full</button>
<button id="mute">Mute</button>
</div>
<div id="playlist" class="animated fadeInRight">
<div class="thumb" id="tb1"><img src="TbGow.jpg" onClick="changeTrailer('vGow')"/></div>
<div class="thumb" id="tb2"><img src="TbLast.jpg" onClick="changeTrailer('vLast')"/></div>
<div class="thumb" id="tb3"><img src="TbTwo.jpg" onClick="changeTrailer('vTwo')"/></div>
</div>
</nav>
</div>
<aside id="sidebar">
<div id="side_events">
<h1>News</h1>
<ul id="events">
<li>Half-Life 3 Release: <time>04/01/13</time></li>
<li>Borderlands 3 Release: <time>05/29/13</time></li>
<li>E3 2013 Starting: <time>08/11/13</time></li>
<li>Playstation 4 Release: <time>08/31/13</time></li>
<li>Xbox 720 Release: <time>09/01/13</time></li>
</ul>
</div>
<div id="side_trailer">
<img src="TbGow.jpg" />
</div>
<div id="side_advert">
<img src="http://i.imgur.com/W65o9R2.jpg" alt="Blackberry's Z10" title="Blackberry's Z10" id="advert">
</div>
</aside>
</div>
<footer id="footer">
© Copyright by SimKessy
</footer>
</div>
</div>
</body>
</html>
Rules pertaining to the div (Shadow):
#shadow{
position:fixed;
width:100%;
height: 100%;
top:0;
left:0;
opacity:0.5;
background-color: red;
z-index: 81;
}
#video_container{
-webkit-box-flex: 1;
-moz-box-flex: 1;
border:5px solid black;
margin: 20px;
padding: 5px;
height: 100%;
position: relative;
background-color:black;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
z-index:0;
}
#video_container video{
width: 100%;
/*height: auto;*/
display: block;
z-index: 0;
}
My codes: http://jsfiddle.net/eXJ5q/
Try this
Add this <div class="dim"></div> just before this <div id="video_container">
Then add this css
.dim {
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.8);
bottom: 0;
left: 0;
position: fixed;
right: 0;
top: 0;
z-index: 1;
}
#video_container{
z-index: 1;
}
You can just make the shadow div as a sibling rather than a parent of the video container, and everything should work as expected. you also don't need a z-index of such a high value. It can just be 1, as long as it is a greater value than those you're trying to obscure.