<script> (function() {
// 确保APlayer加载完成
function initAPlayer() {
if (typeof APlayer === 'undefined') {
setTimeout(initAPlayer, 100);
return;
}
// 解析歌曲参数
var songs = [];
{{#forargs: song
|
| {{#if: {{#pos:{{#var:key}}|song}}
| songs.push({
name: "{{#explode:{{#var:value}}|;|0}}",
artist: "{{#explode:{{#var:value}}|;|1}}",
url: "{{#explode:{{#var:value}}|;|2}}",
cover: "{{#explode:{{#var:value}}|;|3|https://placehold.co/80x80?text=No+Cover}}"
});
}}
}}
// 初始化播放器
new APlayer({
container: document.getElementById('aplayer-default'),
audio: songs,
lrcType: 0,
fixed: false,
mini: false,
theme: '#2980b9'
});
}
// 等待DOM加载完成后执行
document.addEventListener('DOMContentLoaded', initAPlayer);
})(); </script>