Skip to content

Commit de3948f

Browse files
committed
Adds new way to play on phone
1 parent b8ad8ff commit de3948f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lotion/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
<title>Auto playing sound</title>
77
</head>
88
<body>
9-
<audio id="welcome" src="warning.mp3" autoplay></audio>
9+
<audio id="warning" src="warning.mp3" autoplay></audio>
1010

11-
<button id="playSound">Play sound</button>
11+
<button id="playSound">Play warning sound</button>
1212

1313
<script>
14-
document.getElementById('playSound').addEventListener('click', () => {
15-
const audio = document.getElementById('welcome');
16-
audio.play().catch(err => console.log('Autoplay blocked:', err));
17-
});
14+
document.addEventListener('touchstart', () => {
15+
const a = document.getElementById('warning');
16+
a.muted = false;
17+
});
1818
</script>
1919
</body>
2020
</html>

0 commit comments

Comments
 (0)