gpt4 book ai didi

javascript - 有人有使用 Javascript 老派 winamp 嵌入播放器的经验吗?

转载 作者:行者123 更新时间:2023-12-01 17:23:32 26 4
gpt4 key购买 nike

我想要在我的网站上的页面加载时加载自定义 .wsz 皮肤。我仍然不明白如何做到这一点才能使其发挥作用。这是我的代码片段: https://codepen.io/cat999/pen/rNOOjJP

js


const webamp = new Webamp({
initialTracks: [{
metaData: {
artist: "DJ Mike Llama",
title: "Llama Whippin' Intro",
},
url: "https://cdn.rawgit.com/captbaritone/webamp/43434d82/mp3/llama-2.91.mp3",
duration: 5.322286,
}],
})

webamp.onMinimize(() => {
const webampEl = document.getElementById('webamp')
webampEl.style.display = 'none'
})

webamp.renderWhenReady(document.getElementById('app')).then(() => {
document.getElementById('close').addEventListener('click', (e) => {
e.stopPropagation()
const webampEl = document.getElementById('webamp')
webampEl.style.display = 'none'
})

document.getElementById('open').addEventListener('click', () => {
const webampEl = document.getElementById('webamp')
webampEl.style.display = 'block'
})
})

下面是我希望在页面加载时看到的皮肤

https://srv-file6.gofile.io/download/KwUySB/Aphex_Twin_-_Windowlicker.wsz

任何人都可以帮助我如何改进我的 js 代码以使其工作?

最佳答案

您看过文档的初始化部分吗?

https://github.com/captbaritone/webamp/blob/master/docs/usage.md#initialize-the-javascript

尝试通过添加 initialSkin 选项来构建 Webamp:

const webamp = new Webamp({
initialTracks: [{
metaData: {
artist: "DJ Mike Llama",
title: "Llama Whippin' Intro",
},
url: "https://cdn.rawgit.com/captbaritone/webamp/43434d82/mp3/llama-2.91.mp3",
duration: 5.322286,
}],
initialSkin: {
url: "https://s3.amazonaws.com/webamp-uploaded-skins/skins/dbaead7a819b238d48ca726abd0617bb.wsz"
},
})

关于javascript - 有人有使用 Javascript 老派 winamp 嵌入播放器的经验吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61247678/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com