开放评论、live2d与音乐盒!

开放评论、live2d与音乐盒!

音乐盒基础设置

‘.\source_data\fluid_config.yml’

1
2
3
4
5
6
aplayer:  # 音乐播放器
enable: true
order: 'random' # 播放顺序,可选值: 'list', 'random'
songs: # 歌曲列表,必须传入下列各参数,其中 url 与 cover 在本地需存于 source 目录,更多参数见文档:https://aplayer.js.org/#/zh-Hans/?id=%E5%8F%82%E6%95%B0
- { name: 'The Sound of a Lost Generation', artist: 'Blitz Kids', url: '/music/Blitz Kids - The Sound of a Lost Generation.mp3', cover: '/music/The Sound of a Lost Generation.jpg' }
- { name: 'シャナ', artist: 'Guiano,IA', url: '/music/Guiano,IA - シャナ.mp3', cover: '/music/シャナ.jpg' }

音乐盒自动播放

.\themes\fluid\layout_partial\plugins\aplayer.ejs

1
2
3
4
5
6
7
8
9
10
11
12
13
<%- js_ex(theme.static_prefix.aplayer, 'APlayer.min.js') %>
<%- css_ex(theme.static_prefix.aplayer, 'APlayer.min.css') %>
<script>
const ap = new APlayer({
container: document.getElementById('aplayer'),
fixed: true,
autoplay: true,
loop: 'all',
order: '<%= theme.aplayer.order %>',
preload: 'auto',
audio: <%- JSON.stringify(theme.aplayer.songs || []) %>
});
</script>

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!