The troubleshooting guide for resolving compatibility issues with a background video across various browsers

Something strange occurred.

My background video was functioning properly on all browsers until this morning. However, it suddenly stopped working on certain browsers. The video either does not play or freezes immediately.

I tried clearing my cache, reverting the changes, and even starting from scratch, but nothing worked.

As a last resort, I attempted to add the following script code:

<script> $(document).ready(function() { var vid = document.getElementById("bgvid"); vid.play(); }); </script>

The website in question is www.medshopandbeyond.com.

The background video fails to work on Chrome, Opera, and Safari. It loads intermittently on Firefox and consistently plays on Internet Explorer.

I would greatly appreciate any help in resolving this issue.

HTML Markup of Video and Content:

 {% if template == 'index' %}
<!--<div id="slideshow-shadow"></div>-->

      <div class="video-background" id="video-background">
        <video  loop="loop" autoplay poster="{{ 'photo-1445.jpg' | asset_url }}" width="100%">
            <source src="{{ 'Newest4.mp4' | asset_url }}" type="video/mp4">
            <source src="{{ 'Newest4.webm' | asset_url }}" type="video/webm">
            <source src="{{ 'home.ogg' | asset_url }}" type="video/ogg">
            <img alt="" src="{{ 'home-placeholder.jpg' | asset_url }}" width="640" height="360" title="No video playback capabilities, please download the video below">
        </video>
   <div class="headline_22">
<table>
      <tr><td width="50%"></td><td width="50%" class="headline_content">
<h1>Beyond Limitations</h1>
<p>Med Shop and Beyond stands for Freedom, Lifestyle, Wellness and Family. We strive to provide high quality medical supplies and equipment to our customers</p>
</td></tr>
      <tr><td width="50%"></td><td width="50%" class="tb_action">
<a href="http://www.medshopandbeyond.com/collections/all" class="btn_action_22">
<span>Start Shopping</span>
<i class="ico_arrow"></i>
</a>
</td></tr>
...

CSS of the Video:

div.video-background {
    height: 58em;
    left: 0;
    overflow: hidden;
    /*position: fixed;
    top: 96px;*/
    vertical-align: top;
    width: 100%;
    /*z-index: -1; */
margin-top:-16px;
    position:relative;
    margin-bottom: 0px;
    -webkit-filter: brightness(95%);
...
}

CSS of Content:

/************* 
Call to Action Button - Style 22
 ******************/
