Home > Enterprise >  HTML Videos Loop & Autoplay
HTML Videos Loop & Autoplay

Time:07-11

I’ve tried setting them to be true and changing the order in some hope it will help. So far it’s not working I’m sure the videos silent but I muted it anyway. I want it to autoplay and loop. It does neither, if anyone can help it’s greatly appreciated.

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

CodePudding user response:

I don't have A.mp4, but after trying your code with another MP4 video, it seems to work fine.

    <video loop autoplay muted >
        <source src="https://www.sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4" type="video/mp4">
    </video>

Since your code is fine, the problem must be with the video file.

  • Ensure that your video file is not corrupt and can be accessed.

  • Your MP4 is not from a live stream (ie: is not a fragmented-MP4, that needs MSE to play).

  • Ensure the MP4 is containing H.264 video (and AAC audio, if got sound).

  • MP4 can sometimes have H.265 video codec. Only supported browser is Safari (Apple).

  • Use MediaInfo to check video details and then confirm if your browser supports that setup.

  • Use a Hex editor for your OS to check the video file's bytes.
    A working MP4 should show moov in second or third line. If not, then video is not playing because metadata is not available (needs moving from back of file to the front).

Also check that you have saved and are accessing your site through the development version. All are common mistakes we make in the heat of development.

Hope I could help a bit- but your code should be fine. :)

  • Related