-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaudio.js
82 lines (82 loc) · 1.84 KB
/
audio.js
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
export class Audio {
constructor(...args) {
console.log('Audio constructor', args);
this.src = '';
this._readyState = 0;
this._currentTime = 0;
this._duration = 0;
this._paused = false;
this._ended = false;
}
canPlaySound(type) {
console.log('audio canPlaySound', type);
return true;
}
canPlayType(type) {
// we're using ffmpeg, we can decode anything.
return 'probably';
}
addEventListner(type, listener) {
console.log('audio addEventListner', type, listener);
}
removeEventListner(type, listener) {
console.log('audio removeEventListner', type, listener);
}
set src(newsrc) {
console.log('audio set src', newsrc);
this._src = newsrc;
}
get src() {
console.log('audio get src');
return this._src;
}
play() {
console.log('Audio play');
}
pause() {
console.log('Audio pause');
}
load() {
console.log('Audio load');
}
set volume(newvolume) {
console.log('audio set volume', newvolume);
this._volume = newvolume;
}
get volume() {
console.log('audio get volume');
return this._volume;
}
set loop(newloop) {
console.log('audio set loop', newloop);
this._loop = newloop;
}
get loop() {
console.log('audio get loop');
return this._loop;
}
set currentTime(newcurrentTime) {
console.log('audio set currentTime', newcurrentTime);
this._currentTime = newcurrentTime;
}
get currentTime() {
console.log('audio get currentTime');
return this._currentTime;
}
get duration() {
console.log('audio get duration');
return this._duration;
}
get paused() {
console.log('audio get paused');
return this._paused;
}
get ended() {
console.log('audio get ended');
return this._ended;
}
get readyState() {
console.log('audio get readyState');
return this._readyState;
}
}