Auto-play disabled for HTML video tag

To resolve the issue, there are two solutions. The first solution involves enclosing the video within a tag as the system may not recognize it as a video, causing it to fail. The second solution is to disable the autoplay function in the video tag.


Solution 1:

To prevent autoplay, it’s best to eliminate the

autoplay

attribute, as its presence prompts the browser to automatically play the content.

The attribute

autoplay

in HTML is boolean, however, it should be noted that the values

true

and

false

are not permitted. Instead, if you want to indicate a

false

value, the attribute should be omitted.

Boolean attributes cannot contain the values “true” or “false”. If the intention is to represent a false value, the attribute should be excluded entirely.

The source should contain the type within it, as illustrated by the following example:



References:

  • The website link provided is related to the markup guidelines for videos as specified by the world wide web consortium.
  • HTML Spec (boolean attributes)


Solution 2:


Modify the code for the video tag to eliminate autoplay. Consider using the following code.

it is 100% working


Solution 3:


Consider including the

autostart="false"

in your source tag.


JSFiddle example

Frequently Asked Questions