d-audio
插件演示地址: http://www.daiwei.org/components/d-audio
简洁的音乐播放器插件
新版本d-audio上线
食用方法
安装:
npm install d-audio
引入
import dAudio from 'd-audio'
const d = new dAudio ({
ele: '#d-audio',
src: '地址',
imageurl: '地址',
name: '音乐名字',
singer: '歌手名字',
next: function () {},
ended: function () {}
})
es5安装:
如果不再es6环境下的代码,可以引入该项目根目录的lib文件夹下,引入js和css即可
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="http://daiwei.org/components/d-audio/lib/d-audio.css">
<title>d-audio</title>
</head>
<body>
<div class="d-audio" style="width: 300px;"></div>
</body>
<script src="http://daiwei.org/components/d-audio/lib/d-audio.js"></script>
<script>
var myAudio = new Daudio({
ele: '.d-audio',
...
})
</script>
</html>
参数
ele: '#d-audio',
imageurl: 'http://www.daiwei.org/sunmmer.jpg',
src: '',
name: '',
singer: '',
showprogress: true,
initstate: '',
loop: false,
ended: () => {},
next: () => {}
实例化对象方法
d.showLoading()
d.hideLoading()
d.play()
d.pause()
d.playPause()
d.checkAudio(src, imageurl, name, singer)