:musical_score:极简模式JavaScript音乐播放器组件,极简、小巧、无依赖、可定制,适用于手机页面,H5活动页,微信页面等的音乐播放支持
适合手机页面,H5活动页,微信页面等的音乐播放支持
见index.html
文件
构造器:SMmuiscPlay(options)
示例演示页面:index.html
el [必须]
指定播放器所在容器(元素、页面),不指定则默认挂载在body
上
SMmuiscPlay({
el: "app",
audioUrl: "muisc/xxxx.mp3",
animaClass: "muiscIconRotate"
});
animaClass [必须]
定义音乐图标旋转动画
定义动画:
@keyframes muiscIconRotate{
from{transform: rotate(0deg);}
to{transform: rotate(360deg);}
}
设置animaClass
SMmuiscPlay({
el: "app",
audioUrl: "muisc/xxxx.mp3",
animaClass: "muiscIconRotate"
});
position
播放器位置,CSS定位
SMmuiscPlay({
el: "app",
position: "top:10px;left:10px",//左上角
audioUrl: "muisc/xxxx.mp3"
});
buttonImgSrc
音乐播放按钮图片,强烈建议使用SVG图片
SMmuiscPlay({
el: "app",
buttonImgSrc: "icon.png",
position: "top:10px;left:10px",//左上角
audioUrl: "muisc/xxxx.mp3"
});
htmls
自定义
SMmuiscPlay({
el: "app",
buttonImgSrc: "icon.png",
position: "top:10px;left:10px",//左上角
htmls: "<div>....<div>"
audioUrl: "muisc/xxxx.mp3"
});
2017.10.15
0.0.2 => 0.0.3
去掉了audioList特性
2017.08.30
升级 0.0.1 => 0.0.2
音乐播放图标
样例,可直接拷贝到页面:
@keyframes muiscIconRotate{
from{transform: rotate(0deg);}
to{transform: rotate(360deg);}
}
然后添加animaClass
属性:
SMmuiscPlay({
el: "app",
audioUrl: "muisc/xxxx.mp3",
animaClass: "muiscIconRotate"
});