Jump to content

HTML5 video is not displayed in Firefox


harry_ord

Recommended Posts

This is my site:

http://feriapixel.cl/cleanway/index.php


As you can see, if you are using Chrome, it has a video background at the beginning, but when i view it with Firefox, the video doesn't appear at all.

This is the HTML and javascript of my video:

 <video id="my-video" class="video" muted loop>
      <source src="videos/Clean_Way.mp4" type="video/mp4">
      <source src="videos/Clean_Way.webm" type="video/webm">
    </video><!-- /video -->
   
    <script>
      (function() {
        /**
         * Video element
         * @type {HTMLElement}
         */
        var video = document.getElementById("my-video");

        /**
         * Check if video can play, and play it
         */
        video.addEventListener( "canplay", function() {
          video.play();
        });
      })();
      </script>

I need to add something for Firefox?

Link to comment
Share on other sites

  • 1 month later...

Hi harry_ord!

 

Looks like the MP4 format is not working on Firefox, but the WebM works fine.

I think swapping the orders of mp4 and webm files, like below, would do the trick.

<video id="my-video" class="video" muted="" loop="" controls="">
    <source src="videos/Clean_Way.webm" type="video/webm">
    <source src="videos/Clean_Way.mp4" type="video/mp4">
</video>
Edited by Ash!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...