Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autoplaying video without sound

Tags:

html

w3c

video

I just finished reading this article on why autoplaying video is bad http://www.punkchip.com/autoplay-is-bad-for-all-users/. I knew autoplaying was a bad practice but this video gave me good, tangible reasons why its not a best practice.

My question, sites like YouTube, KickStarter and ProductHunt DO have autoplaying video, the catch is the audio is muted.

I'm working on a site for a client now, more specifically a page in which the client might request the video be autoplayed. Obviously this behavior would not be acceptable on with sound, but how about if I muted the sound by default and provided a volume button like ProductHunt?

And just replaced the video with a poster image on mobile? Thoughts?

Thanks.

like image 762
ethankr Avatar asked Mar 23 '17 13:03

ethankr


People also ask

Why are videos automatically muted?

According to the new autoplay specifications, autoplaying videos on IOS, Safari, Chrome, and Android must start out muted. This policy is controlled by the browser manufacturers, and all video hosting services must adhere to it.

What is muted autoplay?

Muted autoplay for video is supported by Chrome for Android as of version 53. Playback will start automatically for a video element once it comes into view if both autoplay and muted are set, and playback of muted videos can be initiated pragmatically with play() .

How do I unmute autoplay?

Disable Autoplay Videos in Chrome on Android Android makes disabling autoplay videos simple. First, launch Chrome on your phone or tablet and go to Settings > Site Settings. Next, scroll down the menu and tap on Media, and then Autoplay and toggle the switch off.


1 Answers

If you will be using the HTML5 player native to the browser. HTML5 video does provide the ability to mute a video and autoplay it. You simply have to include the 'muted' and 'autoplay' properties in your video tags in addition to the 'controls' property so that users have the ability to play,pause, unmute etc, as an example, the code would look like this:

<html>
<body>

<video width="320" height="240" autoplay controls muted>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

<p><strong>Note:</strong> The muted attribute of the video tag is not supported in Internet Explorer 9 and earlier versions.</p>

</body>
</html>
like image 59
l33tstealth Avatar answered Oct 13 '22 01:10

l33tstealth