-
Notifications
You must be signed in to change notification settings - Fork 26
/
index.html
136 lines (134 loc) · 4.46 KB
/
index.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<html>
<head><title>WavPlayer - flash wav/au player for arbitrary samplerate and PCM/G711 codecs</title>
<script>
function getPlayer(pid) {
var obj = document.getElementById(pid);
if (obj.doPlay) return obj;
for(i=0; i<obj.childNodes.length; i++) {
var child = obj.childNodes[i];
if (child.tagName == "EMBED") return child;
}
}
function doPlay(fname) {
var player = getPlayer('haxe');
player.doPlay(fname);
}
function doStop() {
var player = getPlayer('haxe');
player.doStop();
}
function setVolume(v) {
var player = getPlayer('haxe');
player.setVolume(v);
}
function setPan(p) {
var player = getPlayer('haxe');
player.setPan(p);
}
var SoundLen = 0;
var SoundPos = 0;
var Last = undefined;
var State = "STOPPED";
var Timer = undefined;
function getPerc(a, b) {
return ((b==0?0.0:a/b)*100).toFixed(2);
}
function FileLoad(bytesLoad, bytesTotal) {
document.getElementById('InfoFile').innerHTML = "Loaded "+bytesLoad+"/"+bytesTotal+" bytes ("+getPerc(BytesLoad,BytesTotal)+"%)";
}
function SoundLoad(secLoad, secTotal) {
document.getElementById('InfoSound').innerHTML = "Available "+secLoad.toFixed(2)+"/"+secTotal.toFixed(2)+" seconds ("+getPerc(secLoad,secTotal)+"%)";
SoundLen = secTotal;
}
var InfoState = undefined;
function Inform() {
if (Last != undefined) {
var now = new Date();
var interval = (now.getTime()-Last.getTime())/1000;
SoundPos += interval;
Last = now;
}
InfoState.innerHTML = State + "("+SoundPos.toFixed(2)+"/"+SoundLen.toFixed(2)+") sec ("+getPerc(SoundPos,SoundLen)+"%)";
}
function SoundState(state, position) {
if (position != undefined) SoundPos = position;
if (State != "PLAYING" && state=="PLAYING") {
Last = new Date();
Timer = setInterval(Inform, 100);
Inform();
} else
if (State == "PLAYING" && state!="PLAYING") {
clearInterval(Timer);
Timer = undefined;
Inform();
}
State = state;
Inform();
}
function init() {
var player = getPlayer('haxe');
if (!player || !player.attachHandler) setTimeout(init, 100); // Wait for load
else {
player.attachHandler("progress", "FileLoad");
player.attachHandler("PLAYER_LOAD", "SoundLoad");
player.attachHandler("PLAYER_BUFFERING", "SoundState", "BUFFERING");
player.attachHandler("PLAYER_PLAYING", "SoundState", "PLAYING");
player.attachHandler("PLAYER_STOPPED", "SoundState", "STOPPED");
player.attachHandler("PLAYER_PAUSED", "SoundState", "PAUSED");
InfoState = document.getElementById('InfoState')
Inform();
}
}
</script>
</head>
<body bgcolor="#dddddd" onload="init()">
<a href="javascript:doPlay()">doPlay()</a>
<a href="javascript:doPlay('test.gsm')">doPlay('test.gsm')</a>
<a href="javascript:doPlay('test.au')">doPlay('test.au')</a>
<a href="javascript:doPlay('direct-5683.au')">doPlay('direct-5683.au')</a>
<a href="javascript:doPlay('adpcm_8k.wav')">doPlay('adpcm_8k.wav')</a>
<a href="javascript:doPlay('ADPCM.wav')">doPlay('ADPCM.wav')</a>
<a href="javascript:doPlay('ADPCM8k.wav')">doPlay('ADPCM8k.wav')</a>
<a href="javascript:doPlay('ADPCMmono.wav')">doPlay('ADPCMmono.wav')</a>
<a href="javascript:doStop()">doStop()</a>
<br />
<a href="javascript:setVolume(5.0)">Volume 500%</a>
<a href="javascript:setVolume(2.0)">Volume 200%</a>
<a href="javascript:setVolume(1.0)">Volume 100%</a>
<a href="javascript:setVolume(0.5)">Volume 50%</a>
<a href="javascript:setVolume(0.1)">Volume 10%</a>
<a href="javascript:setVolume(0.0)">Volume 0% (mute)</a>
<br />
<a href="javascript:setPan(0.0)">Balance: center</a>
<a href="javascript:setPan(-1.0)">Balance: left</a>
<a href="javascript:setPan(1.0)">Balance: right</a>
<br/>
<div id="InfoFile"></div>
<div id="InfoSound"></div>
<div id="InfoState"></div>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
width="2000"
height="3000"
id="haxe"
align="middle">
<param name="movie" value="wavplayer-debug.swf?gui=full&h=20&w=300&sound=test-vf-44100.au&"/>
<param name="allowScriptAccess" value="always" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
<param name="bgcolor" value="#dddddd"/>
<embed src="wavplayer-debug.swf?gui=full&h=20&w=300&sound=test-vf-44100.au&"
bgcolor="#dddddd"
width="2000"
height="3000"
name="haxe"
quality="high"
align="middle"
scale="noscale"
allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
/>
</object>
</body>
</html>