-4

The videos on my site are not autoplaying, and I think I have my code entered correctly. The video is inside a table. Could that be the reason it is not working? Using DreamWeaver CS6 to code. Here is one example...

 <tr>
        <td colspan="3" align="center" valign="top"><video width="640" height="360" controls="controls" autoplay="autoplay" >
          <source src="Name-Redacted.mp4" type="video/mp4" />
        </video></td>
      </tr>

I have also tried entering just 'controls autoplay' instead of 'controls="controls" autoplay="autoplay", but that didn't work either. Interesting note... I have 16 videos, each on a separate page, and 5 or 6 of them autoplay on Chrome, none of them on Firefox. Not sure what to make of that.

Can anyone help me?

Miami Spy
  • 1
  • 1
  • 2
    Browsers have been trying to curtail auto play – Daniel A. White Sep 20 '22 at 22:54
  • Not a fix but please note that the [](https://html.spec.whatwg.org/dev/semantics.html#the-source-element) tag does not use and does not need a closing slash and never has in any HTML specification. – Rob Sep 21 '22 at 10:04
  • Also note that `align` and `valign` have been [obsolete](https://html.spec.whatwg.org/dev/obsolete.html#non-conforming-features) for decades. – Rob Sep 21 '22 at 10:05
  • Thanks for the heads-up @Rob. I am decades behind the curve. :) So what do I use instead of 'align' and 'valign'? Do I just type 'center' and 'top'? – Miami Spy Sep 21 '22 at 18:51

1 Answers1

0

Many browsers have added some limitations for autoplay option on videos, so the problem isn't video being inside a table.

If you don't need the sound of the video, adding muted attribute would usually fix the problem on most browsers.

Even with JavaScript you wouldn't be able to hack around the problem, since it will throw a warning in developer console.

If you don't need the sound, rewrite your code as follows:

<tr>
    <td colspan="3" align="center" valign="top"><video width="640" height="360" controls autoplay muted >
      <source src="Name-Redacted.mp4" type="video/mp4" />
    </video></td>
  </tr>
kesetovic
  • 144
  • 6
  • Thanks, Kesetovic. I definitely need the sound, so I guess I am just going to have to live with no autoplay. :( – Miami Spy Sep 21 '22 at 18:48