Autoplay muted videos in Chrome 66
The latest version of Google Chrome (version 66) includes autoplay video changes that stops Chrome from automatically playing videos in some scenarios. Apparently Chrome will learn which sites you tend to play videos on and will allow autoplaying of videos for those particular sites. That sounds like a great idea to me - it's incredibly annoying when you land on a page only to be blasted with sound from an unwanted autoplaying video.
Crucially these restrictions are only in place for videos which contain sound. My previous post contained a video which was purely for demonstrating a nice UI feature and as such has no need for any audio. The following code allows the video to autoplay:
<video src="source.mp4" autoplay muted playsinline></video>
Using the muted
attribute means that the video will play without sound and the playsinline
attribute is necessary for the video to autoplay in iOS.