-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathambient_river_sounds.html
97 lines (86 loc) · 2.83 KB
/
ambient_river_sounds.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
<title>River Sound Widget</title>
<style>
.widget-container {
display: flex;
justify-content: center;
align-items: center;
background-color: #f7f7f7;
padding: 20px;
border-radius: 10px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
}
#play-pause-btn {
background-color: #0099cc;
color: #fff;
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease-in-out;
margin: 0 10px;
}
#play-pause-btn:hover {
background-color: #0077b3;
}
#play-pause-btn.playing {
background-color: #cc0000;
}
#play-pause-btn.playing:hover {
background-color: #990000;
}
#volume-control {
margin-left: 10px;
width: 100px;
}
#volume-control::-webkit-slider-runnable-track {
background-color: #ddd;
height: 5px;
border-radius: 3px;
}
#volume-control::-webkit-slider-thumb {
-webkit-appearance: none;
height: 20px;
width: 20px;
background-color: #0099cc;
border-radius: 50%;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
margin-top: -8px;
}
#volume-control:focus::-webkit-slider-thumb {
background-color: #0077b3;
}
</style>
</head>
<body>
<div class="widget-container">
<audio id="river-sound" loop>
<source src="https://github.com/Tacobell3669/notion_snippets/blob/main/river-sound.mp3?raw=true" type="audio/mpeg">
</audio>
<button id="play-pause-btn" onclick="togglePlayPause()">Play Sound</button>
<input id="volume-control" type="range" min="0" max="1" step="0.1" value="1" onchange="changeVolume()">
</div>
<script>
const riverSound = document.getElementById("river-sound");
const playPauseBtn = document.getElementById("play-pause-btn");
const volumeControl = document.getElementById("volume-control");
function togglePlayPause() {
if (riverSound.paused) {
riverSound.play();
playPauseBtn.innerText = "Pause Sound";
playPauseBtn.classList.add("playing");
} else {
riverSound.pause();
playPauseBtn.innerText = "Play Sound";
playPauseBtn.classList.remove("playing");
}
}
function changeVolume() {
riverSound.volume = volumeControl.value;
}
</script>
</body>
</html>