-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebamp.html
38 lines (32 loc) · 1.04 KB
/
webamp.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>15 Latest Suisei Songs</title>
</head>
<body>
<div id="app" style="height: 100vh">
<!-- Webamp will attempt to center itself within this div -->
</div>
<script type="module">
import Webamp from 'https://cdn.skypack.dev/webamp';
const musicMeta = await fetch("https://suisei-podcast.outv.im/meta.json").then(x => x.json())
const webamp = new Webamp({
initialTracks: musicMeta.sort((a, b) => {
const dta = new Date(a.datetime)
const dtb = new Date(b.datetime)
// pick latest ones
return dtb - dta
}).slice(0, 15).map(({ artist, title, url }) => ({
metaData: {
artist,
title
},
url
}))
});
// Returns a promise indicating when it's done loading.
webamp.renderWhenReady(document.getElementById('app'));
</script>
</body>
</html>