HTML5 Autoplay Attribute

HTML5 autoplay is a new attribute. to support the multimedia content. This attribute is used for <video> and <audio> elements. Along with other HTML5 audio and video attributes such as controls, HTML5 autoplay is also a boolean attribute. When this attribute is used the audio or video on the page plays when the page loads. User is not expected to activate the play button manually.

Using HTML5 autoplay is not a good practice as per WCAG 2.0 standards. As per 1.4.2 Audio controls, no audio should be played automatically for more than 3 seconds. This is also a major disadvantage for screen reader users. As the audio plays automatically when the page loads the screen reader users will not be able to hear what the screen reader is reading making the entire web page inaccessible.

Using HTML5 autoplay

Provide the autoplay attribute along with other attributes such as controls, src etc in the <video> or <audio> elements. sample code below.

<br /> <video controls autoplay><source src="movie.mp4" type="video/mp4"/><source src="movie.ogg" type="video/ogg"/>Your browser does not support the video tag.</video><br />
Remember that as per accessibility standards and usability for screen reader users do not use HTML5 autoplay attribute.

Comments are closed.