-
Notifications
You must be signed in to change notification settings - Fork 1
/
client-config.js
182 lines (154 loc) · 3.69 KB
/
client-config.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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/**
* @description
* ClientConfig is config file for client part of networking.
*/
class ClientConfig {
// Not implemented yet
// Free to define what ever -> injectCanvas
recordCanvasOption = {
injectCanvas: () => document.getElementsByTagName("canvas")[0],
frameRequestRate: 30,
videoDuration: 20,
outputFilename: "record-gameplay.mp4",
mineType: "video/mp4",
resolutions: '800x600'
}
/**
* @description
* Default setup is `dev`.
* recommendent to use for local propose LAN ip
* like : 192.168.0.XXX if you wanna run ant test app with server.
*/
domain = "maximumroulette.com";
// domain = "localhost";
/**
* @description Important note for this property: if you
* disable (false) you can't use Account system or any other
* network. Use 'false' if you wanna make single player game.
* In other way keep it 'true'.
*
* @note [OLD]
*/
showBroadcasterOnInt = false;
/**
* networkDeepLogs control of dev logs for webRTC context only.
* @note [OLD]
*/
networkDeepLogs = false;
/**
* masterServerKey is channel access id used to connect
* multimedia server channel/multiRTC3
*/
masterServerKey = "maximumroulette.matrix-engine";
/**
* @description
* runBroadcasterOnInt load broadcaster
*
* * @note [OLD]
*
*/
runBroadcasterOnInt = false;
broadcastAutoConnect = false;
/**
* @description
* broadcasterPort Port used to connect multimedia server MultiRTC3.
* I will use it for explicit video chat multiplatform support.
* Default value is 999
*
* @note [OLD]
*
*/
broadcasterPort = 999;
/**
* @description
* broadcaster rtc session init values.
* Change it for production regime
*
* @note [OLD]
*/
broadcasterSessionDefaults = {
sessionAudio: true,
sessionVideo: false,
sessionData: true,
enableFileSharing: true,
};
/**
* @description
* Optimal for dev stage.
* read more about webRtc protocols.
* Recommended: coturn open source project.
*
* @note [OLD]
* When you run your OV there is coturn already fixed.
*/
stunList = [
"stun:stun.l.google.com:19302",
"stun:stun1.l.google.com:19302",
"stun:stun.l.google.com:19302?transport=udp",
];
/**
* New networking platform
* Based on kurento/Ov media server
*/
networking2 = {
active: true,
domain: 'maximumroulette.com',
port: 2020
};
/**
* @description
* constructor will save interest data for game platform
* For now it is just name of the game. I use it in
* pre gameplay UI game selector.
*/
constructor() {
}
getRecordCanvasOptions() {
return this.recordCanvasOption;
}
getRunBroadcasterOnInt() {
return this.runBroadcasterOnInt;
}
didAppUseBroadcast() {
return this.appUseBroadcaster;
}
getStunList() {
return this.stunList;
}
getBroadcastSockRoute() {
return this.getProtocolFromAddressBar() + this.getDomain() + ":" + this.broadcasterPort + "/";
}
getDomain() {
// localhost vs prodc domain not works CORS not equal!
if(window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") {
return window.location.hostname;
}
return this.domain;
}
getBroadcastAutoConnect() {
return this.broadcastAutoConnect;
}
getShowBroadcasterOnInt() {
return this.showBroadcasterOnInt;
}
getBroadcasterPort() {
return this.broadcasterPort;
}
getBroadcasterSessionDefaults() {
return this.broadcasterSessionDefaults;
}
getProtocolFromAddressBar() {
return (location.protocol === "https:" ? "https://" : "http://");
}
setNetworkDeepLog(newState) {
this.networkDeepLogs = newState;
}
getNetworkDeepLog() {
return this.networkDeepLogs;
}
// Used for both net variant
getMasterServerKey() {
return this.masterServerKey;
}
}
export default ClientConfig;