-
Notifications
You must be signed in to change notification settings - Fork 4
/
example.html
40 lines (37 loc) · 1003 Bytes
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>audioPlugin Demo</title>
</head>
<body>
<script type="text/javascript" src="src/audioPlayPlugin.js"></script>
<script>
/*
var bgAudio=new audioController();
bgAudio.events("play",function(){console.log("开始播放了。")});
bgAudio.events({
"timeupdate":function(){
process=bgAudio.getAttr("currentTime")/bgAudio.getAttr("duration");
console.log("当前播放进度:"+(process*100||0).toFixed(2)+"%")
},
"ended":function(){
console.log("播放结束了!")
}
});
bgAudio.play("file/test1.mp3");*/
var bgAudio=new audioController();
bgAudio.supportAutoPlay({
src:"file/test1.mp3",
support:playAudio,
nonsupport:function(){
document.addEventListener("click",playAudio)
}
})
function playAudio(){
bgAudio.play("file/test1.mp3");
document.removeEventListener("click",playAudio);
}
</script>
</body>
</html>