<video autoplay> Considered Harmful
The use of HTML5 autoplay attribute for videos on webpages is not recommended due to browsers' aggressive blocking policy. Instead, developers should consider using video.play() in JavaScript, which returns a promise that indicates whether the autoplay was successful or blocked. If the promise rejects, a play button can be shown in the UI for users to click and start playing the video. Additionally, starting with the video muted increases the likelihood of autoplay working. Always ensure controls are accessible for the player.
Company
Mux
Date published
Jan. 23, 2020
Author(s)
Dylan Jhaveri
Word count
727
Language
English
Hacker News points
None found.