音乐组件
发表于|美化记录
|字数总计:527|阅读时长:2分钟|阅读量:
方式一:使用外网易云音乐提供的*外链播放器*
复制粘贴代码即可
方式二:使用hexo-tag-aplayer插件
安装
1 | npm install --save hexo-tag-aplayer |
这里直接跳过APlayer.js 使用Meing.js
MetingJS 支持性更高
在Hexo 根配置文件 _config.yml 中设置:
1 | aplayer: |
使用:
1 | {% meting "523250334" "netease" "song" "theme:#555" "mutex:true" "listmaxheight:340px" "preload:auto" %} |
示范:(弃用)
1 | {% meting "523250334" "netease" "song" "theme:a18cd1" "mutex:true" "listmaxheight:340px" "preload:auto" %} |
有关 {% meting %} 的选项列表如下:
| 选项 | 默认值 | 描述 |
|---|---|---|
| id | 必须值 | 歌曲 id / 播放列表 id / 相册 id / 搜索关键字 |
| server | 必须值 | 音乐平台: netease, tencent, kugou, xiami, baidu |
| type | 必须值 | song, playlist, album, search, artist |
| fixed | false | 开启固定模式 |
| mini | false | 开启迷你模式 |
| loop | all | 列表循环模式:all, one,none |
| order | list | 列表播放模式: list, random |
| volume | 0.7 | 播放器音量 |
| lrctype | 0 | 歌词格式类型 |
| listfolded | false | 指定音乐播放列表是否折叠 |
| storagename | metingjs | LocalStorage 中存储播放器设定的键名 |
| autoplay | true | 自动播放,移动端浏览器暂时不支持此功能 |
| mutex | true | 该选项开启时,如果同页面有其他 aplayer 播放,该播放器会暂停 |
| listmaxheight | 340px | 播放列表的最大长度 |
| preload | auto | 音乐文件预载入模式,可选项: none, metadata, auto |
| theme | #ad7a86 | 播放器风格色彩设置 |
方式三:全局全局吸底Aplayer
关闭 asset_inject(未使用hexo-tag-aplayer可忽略)
1 | aplayer: |
开启主题的 aplayerInject
1 | # Inject the css and script (aplayer/meting) |
插入 Aplayer html
1 | inject: |
文章作者: Jerry
文章连结: https://butterfly.js.org/posts/507c070f/
评论
