Improve asset handling
This commit is contained in:
@ -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>"
|
||||
|
Reference in New Issue
Block a user