function MusicObject(url,flag){
this.mobj=new Audio();
this.mobj.src=url;
this.enabled=true;
if(flag){
this.mobj.loop=flag;
this.mobj.addEventListener("ended",function(){
this.currentTime=0;
this.play();
});
}
}
MusicObject.prototype.setEabled=function(flag){
this.enabled=flag;
try{
if(this.mobj.isplayed){
this.mobj.pause();
}
}catch(e){
console.error("音乐停止播放错误!");
}
}
MusicObject.prototype.play=function(){
try{
this.mobj.play();
}catch(e){
console.error("音乐播放错误!");
}
}
MusicObject.prototype.pause=function(){
try{
this.mobj.pause();
}catch(e){
console.error("音乐停止播放错误!");
}
}
MusicObject.prototype.replay=function(){
try{
if(this.mobj.isplayed){
this.mobj.currentTime=0;
}
this.mobj.play();
}catch(e){
console.error("音乐重复播放错误!");
this.mobj.play();
}
}
*
回帖描述:*
链接类型:*
下载链接:*
描述:*
回帖描述:*
链接类型:*
阅读权限:*
下载链接:



聚优部落技术论坛 © 版权所有 鲁ICP备15007479号-6
Copyright(C)web.com, All Rights Reserved.
