I am making an html webpage with a video in the background and would like to accomplish the following using CSS:
The video keeps its aspect ratio
The video fills the width of the screen
At relatively large window size the whole video is visible
The video has a minimum height (i.e. when the window is shrunk, at a certain size, the whole video is no longer visible).
There are elements positioned directly below the video, dynamically following it if the window is resized
It would also be nice if when the video is invisible it is centered (not crucial).
I've been trying this for ages now and have been able to get most of the points but not all of them; in particular I find the last point (positioning another element directly below) to be hard to combine with the others. I've been using the html video element and CSS.
Is this possible?
You can use a Jquery plugin for this. I recommend looking at this one in particular.
Vide - Jquery Plugin For Fullscreen Background Videos
Related
Does anyone know how to restrict the HTML5 Video fullsize limit to the portion of the screen instead of the complete screen.
Example: My screen size is 1920 * 1080 where my whole page will be displayed and on top of the page I've a modal dialog with 920 * 800 where I will display the list of videos, when I click on fullscreen of any video it is occupying my whole screen size 1920 * 1080, instead of it I want it to occupy only 920 * 800, which is my modal dialog size. Any thoughts. Any help would be highly appreciated.
You can fullscreen an outer element that contains the tag, instead of making the itself full screen, by using requestFullscreen on the outer element from JavaScript:
https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode
Unfortunately, if you enable controls on the video element, it will still have its own fullscreen button too. There might be ways to hide it; here's another question about that topic:
How to hide full screen button of the video tag in HTML5
but it doesn't seem to be possible in all browsers. The best thing is probably to hide all of the video's controls, and implement your own controls (there's open source out there that does this kind of thing, like video.js).
I'm trying to create a full browser width video similar to this example:
http://www.zendesk.com
Creating the full width responsive video is simple enough:
http://www.ttmt.org.uk/video/
My problem is the height of the video when the broswer is full width. The video is too tall and fills the whole of the screen.
It would be better if the video was a different ratio but I don't think that wouldn't work.
Is it possible to place the video in a container and give that a height that will mask part of the height of the video. I don't mind cutting some of the vidoe off.
zendesk is using a CSS Flex Box Layout. More at: http://www.smashingmagazine.com/2011/09/19/css3-flexible-box-layout-explained/
I bet your answer lies there. From what I saw in the source I'd guess zendesk is hosting video in a container that is framed between two flex boxes. Cool stuff.
Yes, this is possible.
Check out the Vide jQuery plugin. From my personal experience, its the easiest to play with with minimal fuss.
Because the plugin is responsive, it will constrain the video to the height/width properties of your container or wrapper.
Your best using height:auto; width:xxPX; with your container/wrapper CSS.
http://vodkabears.github.io/vide/
I'm using Thickbox to display videos on a website and the youtube video seems to be too large for the thickbox frame. I've tried decreasing the youtube video size but the thick box seems to follow the size of the video because no matter what I adjust the size to I always have this:
http://imgur.com/KJ2kJYr
Notice in the bottom right corner, the video goes outside the frame. Any suggestions are welcome.
Here is the html code for the video. Personal info has been removed (site name, youtube embed, etc.):
<a class="thickbox" href="//www.youtube.com/embed/XXXXXXXXX?rel=0&showinfo=0&controls=0&KeepThis=true&TB_iframe=true&height=400&width=600" title="XXXXXXXXX"><img src="http://www.XXXXXXXXXXX.org/campaign/wp-content/uploads/sites/59/2013/11/XXXXXXXXXX.png"/></a>
I would need the full code to give a complete answer, but based on my experience with other plugins:
Most plugins have very specific styles that are sometimes difficult to override. Give the video a "class" and set the width to width: 100% !important; (or whatever). This should override the defaults set in place by the plugin.
I'm trying to build a very simple proof-of-concept for the guys I work for to demonstrate something for them. As of right now, I've got everything working, except that in my (obviously extremely crude) website, I'm trying to embed a video and FORCE the video to completely fill a certain size. The main problem that I'm facing is that if I try to embed a video with:
<video width="1920" height="1080">
then it increases the size of the video screen (though not to those actual dimensions - it stops at a much smaller size), but keeps the actual viewable video size at the original dimensions and just adds a lot of black space into the video player.
Clearly, this isn't the right way to do this. I know HTML is usually regarded as pretty easy, but this is literally the first webpage I've had to do, haha. Any help is greatly appreciated!
I found this # http://www.w3schools.com/html5/att_video_height.asp
Note: Do not rescale video with the height and width attributes! Downsizing a large video with the height and width attributes forces a user to download the original video (even if it looks small on the page). The correct way to rescale a video is with a program, before using it on a page.
So guess you can't scale up a video with width and height tags. Just define it's dimensions so the browser can reserve space for it while loading a webpage.
Just wondering if anyone knows any tricks to getting regular html content (mainly an img tag) to display on top of a video (via the video tag)?
As others have intimated it's very easy to position HTML elements on top of VIDEO elements using absolute positioning. The challenge comes when you try to capture events on them in the iPhone, iPod and possibly older Android phones that don't play video assets inline on the page (as opposed to in a thin native playback client) since in those instances the VIDEO element greedily captures events.
If you use an IMAGE element or a DIV with its background-image set to an image you want to use as a "poster" or "thumbnail" then your users won't be able to tap on them to get the video to start playing -- the mobile browser will treat this behavior as if nothing but the VIDEO element exists in that space (good if you happen to click in the middle where the "big play" button is but not so helpful if you, say, have a custom control not in the middle.
The solution I've used in the past is to just put the IMG or DIV poster on the page where you would normally put the VIDEO element and shift the VIDEO element offscreen (absolutely positioned with left style set to, say, -3000px) so it can no longer hoard those events.
I know this isn't exactly what was asked, but hopefully this information will prove useful to someone.
You can simply put html elements on top of HTML5 video by positioning them absolutly on top of the video. Give both the video element and the HTML element a "position:absolute" and put the HTML element a z-index higher than the video element's.
Why not use the poster attribute? That way you can display an image until the video is loaded or play.
Can you set the video as background for that div? Not sure if it would work for your layout, but it seems logical...