htmlbrowser

Video will behave differently across devices


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.


Solution

  • try playsinline in video tag

    <video
            autoplay
            muted
            loop
            playsinline
            src="./resources/videos/excursion.mp4"
            type="video/mp4"
          >