Reputation: 21
I have searched everywhere and can not find a way to make a video in html play with no sound until clicked on kinda like Facebook.
Upvotes: 0
Views: 823
Reputation: 53674
The autoplay
attribute will autoplay a video, and the muted
attribute will mute a video by default. So that will play the video with no sound. Then you can assign a JS click handler to the video and turn off muting by setting video.muted = false
var video = document.getElementById('video');
video.addEventListener('click',function() {
video.muted = false;
});
<video id="video" src="http://www.w3schools.com/html/mov_bbb.mp4" autoplay muted controls></video>
Upvotes: 5