跳到主要内容

网站全局音乐播放器

· 阅读需 2 分钟
浅笑Azusa
Always For Fun.

基于Aplayer,能够播放来自网易,腾讯,酷狗,虾米,百度的歌单

安装模块

在网站目录执行

npm install aplayer --save

编辑主题配置文件

pjax:
enable: true
exclude:
aplayerInject:
enable: true
per_page: true
inject:
bottom:
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/meting@2.0.1/dist/Meting.min.js"></script><meting-js server="netease" type="playlist" id="5161331134" fixed="true" autoplay="true" loop="all" order="random" preload="auto" list-folded="ture" list-max-height="500px"></meting-js>

meting-js标签中的参数:

选项默认描述
id(编号)require歌曲ID /播放列表ID /专辑ID /搜索关键字
server(平台)require音乐平台:neteasetencentkugouxiamibaidu
type(类型)requiresongplaylistalbumsearchartist
auto(支持类种 类)options音乐链接,支持:neteasetencentxiami
fixed(固定模式)false启用固定模式,默认false
autoplay(自动播放)false音频自动播放,默认false
theme(主题颜色)#2980b9默认#2980b9
loop(循环)all播放器循环播放,值:“all”,one”,“none”
order(顺序)list播放器播放顺序,值:“list”,“random”
preload(加载)auto值:“none”,“metadata”,“'auto”
volume(音量)0.7默认音量,播放器会记住用户设置,用户自己设置音量后失效
mutex(限制)true独占播放,在该播放器开始播放时暂停其他播放器
lrc-type(歌词)0歌词显示
list-folded(列表折叠)false指示列表是否应该首先折叠
list-max-height(最大高度)340px列出最大高度
storage-name(储存名称)metingjs存储播放器设置的localStorage键