有没有类似MentingJS的音乐插件
时间: 2023-07-01 08:16:22 浏览: 56
如果您想要类似于 MentionsJS 的音乐插件,我推荐您使用 APlayer(https://github.com/MoePlayer/APlayer)。APlayer 是一个基于 HTML5 的音乐播放器,支持多种音频格式,可以自定义配置,支持歌词显示等功能。以下是示例代码:
```html
<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>
const ap = new APlayer({
container: document.getElementById('aplayer'),
autoplay: false,
loop: 'all',
volume: 0.7,
audio: [{
name: 'name1',
artist: 'artist1',
url: 'url1.mp3',
cover: 'cover1.jpg'
}, {
name: 'name2',
artist: 'artist2',
url: 'url2.mp3',
cover: 'cover2.jpg'
}]
});
</script>
```
您可以在 `audio` 数组中添加多个音频文件,包括歌曲名、歌手名、音频文件 URL 和封面图片等信息。在 `container` 属性中设置播放器的容器元素,其他属性可以根据需要自定义配置。如果需要添加歌词,可以在 `audio` 数组中添加 `lrc` 字段,值为歌词文件 URL。
APlayer 也提供了丰富的 API,可以实现自定义功能。更多详细信息可以参考官方文档。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![mp4](https://img-home.csdnimg.cn/images/20210720083504.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)