-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
87 lines (81 loc) · 2.83 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="CodeHim">
<title>Readiz's Player</title>
<!-- Style CSS -->
<link rel="stylesheet" href="css/style.css">
<!-- Demo CSS (No need to include it into your project) -->
<link rel="stylesheet" href="css/demo.css">
</head>
<body>
<div>
<div id="loading-overlay" style="color: #f3f3f3;
position: absolute;
top: 0;
bottom: 0px;
width: 100%;
text-align: center;
background-color: black;
z-index: 9999;
">
<div style="display: grid; height: 100%; text-align: center; vertical-align: middle;">
<h1 style="display: flex; flex-direction: column; place-content: flex-end;">Readiz's Player</h1>
<p>Click here to use</p>
</div>
</div>
<div class="simple-audio-player" id="simp" data-config='{"shide_top":false,"shide_btm":false,"auto_load":true}'>
<div class="simp-playlist">
<ul id="ulist">
</ul>
</div>
<div class="simp-footer">Song copyrights belong to its owner.</div>
</div>
</div>
<!-- Audio Player JS -->
<script src="./js/script.js"></script>
<script type="module">
import WaveSurfer from './js/wavesurfer.esm.js'
// const wavesurfer = WaveSurfer.create({
// container: '#waveform',
// waveColor: '#4F4A85',
// progressColor: '#383351',
// url: './music/theme_001-Constant Moderato.ogg',
// })
// wavesurfer.on('interaction', () => {
// wavesurfer.play()
// })
window.WaveSurfer = WaveSurfer;
function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}
async function getMusics() {
const res = await fetch(`./musicList.json?` + getRandomArbitrary(0, 1000000));
const arr = await res.json();
let isFirst = true;
for (const item of arr) {
const name = unescape(String(item).substr(8).split('.ogg')[0].split('.mp3')[0].split('.m4a')[0]);
const artist = name.split('/')[0];
const songname = name.split('/')[1];
const li = (isFirst) ?
`<li class="simp-active"><span class="simp-source" data-src="${item}">${songname}</span><span class="simp-desc">${artist}</span></li>`:
`<li><span class="simp-source" data-src="${item}">${songname}</span><span class="simp-desc">${artist}</span></li>`;
document.getElementById('ulist').innerHTML += li;
isFirst = false;
}
}
(async() => {
await getMusics();
BAPlayer();
// setTimeout(() => {
// document.getElementById('loading-overlay').classList.add("hide-loading");
// }, 100)
document.getElementById('loading-overlay').addEventListener('click', function(event) {
document.getElementById('loading-overlay').classList.add("hide-loading");
});
})();
</script>
</body>
</html>