Is it possible to have background videos in safari without experiencing any lag?

Currently, I have implemented a background video on my webpage, which features a simple layout where you scroll to view images with a fixed background video. While it works smoothly on Chrome, I have noticed that it appears choppy and laggy on Safari. Are there any best practices to follow when dealing with fixed background videos on Safari? Below is the code snippet for how I am embedding the video and the corresponding CSS properties. Any advice or resources on optimizing this for Safari would be greatly appreciated. Feel free to ask for more details or specifics if needed. Thank you!

<iframe id="v0" src="https://player.vimeo.com/video/318621793?background=1&autoplay=1&loop=1&byline=0&title=0" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen>
</iframe>

#v0{
position:fixed;
 width: 100vw;
  filter:opacity(60%);
   height: 100vw; /* Given a 16:9 aspect ratio, 9/16*100 = 56.25 */
   min-height: 100vh;
   min-width: 177.77vh; /* Given a 16:9 aspect ratio, 16/9*100 = 177.77 */
 
   top: 50%;
   left: 50%;
   transform: translate(-50%, -50%);
}

Answer №1

One possible reason for the slow rendering of the video could be the opacity setting of less than 100%. This can significantly slow down the rendering process. It's advisable to remove the opacity filter entirely to improve performance. Specifically, consider removing the line:

filter:opacity(60%);

Additionally, other factors like slow video loading might contribute to the issue. If the video doesn't need frequent updates and you're the creator, consider downloading it from Vimeo using tools like SaveVideo.me and embedding it using the video tag:

<video autoplay muted loop>
    <source src="rain.mp4" type="video/mp4">
</video>

To add audio, remove the "muted" attribute, and to disable looping, remove the "loop" attribute.

<div id="container">
    <div id="overlay">a</div>
    <div id="video">
        <video autoplay muted loop>
            <source src="rain.mp4" type="video/mp4">
        </video>
    </div>
</div>

After embedding, use CSS to properly overlay the elements:

#container {
    width: 100px;
    height: 100px;
    position: relative;
}
#overlay,
#video {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}
#video {
    z-index: 10;
}

References:
SaveVideo.me
W3Schools
Alex's Post on Overlaying Divs

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

"Extracting JSON data from a URL and loading it into a

I am currently working on a project where I am retrieving data from a URL and storing it in an array. Here is the code snippet: $url = 'https://www.datastro.eu/api/explore/v2.1/catalog/datasets/orbits-for-current-comets-in-the-mpc-database/records?ord ...

The inversify middleware is executed a single time

