Improve asset handling

This commit is contained in:
Christoph Hagen
2024-12-16 15:36:58 +01:00
parent 31d1ecb8bd
commit b22b76fd32
21 changed files with 264 additions and 85 deletions

View File

@ -18,11 +18,11 @@ struct AudioPlayerScript: HtmlProducer {
}
func populate(_ result: inout String) {
result += "<script>\n"
result += "<script>window.onload = () => { "
result += "Amplitude.init({ songs: "
let songData = try! JSONEncoder().encode(items)
result += String(data: songData, encoding: .utf8)!
result += "});"
result += "}); }; " // Close Amplitude.init and window.onload
result += "function playEntry(index) { Amplitude.playSongAtIndex(index) };"
result += animatePlaylist
result += "</script>"