GlobalConfig.js
11.3 KB
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
/*
* 全局数据管理
* */
import Loger from 'Loger';
import ApeConsts from "apes/ApeConsts";
let loger = Loger.getLoger('GlobalConfig');
import EngineUtils from 'EngineUtils';
class GlobalConfig {
constructor () {
}
_currentStatus=null;
static getCurrentStatus(){
if(this._currentStatus==null){
this._currentStatus=this.statusCode_0;
}
return this._currentStatus;
}
static setCurrentStatus(_data){
this._currentStatus=_data;
}
static getClassDetail(){
return this.classDetail;
}
static setClassDetail(_data){
this.classDetail=_data;
}
static getClassInfo (){
let classInfo={};
classInfo.siteId= this.siteId;
classInfo.classId= this.classId;
classInfo.className=this.className;
classInfo.h5Module= this.h5Module;
classInfo.nodeId=this.nodeId;
classInfo.topNodeID=this.topNodeID;
classInfo.userRole=this.userRole;
classInfo.role= this.role;
classInfo.isHost= this.isHost;
classInfo.userId= this.userId;
classInfo.userName= this.userName;
classInfo.password= this.password;
classInfo.userType= this.userType;
classInfo.passwordRequired= this.passwordRequired;
classInfo.md5=this.md5;
classInfo.msType= this.msType;
classInfo.portal= this.portal;
classInfo.mcuDelay=this.mcuDelay;
classInfo.MCUServerIP=this.MCUServerIP;
classInfo.MCUServerPort=this.MCUServerPort;
classInfo.maxVideoChannels= this.maxVideoChannels;
classInfo.maxAudioChannels=this.maxAudioChannels;
return classInfo;
}
//获取当前的课堂状态的信息
static get classStatusInfo(){
let classStatusInfo={};
classStatusInfo.siteId=this.siteId;//站点号
classStatusInfo.classId=this.classId;
classStatusInfo.className=this.className;
classStatusInfo.classType=this.classType;//课堂类型
classStatusInfo.classStatus=this.classStatus;//课堂的状态
classStatusInfo.classStartTime=this.classStartTime;//课堂点击开始时间
classStatusInfo.classStopTime=this.classStopTime;//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳
classStatusInfo.classTimestamp=this.classTimestamp;//相对于点开始课堂的时间戳
classStatusInfo.classBeginTime=this.classBeginTime;//课堂创建的时间,这个是Sass返回的
classStatusInfo.classEndTime=this.classEndTime;//课堂结束的时间,这个是Sass返回的
classStatusInfo.recordStatus=this.recordStatus;//当前录制状态
classStatusInfo.recordTimestamp=this.recordTimestamp;//相对于首次开始录制的时间戳
classStatusInfo.recordFileName=this.recordFileName;//录制的文件名
classStatusInfo.recordDownloadUrl=this.recordDownloadUrl;//下载地址
classStatusInfo.serverTimestamp=this.serverTimestamp;//当前的系统时间戳
classStatusInfo.activeDocId=this.activeDocId;//当前激活的文档ID
classStatusInfo.activeDocCurPage=this.activeDocCurPage;//当前激活的文档的当前页
return classStatusInfo;
}
//设置当前的课堂状态的信息
static setClassStatusInfo(_data){
loger.log("setClassStatusInfo");
if(_data==null){
loger.warn("classStatusInfo error,_data:",_data);
return;
}
let data=_data;
this.siteId=data.siteId||this.siteId;//站点号
this.classId=data.classId||this.classId;
this.className=data.className||this.className;
this.classType=data.classType||this.classType;//课堂类型
this.classStatus=data.classStatus||this.classStatus;//课堂的状态
this.classStartTime=data.classStartTime||this.classStartTime;//课堂点击开始时间
this.classStopTime=data.classStopTime||this.classStopTime;//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳
this.classTimestamp=data.classTimestamp||this.classTimestamp;//相对于点开始课堂的时间戳
this.classBeginTime=data.classBeginTime||this.classBeginTime;//课堂创建的时间,这个是Sass返回的
this.classEndTime=data.classEndTime||this.classEndTime;//课堂结束的时间,这个是Sass返回的
this.recordStatus=data.recordStatus||this.recordStatus;//当前录制状态
this.recordTimestamp=data.recordTimestamp||this.recordTimestamp;//相对于首次开始录制的时间戳
this.recordFileName=data.recordFileName||this.recordFileName;//录制的文件名
this.recordDownloadUrl=data.recordDownloadUrl||this.recordDownloadUrl;//下载地址
this.activeDocId=data.activeDocId||this.activeDocId;//当前激活的文档ID
this.activeDocCurPage=data.activeDocCurPage||this.activeDocCurPage;//当前激活的文档的当前页
}
// 判断自己是否主持人角色
static get isHost(){
if(this.userRole ==ApeConsts.host){
return true;
}
return false;
}
// 判断自己是否助教角色
static get isAssistant()
{
if(this.userRole ==ApeConsts.assistant){
return true;
}
return false;
}
// 判断自己是否主讲人角色
static get isPresenter()
{
if(this.userRole ==ApeConsts.presenter){
return true;
}
return false;
}
// 判断自己是否普通角色
static get isNormal()
{
if(this.userRole ==ApeConsts.normal) {
return true;
}
return false;
}
// 判断自己是否是隐身用户
static get isInvisible(){
if(this.userRole == ApeConsts.invisible){
return true;
}
return false;
}
static get serverTimestamp(){
return EngineUtils.creatTimestamp();
}
//储存已经提前上传的文档列表
static setDocListPrepare(_data){
if(_data==null) return;
this.docListPrepare=_data;
}
static getDocListPrepare(){
return this.docListPrepare;
}
//储存录制列表
static setRecordList(_data){
if(_data==null) return;
this.recordList=_data;
}
static getRecordList(){
return this.recordList;
}
//文档服务器列表
static setDocList(_data){
if(_data==null) return;
this.docList=_data;
}
static getDocList(){
return this.docList;
}
//ms列表
static setMsList(_data){
if(_data==null) return;
this.msList=_data;
}
static getMsList(){
return this.msList;
}
//mcu列表
static setMcuList(_data){
if(_data==null) return;
this.mcuList=_data;
}
static getMcuList(){
return this.mcuList;
}
//声音列表
static setMusicList(_data){
if(_data==null) return;
this.musicList=_data;
}
static getMusicList(){
return this.musicList;
}
//已经上传的声音列表
static setMusicListPrepare(_data){
if(_data==null) return;
this.musicListPrepare=_data;
}
static getMusicListPrepare(){
return this.musicListPrepare;
}
//rs列表
static setRsList(_data){
if(_data==null) return;
this.rsList=_data;
}
static getRsList(){
return this.rsList;
}
}
GlobalConfig.statusCode_0={"code":0,message:"SDK 未初始化"};
GlobalConfig.statusCode_1={"code":1,message:"未加入会议"};
GlobalConfig.statusCode_2={"code":2,message:"已经加入会议"};
GlobalConfig.statusCode_3={"code":3,message:"已经离开会议"};
GlobalConfig.statusCode_4={"code":4,message:"未知状态"};
GlobalConfig.md5="";
GlobalConfig.msType=1;//目前固定用这个
GlobalConfig.mcuDelay=60;//默认的延迟时间,flash中设置的是3000
GlobalConfig.docDelay=1600;//文档模块加入成功之后延迟发送送成功的消息给主模块
GlobalConfig.portal="112.126.80.182:80";//Sass IP
//GlobalConfig.ip="112.126.80.182";
//GlobalConfig.port="80";
GlobalConfig.MCUServerIP="114.215.195.70";
GlobalConfig.MCUServerPort=9003;
GlobalConfig.MSServerIP = "";//推流 播流的地址
GlobalConfig.MSServerPort ="";
//m3u8播流地址
GlobalConfig.RSServerIP ="";
GlobalConfig.RSServerPort ="";
//DOC
GlobalConfig.DOCServerIP ="";
GlobalConfig.DOCServerPort ="";
GlobalConfig.RecordServerIP ="";
GlobalConfig.RecordServerPort ="";
GlobalConfig.maxVideoChannels=0;
GlobalConfig.maxAudioChannels=0;
GlobalConfig.hasCamera=false;//摄像头是否可用
GlobalConfig.hasMicrophone=false;//麦克风是否可用
GlobalConfig.deviceType=0; //设备类型 0:电脑 1:安卓 2:ios
GlobalConfig.userIP="";//用户当前IP
GlobalConfig.userId=0;
GlobalConfig.userName="";
GlobalConfig.nodeId=0;//随机生成 mcu中的唯一ID
GlobalConfig.passwordRequired=false;
GlobalConfig.password="";
GlobalConfig.userType=8;
GlobalConfig.userRole=ApeConsts.normal;//用户的身份,5种类型:
GlobalConfig.role=ApeConsts.NR_NORMAL;//课堂角色身份
GlobalConfig.h5Module=1;//是否支持H5
GlobalConfig.topNodeID=101;//现在固定值,还不知道是做什么用
GlobalConfig.siteId="gust";//站点号
GlobalConfig.className= ""; // 课程名称
GlobalConfig.classId=0;//课堂号=classId=meetingNumber 之后统一修改为classId
GlobalConfig.classType=ApeConsts.CLASS_TYPE_INTERACT;//课堂类型 1:互动课堂,2:直播课堂
GlobalConfig.classStatus=ApeConsts.CLASS_STATUS_WAIT;// 0;//课堂还未开始 1;//直播中 2 //课间休息 3已经停止
GlobalConfig.classStartTime="";//课堂点击开始时间
GlobalConfig.classStopTime="";//最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳
GlobalConfig.classBeginTime="";//课堂创建的时间,这个是Sass返回的
GlobalConfig.classEndTime="";//课堂结束的时间,这个是Sass返回的
GlobalConfig.classTimestamp=0;//从课堂开始到现在的时
GlobalConfig.recordStatus=false;//当前录制状态
GlobalConfig.recordTimestamp=0;//相对于首次开始录制的进行时间
GlobalConfig.recordFileName="";//录制的文件名,如 果为空就创建一个
GlobalConfig.recordDownloadUrl="";//下载地址
GlobalConfig.recordReplaytickValues={}; // 滚动条关键点,用于快进快退
GlobalConfig.updateClassInfoDelay=30;//(秒),每隔30秒同步一次会议状态的并保存到Sass
//GlobalConfig.serverTimestamp=0;//当前的系统时间戳 用get set 获取
GlobalConfig.activeDocId=0;//当前激活的文档ID
GlobalConfig.activeDocCurPage=1;//当前激活的文档的当前页
GlobalConfig.classAllParam={};//Sass直接返回的所有会议信息(最全)
GlobalConfig.classDetail={};//Sass直接返回的当前课堂基本信息
GlobalConfig.docListPrepare=[]; // 已经提前上传的文档,进入课堂后需要自动加载
GlobalConfig.recordList=[];//录制服务器地址集合
GlobalConfig.docList=[];//文档服务器地址集合
GlobalConfig.mcuList=[];//录制服务器地址集合
GlobalConfig.msList=[];//ms服务器地址集合
GlobalConfig.musicList=[];//music服务器地址集合
GlobalConfig.musicListPrepare=[];//提提前上传的music集合
GlobalConfig.rsList=[];
export default GlobalConfig;