I am a beginner in HTML and just want to write a page with a little video and a text. I want to autoplay the video but with sound. Since it's only possible to autoplay without sound I assume that I need javascript.
This is my code so far
index.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="generic.css">
</head>
<body>
<video autoplay="autoplay" loop="" class="myVideo" id="myVideo">
<source src="vid.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>
</body>
</html>
css file:
video {
position: fixed;
text-align: center;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
Is it somehow possible or am I forced to use a button to autoplay?