Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > RocketCake
Background Video

lbrown
Registered User
Quote
2023-10-18 16:46:24

is it possible to have a video as a background for the site or for a container?


niko
Moderator
Quote
2023-10-19 07:11:46

Yes, that's possible. Create a HTML Video element anywhere on the website and select your video into it. Then:

- Check 'Play' for the video
- Uncheck 'Controller'
- Right-Click the video and select "HTML Code"
- in Additional Attributes, enter "loop muted"
- In Additional CSS styles enter:

width: 100vw; height: 100vh; object-fit: cover; position: fixed; left: 0; right: 0; top: 0; bottom: 0; z-index: -1;




Then you have a fullscreen background video playing.


micaelo
Registered User
Quote
2023-10-19 11:16:42

Just a caution note on this: A full screen background video does not take into account the video's original aspect ratio, i.e. the video's aspect ratio will inevitably be distorted, depending on the viewer's viewport aspect ratio.


niko
Moderator
Quote
2023-10-19 11:31:42

No, that shouldn't be distorted, that's why I added object-fit: cover


micaelo
Registered User
Quote
2023-10-19 12:09:20

I have just tried it. You're right: the video does not get distorted but it gets cropped.

If I press F11 for full screen browser view my viewport height increases while viewport width remains unchanged, and as a result the video gets cropped a bit on the left and on the right.

If I decrease my browser width, the video gets cropped as well.

So after all, using a video for background makes sense only if cropping doesn't matter, i.e. if the video's content ist just abstract color or graphic pattern, or maybe a landscape view.


niko
Moderator
Quote
2023-10-19 12:50:07

Yes, either you get distortion or cropping, whatever you prefer :)


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inte?national" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact