当前位置:网站首页>如何在博客中添加Aplayer音乐播放器
如何在博客中添加Aplayer音乐播放器
2022-07-07 09:09:00 【InfoQ】
前言
教程
1.音乐插件
- 官网:https://aplayer.js.org/
- Github:https://github.com/MoePlayer/APlayer/
2.音乐资源
- 小白盘:https://www.xiaobaipan.com/
- 魔方城堡:http://www.mfcb.net/wsyy/
- 23APE:http://www.23ape.net/
- HIFINI:https://www.hifini.com/
3.实现代码
APlayer.min.js
APlayer.min.css
WordPress
wp-content
<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>
3.1Mini播放器
WordPress
<meta charset="utf-8">
<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>
<div id='aplayer'></div>
<script>
var ap = new APlayer
({
element: document.getElementById('aplayer'),
showlrc: false,
fixed: true,
mini: true,
audio: {
title: '半岛铁盒',
author: '周杰伦',
url: 'https://echeverra.cn/wp-content/uploads/2022/05/周杰伦-半岛铁盒.mp3',
pic: 'https://echeverra.cn/wp-content/uploads/2022/05/周杰伦-半岛铁盒-mp3-image.png'
}
});
ap.init();
</script>
audio
<script>
var ap = new APlayer
({
element: document.getElementById('aplayer'),
showlrc: false,
fixed: true,
mini: true,
audio: [
{
title: '半岛铁盒',
author: '周杰伦',
url: 'https://echeverra.cn/wp-content/uploads/2022/05/周杰伦-半岛铁盒.mp3',
pic: 'https://echeverra.cn/wp-content/uploads/2022/05/周杰伦-半岛铁盒-mp3-image.png'
},
{
title: '给我一首歌的时间',
author: '周杰伦',
url: 'https://echeverra.cn/wp-content/uploads/2021/06/周杰伦-给我一首歌的时间.mp3',
pic: 'https://echeverra.cn/wp-content/uploads/2021/06/周杰伦-给我一首歌的时间-mp3-image.png'
}
]
});
ap.init();
</script>
3.2单页面音乐
fixed
mini
false
<link rel="stylesheet" href="https://echeverra.cn/wp-content/APlayer.min.css">
<script src="https://echeverra.cn/wp-content/APlayer.min.js"></script>
<div id='demo'></div>
<script>
var demo = new APlayer
({
element: document.getElementById('demo'),
showlrc: false,
fixed: false,
mini: false,
audio: [
{
title: '半岛铁盒',
author: '周杰伦',
url: 'https://echeverra.cn/wp-content/uploads/2022/05/周杰伦-半岛铁盒.mp3',
pic: 'https://echeverra.cn/wp-content/uploads/2022/05/周杰伦-半岛铁盒-mp3-image.png'
},
{
title: '给我一首歌的时间',
author: '周杰伦',
url: 'https://echeverra.cn/wp-content/uploads/2021/06/周杰伦-给我一首歌的时间.mp3',
pic: 'https://echeverra.cn/wp-content/uploads/2021/06/周杰伦-给我一首歌的时间-mp3-image.png'
}
]
});
demo.init();
</script>
<div id="apalyer"></div>
id
new
Aplayer
audio
mutex
true
<div id='demo1'></div>
<div id='demo2'></div>
<script>
var demo1 = new APlayer
({
element: document.getElementById('demo1'),
showlrc: false,
audio: {
title: '半岛铁盒',
author: '周杰伦',
url: 'https://echeverra.cn/wp-content/uploads/2022/05/周杰伦-半岛铁盒.mp3',
pic: 'https://echeverra.cn/wp-content/uploads/2022/05/周杰伦-半岛铁盒-mp3-image.png'
}
});
var demo2 = new APlayer
({
element: document.getElementById('demo2'),
showlrc: false,
audio: {
title: '给我一首歌的时间',
author: '周杰伦',
url: 'https://echeverra.cn/wp-content/uploads/2021/06/周杰伦-给我一首歌的时间.mp3',
pic: 'https://echeverra.cn/wp-content/uploads/2021/06/周杰伦-给我一首歌的时间-mp3-image.png'
}
});
demo1.init();
demo2.init();
</script>
<script>
<p>
fixed
mini
true
false
4.Meting三方音乐
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/Meting.min.js"></script>
4.1单曲引入
<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/[email protected]/dist/Meting.min.js"></script>
<meting-js server="netease" type="song" id="2526628"></meting-js>
server="netease"
type="song"
id="2526628"
4.2歌单引入
<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/[email protected]/dist/Meting.min.js"></script>
<meting-js server="netease" type="playlist" id="7360465359"></meting-js>
server="netease"
type="playlist"
id="7360465359"
4.3Mini播放器
<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/[email protected]/dist/Meting.min.js"></script>
<meting-js
server="netease"
type="playlist"
id="7360465359"
fixed="true"
mini="true"
order="random"
loop="all"
preload="auto"
list-folded="false">
</meting-js>
server、type、id
fixed="true", mini="true"
order="random"
4.4博客园音乐引入
- Aplayer官方文档
- Aplayer搭配Metingjs音乐插件的使用
- MetingJS 是如何配合 Aplayer 加载歌单的
边栏推荐
- SQL Server knowledge collection 11: Constraints
- 【C#】WinForm运行缩放(变糊)的解决方法
- [untitled]
- 【pyqt】tableWidget里的cellWidget使用信号与槽机制
- vim 的各种用法,很实用哦,都是本人是在工作中学习和总结的
- VIM命令模式与输入模式切换
- Use of dotween
- Get pictures through opencv, change channels and save them
- Bookmarking - common website navigation for programmers
- Antd select selector drop-down box follows the scroll bar to scroll through the solution
猜你喜欢
seata 1.3.0 四種模式解决分布式事務(AT、TCC、SAGA、XA)
verilog设计抢答器【附源码】
[machine learning 03] Lagrange multiplier method
Qtcreator sets multiple qmake
Static semantic check of clang tidy in cicd
JS add spaces to the string
Wallhaven壁纸桌面版
[pyqt] the cellwidget in tablewidget uses signal and slot mechanism
Using ENSP to do MPLS pseudo wire test
VR development optimization
随机推荐
A simple example of delegate usage
shardingsphere分库分表示例(逻辑表,真实表,绑定表,广播表,单表)
Deep understanding of Apache Hudi asynchronous indexing mechanism
Array object sorting
The sixth training assignment
Force buckle 1002 Find common characters
PostgreSQL中的表复制
Galaxy Kirin desktop operating system installation postgresql13 (source code installation)
Socket socket programming
【亲测可行】error while loading shared libraries的解决方案
How to remove addition and subtraction from inputnumber input box
变量的解构赋值
Opencv installation and environment configuration - vs2017
2021-04-08
Long list performance optimization scheme memo
[machine learning 03] Lagrange multiplier method
Vuthink正确安装过程
The use of list and Its Simulation Implementation
JS array delete the specified element
Shardingsphere sub database and table examples (logical table, real table, binding table, broadcast table, single table)