I utilize Inversify for object binding in the following manner: container.applyMiddleware(loggerMiddleware); let module = new ContainerModule((bind: interfaces.Bind) => { bind<Logger>(TYPES.Logger).toConstantValue(logger); bind<ILogger ...

Exploring the world of MVC4: Enhancing user experience with client-side

Solution: The answer provided by @www.innovacall.com is correct, I initially misunderstood it but now it works perfectly. Thank you for the help. Initial issue: I have been struggling with finding a solution to my problem. In my project, there is a mod ...

Search the database to retrieve a specific value from a multi-dimensional array

My database is structured as shown in the image below: https://i.sstatic.net/Flne8.png I am attempting to retrieve tasks assigned to a specific user named "Ricardo Meireles" using the code snippet below: const getTasksByEmployee = async () => { se ...

What causes a header to appear transparent when it has a background color set in HTML?

I'm attempting to create a webpage that resembles Gmail. I have a header with a background color, but when I scroll, the content in the body becomes visible. Here is the view without scrolling: https://i.stack.imgur.com/UQ2sO.png However, while scr ...

Steps to reverting CSS attributes back to their default values for a specified element (or blocking inheritance)

How can you reset a specific CSS attribute of an HTML element, which is automatically inheriting styles from its parent, to the default value? For example: CSS: .navigation input { padding: 0; margin: 0 30em; } HTML <div class="navigation"& ...

I am trying to figure out how to properly utilize server-only functions within Next.js middleware

In my current project, I am utilizing Next.js 13 along with the App Router feature. While attempting to include a server-specific fetch function in middleware.js, an error message is encountered: Error: Unable to import this module from a Client Compone ...

Submit a set of form variables to PHP using AJAX

I am attempting to transmit a set of form parameters to a PHP script for processing. In the past, I have achieved this using $.post, but now my goal is to accomplish it exclusively with $.ajax. Below is the jQuery click event designed to send all variabl ...

What is the best way to refresh my view model while using chained promises?

I've recently started learning about promises and I'm facing a challenge with updating an object in my view from two chained promises: function Test($resource, FC, UserDetailsService) { 'ngInject'; var self = this; se ...

Show the particular entry to be viewed upon clicking the link provided in the email

How can I create a link in an email that, when clicked, displays data for a single record? Currently, I have a datatable on the index page that shows all records when the app is opened. When a change is made to a record, an email is sent out with the ID o ...

The CSS Validator does not recognize the CSS pointer-events and appearance properties

I'm a CSS beginner who recently created an app. I've encountered some errors and warnings when validating my CSS code: https://i.stack.imgur.com/g4MUz.png https://i.stack.imgur.com/Es1DE.png Could someone kindly explain these errors and warnin ...

When the user clicks, the template data should be displayed on the current page

I need help with rendering data from a template on the same HTML page. I want to hide the data when the back button is clicked and show it when the view button is clicked. Here is my code: <h2>Saved Deals</h2> <p>This includes deals wh ...

How can I troubleshoot jQuery not functioning in iOS even though it works on Safari?

Trying to implement jQuery on a website using xCode simulator for testing, but experiencing issues. Works fine on Safari webkit though. Click here to view the site. I would appreciate finding out what's causing the problem, as well as advice on how t ...

Acquiring data from a website using Python post user engagement

Hey everyone! One of my friends has a lot of typing to do for her IT classes in school. She needs to learn how to type quickly on the keyboard. Being quite lazy, she asked me if I knew of any way she could type her texts on without actually doing any wor ...

Ways to create a scrolling effect for a datalist dropdown menu

My HTML datalist shows various career paths, but the number of options is too long. I want to add a scrolling effect to it. I have looked for ways to do this, but I read that CSS cannot be applied to datalists. Is it possible to apply styles using jQuery i ...

CSS fails to load on DJango platform

I am currently working with two apps in my project: Home and Header. The HTML code for the Home app can be found in project_folder -> home -> templates -> home -> base_home.html {% extends 'header/base_header.html' %} <!doctype h ...

Struggling with Ajax issues following a tutorial from Bucky

I previously watched a tutorial by Bucky and I am struggling to make this work, with the error message displayed as index.php:62 Uncaught TypeError: Cannot read property 'documentElement' of undefinedhandleServerResponse @ index.php:62 The Ja ...

I need help figuring out how to get a horizontal scrollbar positioned at the top of a div to function properly once the content has been loaded using ajax

HTML CODE <div id="scrollidout" style="overflow: auto; overflow-y: hidden; "> <div id="scrollidin" style="padding-top: 1px; height: 20px; width: 1000px">&nbsp;</div> </div> <div class="resultcontent" style="overflow ...

Encountering a "Error 404: Page Not Found" message when trying to request a json object from a node server

Working on a RESTful API, I have set it up to run on node.js using express.js, mongodb with mongoose for object modeling, and body-parser for passing HTTP data. However, whenever I start the server and try to access the specified IP address, I encounter a ...

Attaching the JSON data to ngModel in Angular 2

I have received a json response containing various fields, including the rewards.rewardName value. I'm trying to figure out how to bind this specific value to [(ngModel)] in Angular 2. [ { "id": 18, "gname": "learning ramayanam", "goalCat ...