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
|
import Webamp from "https://unpkg.com/webamp@^2";
const WEBAMP_CONFIG = {
initialSkin: {
url: "music/Khoa_Vuong.wsz",
},
initialTracks: [
{
metaData: { artist: "Олег Эмиров", title: "Часы НТВ" },
url: "music/00_chasy_ntv.opus",
},
{
metaData: {
artist: "T.BIRD",
title: "Two Years Gone",
},
url: "music/01_two_years_gone.mp3",
},
{
metaData: {
artist: "Mendelayev",
title: "Install",
},
url: "music/02_install.opus",
},
{
metaData: {
artist: "Date of Birth",
title: "Planet Deb",
},
url: "music/03_planet_deb.opus",
},
{
metaData: {
artist: "lazyfish",
title: "31 seconds",
},
url: "music/04_31_seconds.mp3",
},
{
metaData: {
artist: "Mewark",
title: "Static",
},
url: "music/05_static.opus",
},
{
metaData: {
artist: "Plus-Tech Squeeze Box",
title: "SUZZY P",
},
url: "music/06_suzzy_p.opus",
},
{
metaData: {
artist: "Олег Эмиров",
title: "Чистосердечное признание: Расследование",
},
url: "music/07_chpr_rassledovanie.opus",
},
],
};
document.addEventListener("DOMContentLoaded", function () {
// #region Create a Webamp target
const target = document.createElement("div");
const betweens = (window.innerWidth - 640) / 2;
const left = 640 + betweens + (betweens / 2);
target.style = `position: absolute; width: 0px; height: 0px; top: 50%; left: ${left}px`;
document.body.append(target);
// #endregion
// #region Render the Webamp window
const webamp = new Webamp(WEBAMP_CONFIG);
webamp.renderWhenReady(target).then(() => target.remove());
// #endregion
});
|