-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
69 lines (65 loc) · 2.3 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Wave Effect</title>
<script src="https://unpkg.com/wavesurfer.js"></script>
</head>
<body>
<div class="container">
<div class="music-player">
<img src="./assests/music-icon.jpg" alt="music-icon" id="music-icon">
<div class="info">
<h1>Fairy tale</h1>
<h3>- A fairy music</h3>
<div id="waveform"></div>
<div class="control-bar">
<img src="./assests/play.png" alt="play" id="playBtn" title="Play / Pause">
<img src="./assests/stop.png" alt="stop" id="stopBtn" title="Stop">
<img src="./assests/volume.png" alt="volume" id="volumeBtn" title="Mute / Unmute">
</div>
</div>
</div>
</div>
<script>
playBtn = document.getElementById("playBtn");
stopBtn = document.getElementById("stopBtn");
volumeBtn = document.getElementById("volumeBtn");
var wavesurfer = WaveSurfer.create({
container: '#waveform',
waveColor: '#e3bbee',
progressColor: '#fe38ab',
barWidth: 3,
responsive: true,
hideScrollbar: true,
barRadius: 3
});
wavesurfer.load('assests/fairy-tale-music.mp3');
playBtn.onclick = function(){
wavesurfer.playPause();
if(playBtn.src.match("play")){
playBtn.src = "assests/pause.png";
}
else{
playBtn.src = "assests/play.png"
}
}
stopBtn.onclick = function(){
wavesurfer.stop();
playBtn.src = "assests/play.png"
}
volumeBtn.onclick = function(){
wavesurfer.toggleMute();
if(volumeBtn.src.match("volume")){
volumeBtn.src = "assests/mute.png";
}
else{
volumeBtn.src = "assests/volume.png"
}
}
</script>
</body>
</html>