step1
git clone https://github.com/MoePlayer/APlayer.git
step2
cd APlayer
cp -r dist 你的博客主目录/themes/next/source
step3
cd 你的博客主目录/themes/next/source/dist
touch music.js
step4
vim music.js
添加如下内容:
const ap = new APlayer({
container: document.getElementById('aplayer'),
fixed: true,
autoplay: true,
audio: [
{
name: "理想三旬",
artist: '陈鸿宇',
url: 'http://www.ytmp3.cn/down/46483.mp3',
cover: 'http://cdnimg103.lizhi.fm/audio_cover/2016/04/12/27782248821326471_320x320.jpg',
}
]
});
url处填写音乐外链;cover处填写该音乐播放时展示的照片的链接。
step5
vim 你的博客主目录/themes/next/layout/_layout.swig
在<body></body>
间添加如下内容:
<link rel="stylesheet" href="/dist/APlayer.min.css">
<div id="aplayer"></div>
<script type="text/javascript" src="/dist/APlayer.min.js"></script>
<script type="text/javascript" src="/dist/music.js"> </script>
step6
cd 你的博客主目录
hexo clean && hexo g && hexo s