.btn_action_22 {
background: #00559f !important;  /* Change button background color */
border: 1px solid #00559f !important; /* Change button border color */
color: #fff !important; /* Change button text color */
line-height: 1.2;
font-size: 30px;
display: inline-block;
padding: 22px 45px 23px;
position: absolute;
text-decoration: none;
text-transform: uppercase;
z-index: 3;
white-space: nowrap;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
float: left;
    font-family: Lato;
...

<headline_22 h1 {
color: #000 !important; /* Change headline title text color */
font-size: 52px;
line-height: 1.2;
text-transform: uppercase;
font-weight: 100;
    font-family: Lato;
...
}

Answer №1

To ensure compatibility with different browsers, it is important to include various video formats. Convert your videos and add them using the following code so each browser can use the corresponding format.

<video controls="controls" poster="linktoposter.jpg" width="640" height="360">
 <source src="linktomovie.mp4" type="video/mp4" />
 <source src="linktomovie.webm" type="video/webm" />
 <source src="linktomovie.ogv" type="video/ogg" />
 <!-- Fallback object using Flow Player -->
<object type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" width="640" height="360">
 <param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />
 <param name="allowFullScreen" value="true" />
 <param name="wmode" value="transparent" />
 <param name="flashVars" value="config={'playlist':[ 'linktoposter.jpg',{'url':'linktomovie.mp4','autoPlay':false}]}" />
 <img alt="My Movie" src="linktoposter.jpg" width="640" height="360" title="No video playback capabilities, please download the video below." />
 </object>
 <!-- Fallback Text -->
 Your browser does not seem to support a browser. Please download the video below.
</video>

For a full-width background video that works across all browsers, you can follow this guide:

Answer №2

After some experimentation, I found that tweaking certain parameters was necessary for functionality. Despite attempting to incorporate additional formats, the desired outcome remained elusive.

<video class="background-video"  onloadedmetadata="this.muted=true"  playsInline preload autoplay loop muted>

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

The webpage failed to show the hamburger menu

I'm trying to create a hamburger menu and have written the following code: <header class="header"> <nav class="flex flex-jc-sb flex-ai-c"> <a href="/" class="header__logo"> <img src="im ...

What is the best way to update the switchery checkbox after it has already been initialized?

I have set up the switchery using the code snippet below. var ss_is_schedule_edit = document.querySelector('.ss_is_schedule_edit'); var mySwitch = new Switchery(ss_is_schedule_edit, { color: '#8360c3' }); However, I am unable to toggle ...

Tips for creating a full-screen background image using HTML and CSS

I am looking to achieve a full-screen background image using HTML and CSS. I have configured all the necessary properties for the background image. Here is where my background image is located: [![enter image description here][1]][1] I have attempted to ...

Preventing page re-rendering with redux when a condition is not met

I am currently working on a page that features a question paper with multiple options and a button to navigate to the next question. import Grid from "@material-ui/core/Grid"; import Typography from "@material-ui/core/Typography"; import React, { useEffec ...

Checkbox value not being accurately retrieved by Struts2 page

I have a form that captures phone information for two different phones, with each phone having its own set of details. If the user enters the same phone number for both phones, the second checkbox is automatically checked using the JavaScript code below: ...

In angular, concealing the pagination bar can be achieved when the quantity of pages is lower than the items per page count. Let's delve into

I am facing an issue where I need to hide the pagination bar if the number of pages being rendered is less than the items per page. I attempted to use ng-show but it was not successful. <tr ng-repeat="row in allItems"> ...

Sharing data across Vue methods

I have a method that makes two API calls and saves the results in separate variables. I need to access these variables from another method to manipulate the data. What is the best way to access data from another method in Vue? Below is the code for my AP ...

Issues with Jquery Div sliding transitions from right to left are not functioning correctly

Creating page transitions in jQuery similar to "http://support.microsoft.com/." Encountering an issue where after the page transitions are completed, they start from the left instead of the expected right direction. Referencing this fiddle (Working Code) ...

Remove all instances of an empty array within a larger array

Is there a way to eliminate an empty array from within a parent array prior to adding a new element? In the structure provided, it appears as follows: var parentArray = [ ['123', '345'], [], ['12'] ] The goal is to remove t ...

Ways to subtly adjust the edges of text in a design

https://i.stack.imgur.com/sr4PF.pngIs there a way to adjust the border of text that already has a border applied? I have successfully created the text with the border using the following CSS: h1 { font-size: 35pt; text-align: center; font-family: ...

What are effective ways to eliminate cross-origin request restrictions in Chrome?

Just starting out with angular and trying to incorporate a templateUrl in an angular directive. However, when attempting to view the local html file in the browser, I encounter the following errors --> XMLHttpRequest cannot load file:///Users/suparnade ...

I wonder which Material Design repository is the source of this library

I am attempting to replicate the CSS style used in this particular Material Design-inspired web application: https://i.stack.imgur.com/utalx.png After exploring Materialize CSS and MUI, I have not been able to pinpoint the exact framework responsible for ...

Utilizing CSS for styling Submenus in WordPress wp_nav_menu

In the menu section of my website, I have the following HTML code: <nav class="navigation"> <ul> <li class="active-menu">Home</li> <li>About <ul class="submenu> <li cl ...

Unresolved Issue: Jquery Modal Fails to Activate on Subsequent Click for Ajax-

When I make an Ajax call, I load HTML into a div. This HTML content contains a jQuery modal that opens when clicked. However, on the first click, the modal opens correctly. On subsequent clicks, I receive the following error in the console: Uncaught Type ...

Utilize key-value pairs to reference variables when importing as a namespace

Is it feasible to utilize a string for performing a lookup on an imported namespace, or am I approaching this the wrong way? Consider a file named my_file.ts with contents similar to: export const MyThing: CustomType = { propertyOne: "name", ...

Exploring the functionality of the load event in JQuery for images

I am encountering an issue with the code provided below: <!DOCTYPE html> <html> <head> <style> </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> </hea ...

The initial call to the method results in an undefined return value

In my code, there is a function that retrieves distinct values from a database. Here's how it looks: function getUniqueCategories(res, req) { query = `SELECT DISTINCT name FROM product_category;`; connection.query(query, function (err, rows) { ...

The view page encounters an issue when attempting to load a null element

I am currently working with a JavaScript function that generates links on my webpage based on the user's selection from a DropDown menu. I have implemented checks for this JavaScript function in two scenarios: when the user selects an option from the ...

Alignment in the vertical direction of two lines

I've been struggling to align some HTML elements visually the way I want. There are two lines of text followed by a link. I'm trying to get the link to be vertically centered between the two lines, rather than just after the second line. Using a ...

Utilizing Ajax to dynamically update the content of a div element

As a newcomer to Ajax, I am trying to use xmlhttprequest to dynamically change the content of a div by fetching HTML from different URLs. However, my code doesn't seem to be working as expected. Can someone help me identify what I might be doing wrong ...