-
Notifications
You must be signed in to change notification settings - Fork 15
/
index.html
117 lines (89 loc) · 3.84 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
<html>
<head>
<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
<script>
var audioPlayer = null;
var audioPlayer2 = null;
var audioPlayerLoop = null;
var audioPlayerLoop2 = null;
var audioPlayerLoop3 = null;
var audioPlayerLoop4 = null;
// Listen for NUI Messages.
window.addEventListener('message', function(event) {
// Check for playSound transaction
if (event.data.transactionType == "playSound") {
if (audioPlayer != null) {
audioPlayer.pause();
}
audioPlayer = new Audio("./sounds/" + event.data.transactionFile + ".ogg");
audioPlayer.volume = event.data.transactionVolume;
audioPlayer.play();
}
if (event.data.transactionType == "playSound2") {
if (audioPlayer2 != null) {
audioPlayer2.pause();
}
audioPlayer2 = new Audio("./sounds/" + event.data.transactionFile + ".ogg");
audioPlayer2.volume = event.data.transactionVolume;
audioPlayer2.play();
}
if (event.data.transactionType == "playLoop") {
if (audioPlayerLoop != null) {
audioPlayerLoop.pause();
}
audioPlayerLoop = new Audio("./sounds/" + event.data.transactionFile + ".ogg");
audioPlayerLoop.volume = event.data.transactionVolume;
audioPlayerLoop.loop = true;
audioPlayerLoop.play();
}
if (event.data.transactionType == "stopLoop") {
if (audioPlayerLoop != null) {
audioPlayerLoop.pause();
}
}
if (event.data.transactionType == "playLoop2") {
if (audioPlayerLoop2 != null) {
audioPlayerLoop2.pause();
}
audioPlayerLoop2 = new Audio("./sounds/" + event.data.transactionFile + ".ogg");
audioPlayerLoop2.volume = event.data.transactionVolume;
audioPlayerLoop2.loop = true;
audioPlayerLoop2.play();
}
if (event.data.transactionType == "stopLoop2") {
if (audioPlayerLoop2 != null) {
audioPlayerLoop2.pause();
}
}
if (event.data.transactionType == "playLoop3") {
if (audioPlayerLoop3 != null) {
audioPlayerLoop3.pause();
}
audioPlayerLoop3 = new Audio("./sounds/" + event.data.transactionFile + ".ogg");
audioPlayerLoop3.volume = event.data.transactionVolume;
audioPlayerLoop3.loop = true;
audioPlayerLoop3.play();
}
if (event.data.transactionType == "stopLoop3") {
if (audioPlayerLoop3 != null) {
audioPlayerLoop3.pause();
}
}
if (event.data.transactionType == "playLoop4") {
if (audioPlayerLoop3 != null) {
audioPlayerLoop4.pause();
}
audioPlayerLoop4 = new Audio("./sounds/" + event.data.transactionFile + ".ogg");
audioPlayerLoop4.volume = event.data.transactionVolume;
audioPlayerLoop4.loop = true;
audioPlayerLoop4.play();
}
if (event.data.transactionType == "stopLoop4") {
if (audioPlayerLoop4 != null) {
audioPlayerLoop4.pause();
}
}
});
</script>
</head>
</html>