下面我就隆重介绍一款html5音乐播放器:Aplayer。把Aplayer加入hexo需要用到hexo-tag-aplayer插件。
切换到hexo目录,运行:
1 | $ npm install --save hexo-tag-aplayer |
More info: Writing
安装完成后,在需要添加音乐的地方加上:
1 | $ {% aplayer "歌曲名称" "作者" "音乐_url" "封面图片_url" "autoplay" %} |
More info: Server
hexo d --g
之后就会出现你想要的音乐啦!
如果你想加入歌单,把上面的代码换成下面代码就行,参数的用法可以参照插件的使用说明。
1 | {% aplayerlist %}{"narrow": false,"autoplay": true,"showlrc": 3,"mode": "random","music": [{"title": "平凡之路","author": "朴树","url": "http://og9ocpmwk.bkt.clouddn.com/%E5%B9%B3%E5%87%A1%E4%B9%8B%E8%B7%AF.mp3","pic": "https://ogd99kckh.qnssl.com/1.jpg","lrc": "http://og9ocpmwk.bkt.clouddn.com/%E5%B9%B3%E5%87%A1%E4%B9%8B%E8%B7%AF.txt"},{"title": "野子","author": 1100000苏运莹","url": "http://og9ocpmwk.bkt.clouddn.com/01%20%E9%87%8E%E5%AD%90.m4a","pic": "http://og9ocpmwk.bkt.clouddn.com/%E9%87%8E%E5%AD%90.jpg","lrc":"https://ogd99kckh.qnssl.com/%E9%87%8E%E5%AD%90.txt"}]}{% endaplayerlist %} |
当然,Aplayer的作者还有一款html5的视频播放器,叫Dplayer,对应有一款hexo的插件,叫hexo-tag-dplayer,有需求的可以去看看,用法都差不多。
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.