skip to Main Content

I’m using the <video> tag in a HTML code for a website.

The video will work without any issues on PC, but as soon as I load the site on my phone it will load but wont play, and on another phone in the exact same browser (safari) it wont play unless clicked on and it opens a window (pop out) for it.

This is the code for the HTML that I tried so far…

   <div class="video_container">
      <video
        autoplay
        muted
        loop
        src="./resources/videos/excursion.mp4"
        type="video/mp4"
      >
        Video not compatible with your browser
      </video>

If you require any additional information please let me know.

2

Answers


  1. try playsinline in video tag

    <video
            autoplay
            muted
            loop
            playsinline
            src="./resources/videos/excursion.mp4"
            type="video/mp4"
          >
    
    Login or Signup to reply.
  2. Try having both video formats and give it a height and a width.

    <video width="220" height="140" controls>
      <source src="./resources/videos/excursion.mp4" type="video/mp4">
      <source src="./resources/videos/excursion.ogg" type="video/ogg">
      Your browser does not support the video tag.
    </video>

    Happy Coding!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search