We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b8ad8ff commit de3948fCopy full SHA for de3948f
lotion/index.html
@@ -6,15 +6,15 @@
6
<title>Auto playing sound</title>
7
</head>
8
<body>
9
- <audio id="welcome" src="warning.mp3" autoplay></audio>
+ <audio id="warning" src="warning.mp3" autoplay></audio>
10
11
-<button id="playSound">Play sound</button>
+<button id="playSound">Play warning sound</button>
12
13
<script>
14
- document.getElementById('playSound').addEventListener('click', () => {
15
- const audio = document.getElementById('welcome');
16
- audio.play().catch(err => console.log('Autoplay blocked:', err));
17
- });
+ document.addEventListener('touchstart', () => {
+ const a = document.getElementById('warning');
+ a.muted = false;
+});
18
</script>
19
</body>
20
</html>
0 commit comments