李勇

1.增加一个切换视频录制状态的接口;2.对课堂录制的启动逻辑做现在处理,加入课堂之后已经开启录制之后不再继续发生

@@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter { @@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter {
63 super(); 63 super();
64 this.lastClassActiveTime=0;//最后一次课堂激活的时间戳 64 this.lastClassActiveTime=0;//最后一次课堂激活的时间戳
65 //sdk 信息 65 //sdk 信息
66 - GlobalConfig.sdkVersion = "v2.27.11.20171109"; 66 + GlobalConfig.sdkVersion = "v2.28.1.20171110";
67 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); 67 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion);
68 console.log("sdkVersion:" + GlobalConfig.sdkVersion); 68 console.log("sdkVersion:" + GlobalConfig.sdkVersion);
69 //设置 69 //设置
@@ -304,7 +304,7 @@ export default class MessageEntrance extends Emiter { @@ -304,7 +304,7 @@ export default class MessageEntrance extends Emiter {
304 this.setInvisibleMediaView = this._setInvisibleMediaView.bind(this);//设置监课身份的视图 304 this.setInvisibleMediaView = this._setInvisibleMediaView.bind(this);//设置监课身份的视图
305 305
306 this.setAppConfig = this._setAppConfig.bind(this); 306 this.setAppConfig = this._setAppConfig.bind(this);
307 - this.recordControl = this._mediaRecordControl.bind(this); 307 + this.recordControl = this._changeMediaRecordStatus.bind(this);//切换控制音视频的录制状态
308 308
309 this.changeRtcVideoConfig = this._changeRtcVideoConfig.bind(this);//设置webRtc视频视图的缩放 309 this.changeRtcVideoConfig = this._changeRtcVideoConfig.bind(this);//设置webRtc视频视图的缩放
310 310
@@ -2421,7 +2421,7 @@ export default class MessageEntrance extends Emiter { @@ -2421,7 +2421,7 @@ export default class MessageEntrance extends Emiter {
2421 //上传文档 2421 //上传文档
2422 _sendDocumentUpload(_param) { 2422 _sendDocumentUpload(_param) {
2423 if (!_mcu.connected) { 2423 if (!_mcu.connected) {
2424 - loger.warn(GlobalConfig.getCurrentStatus()); 2424 + console.warn("连接已经断开->上传文档");
2425 return; 2425 return;
2426 } 2426 }
2427 if (_doc_ape) { 2427 if (_doc_ape) {
@@ -2548,8 +2548,15 @@ export default class MessageEntrance extends Emiter { @@ -2548,8 +2548,15 @@ export default class MessageEntrance extends Emiter {
2548 2548
2549 //如果当前课堂内只有自己或者离开上次课堂的时间大于8分钟,需要停止服务端的视频录制,设备不是H5 2549 //如果当前课堂内只有自己或者离开上次课堂的时间大于8分钟,需要停止服务端的视频录制,设备不是H5
2550 if(GlobalConfig.rosterNumber<=1&&interval>=(6*60)&&GlobalConfig.deviceType!=3){ 2550 if(GlobalConfig.rosterNumber<=1&&interval>=(6*60)&&GlobalConfig.deviceType!=3){
2551 - loger.log("调用服务端音视频停止录制->interval:"+interval);  
2552 - this._mediaRecordControl({"status": WebRtcApe.RECORD_STATUS_2}); 2551 + setTimeout(()=>{
  2552 + //延迟3秒,检测一下当前是否有人在开着视频,如果有开启的就不能再停止了
  2553 + loger.log("当前开启音视频的人数->"+GlobalConfig.getPublishUser());
  2554 + if(GlobalConfig.getPublishUser()<1){
  2555 + loger.log("调用服务端音视频停止录制->interval:"+interval);
  2556 + this._mediaRecordControl({"status": WebRtcApe.RECORD_STATUS_2});
  2557 + }
  2558 + },3000);
  2559 +
2553 } 2560 }
2554 2561
2555 //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 2562 //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
@@ -3352,7 +3359,7 @@ export default class MessageEntrance extends Emiter { @@ -3352,7 +3359,7 @@ export default class MessageEntrance extends Emiter {
3352 break; 3359 break;
3353 case WebRtcApe.RECORD_STATUS_2: 3360 case WebRtcApe.RECORD_STATUS_2:
3354 //停止录制 3361 //停止录制
3355 - //_webRtc.stopRecordingMedia(); 3362 + loger.warn("调用停止音视频录制->");
3356 _webRtc.changePublishStatusAndServerRecord(WebRtcApe.RECORD_STATUS_2); 3363 _webRtc.changePublishStatusAndServerRecord(WebRtcApe.RECORD_STATUS_2);
3357 break; 3364 break;
3358 default : 3365 default :
@@ -3361,6 +3368,14 @@ export default class MessageEntrance extends Emiter { @@ -3361,6 +3368,14 @@ export default class MessageEntrance extends Emiter {
3361 } 3368 }
3362 } 3369 }
3363 3370
  3371 + /*
  3372 + * 切换音视频的录制状态 1开启 2停止
  3373 + * */
  3374 + _changeMediaRecordStatus(_param){
  3375 + if(_webRtc){
  3376 + _webRtc.changeMediaRecordStatus(_param);
  3377 + }
  3378 + }
3364 //webRtc-----------------end -------------------------------- 3379 //webRtc-----------------end --------------------------------
3365 //判断是否能推流,当前课堂推流人数是有限制的 3380 //判断是否能推流,当前课堂推流人数是有限制的
3366 _hasFreePublishChannel() { 3381 _hasFreePublishChannel() {
@@ -10,6 +10,7 @@ class GlobalConfig { @@ -10,6 +10,7 @@ class GlobalConfig {
10 constructor() { 10 constructor() {
11 11
12 } 12 }
  13 +
13 _currentStatus = null; 14 _currentStatus = null;
14 15
15 static getCurrentStatus() { 16 static getCurrentStatus() {
@@ -18,15 +19,19 @@ class GlobalConfig { @@ -18,15 +19,19 @@ class GlobalConfig {
18 } 19 }
19 return this._currentStatus; 20 return this._currentStatus;
20 } 21 }
  22 +
21 static setCurrentStatus(_data) { 23 static setCurrentStatus(_data) {
22 this._currentStatus = _data; 24 this._currentStatus = _data;
23 } 25 }
  26 +
24 static getClassDetail() { 27 static getClassDetail() {
25 return this.classDetail; 28 return this.classDetail;
26 } 29 }
  30 +
27 static setClassDetail(_data) { 31 static setClassDetail(_data) {
28 this.classDetail = _data; 32 this.classDetail = _data;
29 } 33 }
  34 +
30 static getClassInfo() { 35 static getClassInfo() {
31 let classInfo = {}; 36 let classInfo = {};
32 classInfo.siteId = this.siteId; 37 classInfo.siteId = this.siteId;
@@ -61,8 +66,8 @@ class GlobalConfig { @@ -61,8 +66,8 @@ class GlobalConfig {
61 classInfo.appId = this.appId; 66 classInfo.appId = this.appId;
62 classInfo.appCertificate = this.appCertificate; 67 classInfo.appCertificate = this.appCertificate;
63 classInfo.appRecordingKey = this.appRecordingKey; 68 classInfo.appRecordingKey = this.appRecordingKey;
64 - classInfo.channelId =this.channelId ;  
65 - classInfo.channelKey =this.channelKey ; 69 + classInfo.channelId = this.channelId;
  70 + classInfo.channelKey = this.channelKey;
66 classInfo.userUid = this.userUid; 71 classInfo.userUid = this.userUid;
67 return classInfo; 72 return classInfo;
68 73
@@ -70,41 +75,42 @@ class GlobalConfig { @@ -70,41 +75,42 @@ class GlobalConfig {
70 75
71 //获取当前的课堂状态的信息 76 //获取当前的课堂状态的信息
72 static get classStatusInfo() { 77 static get classStatusInfo() {
73 - let classStatusInfo = {};  
74 -  
75 - classStatusInfo.siteId = this.siteId; //站点号  
76 -  
77 - classStatusInfo.classId = this.classId;  
78 - classStatusInfo.className = this.className;  
79 - classStatusInfo.classType = this.classType; //课堂类型  
80 - classStatusInfo.classStatus = this.classStatus; //课堂的状态  
81 - classStatusInfo.classStartTime = this.classStartTime; //课堂点击开始时间  
82 - classStatusInfo.classStopTime = this.classStopTime; //最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳  
83 - classStatusInfo.classTimestamp = this.classTimestamp; //相对于点开始课堂的时间戳  
84 - classStatusInfo.recordPlaybackMaxTime = this.recordPlaybackMaxTime; //相对于点开始课堂的时间戳  
85 -  
86 - classStatusInfo.classBeginTime = this.classBeginTime; //课堂创建的时间,这个是Sass返回的  
87 - classStatusInfo.classEndTime = this.classEndTime; //课堂结束的时间,这个是Sass返回的  
88 -  
89 - classStatusInfo.isEnableDraw = this.isEnableDraw; //当前是否开启绘制权限  
90 - classStatusInfo.recordStatus = this.recordStatus; //当前录制状态  
91 - classStatusInfo.silence = this.silence; //当前课堂禁言状态  
92 - classStatusInfo.silenceUsers = this.silenceUsers; //当前课堂禁言状态  
93 - classStatusInfo.selfSilence = this.selfSilence; //当前自由禁言状态  
94 - classStatusInfo.recordTimestamp = this.recordTimestamp; //相对于首次开始录制的时间戳  
95 - classStatusInfo.recordFileName = this.recordFileName; //录制的文件名  
96 - classStatusInfo.recordDownloadUrl = this.recordDownloadUrl; //下载地址  
97 -  
98 - classStatusInfo.serverTimestamp = this.serverTimestamp; //当前的系统时间戳  
99 - classStatusInfo.activeDocId = this.activeDocId; //当前激活的文档ID  
100 - classStatusInfo.activeDocCurPage = this.activeDocCurPage; //当前激活的文档的当前页  
101 -  
102 - classStatusInfo.currentSceneTableId = this.currentSceneTableId; //文档区域的模块显示  
103 - classStatusInfo.serverAndLoacTimeDistanc = this.serverAndLoacTimeDistanc;  
104 - classStatusInfo.videoScale=this.videoScale;  
105 - return classStatusInfo;  
106 - }  
107 - //设置当前的课堂状态的信息 78 + let classStatusInfo = {};
  79 +
  80 + classStatusInfo.siteId = this.siteId; //站点号
  81 +
  82 + classStatusInfo.classId = this.classId;
  83 + classStatusInfo.className = this.className;
  84 + classStatusInfo.classType = this.classType; //课堂类型
  85 + classStatusInfo.classStatus = this.classStatus; //课堂的状态
  86 + classStatusInfo.classStartTime = this.classStartTime; //课堂点击开始时间
  87 + classStatusInfo.classStopTime = this.classStopTime; //最后一次停止的时间(点暂停或结束),每次发送数据都获取当前时间戳
  88 + classStatusInfo.classTimestamp = this.classTimestamp; //相对于点开始课堂的时间戳
  89 + classStatusInfo.recordPlaybackMaxTime = this.recordPlaybackMaxTime; //相对于点开始课堂的时间戳
  90 +
  91 + classStatusInfo.classBeginTime = this.classBeginTime; //课堂创建的时间,这个是Sass返回的
  92 + classStatusInfo.classEndTime = this.classEndTime; //课堂结束的时间,这个是Sass返回的
  93 +
  94 + classStatusInfo.isEnableDraw = this.isEnableDraw; //当前是否开启绘制权限
  95 + classStatusInfo.recordStatus = this.recordStatus; //当前录制状态
  96 + classStatusInfo.silence = this.silence; //当前课堂禁言状态
  97 + classStatusInfo.silenceUsers = this.silenceUsers; //当前课堂禁言状态
  98 + classStatusInfo.selfSilence = this.selfSilence; //当前自由禁言状态
  99 + classStatusInfo.recordTimestamp = this.recordTimestamp; //相对于首次开始录制的时间戳
  100 + classStatusInfo.recordFileName = this.recordFileName; //录制的文件名
  101 + classStatusInfo.recordDownloadUrl = this.recordDownloadUrl; //下载地址
  102 +
  103 + classStatusInfo.serverTimestamp = this.serverTimestamp; //当前的系统时间戳
  104 + classStatusInfo.activeDocId = this.activeDocId; //当前激活的文档ID
  105 + classStatusInfo.activeDocCurPage = this.activeDocCurPage; //当前激活的文档的当前页
  106 +
  107 + classStatusInfo.currentSceneTableId = this.currentSceneTableId; //文档区域的模块显示
  108 + classStatusInfo.serverAndLoacTimeDistanc = this.serverAndLoacTimeDistanc;
  109 + classStatusInfo.videoScale = this.videoScale;
  110 + return classStatusInfo;
  111 + }
  112 +
  113 + //设置当前的课堂状态的信息
108 static setClassStatusInfo(_data) { 114 static setClassStatusInfo(_data) {
109 //loger.log("setClassStatusInfo"); 115 //loger.log("setClassStatusInfo");
110 if (_data == null) { 116 if (_data == null) {
@@ -142,56 +148,77 @@ class GlobalConfig { @@ -142,56 +148,77 @@ class GlobalConfig {
142 148
143 149
144 //this.recordStatus = data.recordStatus || this.recordStatus; //当前录制状态 150 //this.recordStatus = data.recordStatus || this.recordStatus; //当前录制状态
145 - this.recordStatus = data.recordStatus ||false; //当前录制状态  
146 - this.recordTimestamp =Math.max(parseInt(data.recordTimestamp), this.recordTimestamp); //录制时间取最大值 151 + this.recordStatus = data.recordStatus || false; //当前录制状态
  152 + this.recordTimestamp = Math.max(parseInt(data.recordTimestamp), this.recordTimestamp); //录制时间取最大值
147 this.recordFileName = data.recordFileName || this.recordFileName; //录制的文件名 153 this.recordFileName = data.recordFileName || this.recordFileName; //录制的文件名
148 this.recordDownloadUrl = data.recordDownloadUrl || this.recordDownloadUrl; //下载地址 154 this.recordDownloadUrl = data.recordDownloadUrl || this.recordDownloadUrl; //下载地址
149 this.currentSceneTableId = data.currentSceneTableId || 0; //文档区域的模块显示 155 this.currentSceneTableId = data.currentSceneTableId || 0; //文档区域的模块显示
150 156
151 - this.isEnableDraw=data.isEnableDraw||false;//是否开启所有人的绘制权限  
152 - this.videoScale=parseInt(data.videoScale)||1; 157 + this.isEnableDraw = data.isEnableDraw || false;//是否开启所有人的绘制权限
  158 + this.videoScale = parseInt(data.videoScale) || 1;
153 // 全局禁言状态 159 // 全局禁言状态
154 this.silence = data.silence || false; 160 this.silence = data.silence || false;
155 - this.silenceUsers =data.silenceUsers || {};  
156 - if((typeof this.silenceUsers =='string')&& this.silenceUsers .constructor==String){  
157 - this.silenceUsers={}; 161 + this.silenceUsers = data.silenceUsers || {};
  162 + if ((typeof this.silenceUsers == 'string') && this.silenceUsers.constructor == String) {
  163 + this.silenceUsers = {};
158 } 164 }
159 } 165 }
  166 +
160 /* 167 /*
161 - * 根据nodeId获取用户的身份  
162 - * */  
163 - static getUserRoleFromeNodeId(_nodeId){  
164 - let user=this.rosters[_nodeId];  
165 - if(user){ 168 + * 根据nodeId获取用户的身份
  169 + * */
  170 + static getUserRoleFromeNodeId(_nodeId) {
  171 + let user = this.rosters[_nodeId];
  172 + if (user) {
166 return user.userRole; 173 return user.userRole;
167 - }else { 174 + } else {
168 return "normal" 175 return "normal"
169 } 176 }
170 } 177 }
  178 +
171 /* 179 /*
172 * 根据nodeId获取用户的信息 180 * 根据nodeId获取用户的信息
173 * */ 181 * */
174 - static getUserInfoFromeNodeId(_nodeId){ 182 + static getUserInfoFromeNodeId(_nodeId) {
175 return this.rosters[_nodeId]; 183 return this.rosters[_nodeId];
176 } 184 }
  185 +
177 //获取推流权限,需要检查当前是否可以继续推流 186 //获取推流权限,需要检查当前是否可以继续推流
178 - static getPublishPermission(){  
179 - if(!this.rosters){ 187 + static getPublishPermission() {
  188 + if (!this.rosters) {
180 return true; 189 return true;
181 } 190 }
182 - let openCounter=0;  
183 - for (let i in this.rosters){  
184 - let item=this.rosters[i];  
185 - if(item&&item.userRole!=ApeConsts.invisible&&(item.openCamera>0||item.openMicrophones>0)){ 191 + let openCounter = 0;
  192 + for (let i in this.rosters) {
  193 + let item = this.rosters[i];
  194 + if (item && item.userRole != ApeConsts.invisible && (item.openCamera > 0 || item.openMicrophones > 0)) {
186 openCounter++; 195 openCounter++;
187 //统计当前已经开启摄像头和麦克风的人数,如果当前开启的人数大于等于最大允许的数量就不允许其他人再打开 196 //统计当前已经开启摄像头和麦克风的人数,如果当前开启的人数大于等于最大允许的数量就不允许其他人再打开
188 - if(openCounter>=GlobalConfig.maxMediaChannels){ 197 + if (openCounter >= GlobalConfig.maxMediaChannels) {
189 return false; 198 return false;
190 } 199 }
191 } 200 }
192 } 201 }
193 return true; 202 return true;
194 } 203 }
  204 +
  205 + /*
  206 + * 获取当前推流的人数
  207 + * */
  208 + static getPublishUser() {
  209 + if (!this.rosters) {
  210 + return 0;
  211 + }
  212 + let openCounter = 0;
  213 + for (let i in this.rosters) {
  214 + let item = this.rosters[i];
  215 + if (item && item.userRole != ApeConsts.invisible && (item.openCamera > 0 || item.openMicrophones > 0)) {
  216 + openCounter++;
  217 + }
  218 + }
  219 + return openCounter;
  220 + }
  221 +
195 // 判断自己是否主持人角色 222 // 判断自己是否主持人角色
196 static get isHost() { 223 static get isHost() {
197 if (this.userRole == ApeConsts.host) { 224 if (this.userRole == ApeConsts.host) {
@@ -234,30 +261,34 @@ class GlobalConfig { @@ -234,30 +261,34 @@ class GlobalConfig {
234 261
235 //是否是老师或主讲人 262 //是否是老师或主讲人
236 static get isTeachOrAssistant() { 263 static get isTeachOrAssistant() {
237 - if (this.userRole == ApeConsts.host||  
238 - this.userRole==ApeConsts.assistant||  
239 - this.userRole==ApeConsts.presenter) { 264 + if (this.userRole == ApeConsts.host ||
  265 + this.userRole == ApeConsts.assistant ||
  266 + this.userRole == ApeConsts.presenter) {
240 return true; 267 return true;
241 } 268 }
242 return false; 269 return false;
243 } 270 }
244 271
245 static get serverTimestamp() { 272 static get serverTimestamp() {
246 - return EngineUtils.creatTimestamp();  
247 - }  
248 - //储存已经提前上传的文档列表 273 + return EngineUtils.creatTimestamp();
  274 + }
  275 +
  276 + //储存已经提前上传的文档列表
249 static setDocListPrepare(_data) { 277 static setDocListPrepare(_data) {
250 if (_data == null) return; 278 if (_data == null) return;
251 this.docListPrepare = _data; 279 this.docListPrepare = _data;
252 } 280 }
  281 +
253 static getDocListPrepare() { 282 static getDocListPrepare() {
254 - return this.docListPrepare;  
255 - }  
256 - //储存已经提前上传的媒体共享文件列表 283 + return this.docListPrepare;
  284 + }
  285 +
  286 + //储存已经提前上传的媒体共享文件列表
257 static setMediaShareList(_data) { 287 static setMediaShareList(_data) {
258 if (_data == null) return; 288 if (_data == null) return;
259 this.sharedMediaList = _data; 289 this.sharedMediaList = _data;
260 } 290 }
  291 +
261 static getMediaShareList() { 292 static getMediaShareList() {
262 return this.sharedMediaList; 293 return this.sharedMediaList;
263 } 294 }
@@ -267,6 +298,7 @@ class GlobalConfig { @@ -267,6 +298,7 @@ class GlobalConfig {
267 if (_data == null) return; 298 if (_data == null) return;
268 this.sharedMusicList = _data; 299 this.sharedMusicList = _data;
269 } 300 }
  301 +
270 static getMusicShareList() { 302 static getMusicShareList() {
271 return this.sharedMusicList; 303 return this.sharedMusicList;
272 } 304 }
@@ -276,6 +308,7 @@ class GlobalConfig { @@ -276,6 +308,7 @@ class GlobalConfig {
276 if (_data == null) return; 308 if (_data == null) return;
277 this.recordList = _data; 309 this.recordList = _data;
278 } 310 }
  311 +
279 static getRecordList() { 312 static getRecordList() {
280 return this.recordList; 313 return this.recordList;
281 } 314 }
@@ -285,14 +318,17 @@ class GlobalConfig { @@ -285,14 +318,17 @@ class GlobalConfig {
285 if (_data == null) return; 318 if (_data == null) return;
286 this.docList = _data; 319 this.docList = _data;
287 } 320 }
  321 +
288 static getDocList() { 322 static getDocList() {
289 - return this.docList;  
290 - }  
291 - //ms列表 323 + return this.docList;
  324 + }
  325 +
  326 + //ms列表
292 static setMsList(_data) { 327 static setMsList(_data) {
293 if (_data == null) return; 328 if (_data == null) return;
294 this.msList = _data; 329 this.msList = _data;
295 } 330 }
  331 +
296 static getMsList() { 332 static getMsList() {
297 return this.msList; 333 return this.msList;
298 } 334 }
@@ -302,6 +338,7 @@ class GlobalConfig { @@ -302,6 +338,7 @@ class GlobalConfig {
302 if (_data == null) return; 338 if (_data == null) return;
303 this.rtmpPullList = _data; 339 this.rtmpPullList = _data;
304 } 340 }
  341 +
305 static getRtmpPullList() { 342 static getRtmpPullList() {
306 return this.rtmpPullList; 343 return this.rtmpPullList;
307 } 344 }
@@ -311,6 +348,7 @@ class GlobalConfig { @@ -311,6 +348,7 @@ class GlobalConfig {
311 if (_data == null) return; 348 if (_data == null) return;
312 this.hlsPullList = _data; 349 this.hlsPullList = _data;
313 } 350 }
  351 +
314 static getHlsPullList() { 352 static getHlsPullList() {
315 return this.hlsPullList; 353 return this.hlsPullList;
316 } 354 }
@@ -320,6 +358,7 @@ class GlobalConfig { @@ -320,6 +358,7 @@ class GlobalConfig {
320 if (_data == null) return; 358 if (_data == null) return;
321 this.rsList = _data; 359 this.rsList = _data;
322 } 360 }
  361 +
323 static getRsList() { 362 static getRsList() {
324 return this.rsList; 363 return this.rsList;
325 } 364 }
@@ -329,6 +368,7 @@ class GlobalConfig { @@ -329,6 +368,7 @@ class GlobalConfig {
329 if (_data == null) return; 368 if (_data == null) return;
330 this.mcuList = _data; 369 this.mcuList = _data;
331 } 370 }
  371 +
332 static getMcuList() { 372 static getMcuList() {
333 return this.mcuList; 373 return this.mcuList;
334 } 374 }
@@ -338,20 +378,22 @@ class GlobalConfig { @@ -338,20 +378,22 @@ class GlobalConfig {
338 if (_data == null) return; 378 if (_data == null) return;
339 this.musicList = _data; 379 this.musicList = _data;
340 } 380 }
  381 +
341 static getMusicList() { 382 static getMusicList() {
342 - return this.musicList;  
343 - }  
344 - //已经上传的声音列表 383 + return this.musicList;
  384 + }
  385 +
  386 + //已经上传的声音列表
345 static setMusicListPrepare(_data) { 387 static setMusicListPrepare(_data) {
346 if (_data == null) return; 388 if (_data == null) return;
347 this.musicListPrepare = _data; 389 this.musicListPrepare = _data;
348 } 390 }
  391 +
349 static getMusicListPrepare() { 392 static getMusicListPrepare() {
350 return this.musicListPrepare; 393 return this.musicListPrepare;
351 } 394 }
352 395
353 396
354 -  
355 //CDN加速的 拉流地址 rtmp 和hls(m3u8) 397 //CDN加速的 拉流地址 rtmp 和hls(m3u8)
356 static setVideoCDNAddr(_data) { 398 static setVideoCDNAddr(_data) {
357 if (_data == null) return; 399 if (_data == null) return;
@@ -364,33 +406,34 @@ class GlobalConfig { @@ -364,33 +406,34 @@ class GlobalConfig {
364 } 406 }
365 407
366 //把IP中的端口换成指定端口 408 //把IP中的端口换成指定端口
367 - static replacePort(_ipport,_curPort,_newPort){  
368 - loger.warn("替换端口->",_ipport,_curPort,_newPort);  
369 - if(!_ipport||!_curPort){ 409 + static replacePort(_ipport, _curPort, _newPort) {
  410 + loger.warn("替换端口->", _ipport, _curPort, _newPort);
  411 + if (!_ipport || !_curPort) {
370 //数据不正确,直接返回原数据 412 //数据不正确,直接返回原数据
371 return _ipport; 413 return _ipport;
372 } 414 }
373 try { 415 try {
374 //判断要替换的端口是否在最后的位置,否则是不能替换的,比如替换":80"端口,如果地址是"xxx.xxx.xxx:8080" 不判断的话就会出错 416 //判断要替换的端口是否在最后的位置,否则是不能替换的,比如替换":80"端口,如果地址是"xxx.xxx.xxx:8080" 不判断的话就会出错
375 - let lastIndex=_ipport.lastIndexOf(_curPort);  
376 - if((_ipport.length-_curPort.length)==lastIndex){  
377 - let ipportNew=_ipport.replace(_curPort,_newPort); 417 + let lastIndex = _ipport.lastIndexOf(_curPort);
  418 + if ((_ipport.length - _curPort.length) == lastIndex) {
  419 + let ipportNew = _ipport.replace(_curPort, _newPort);
378 return ipportNew 420 return ipportNew
379 } 421 }
380 return _ipport; 422 return _ipport;
381 - }catch (err){ 423 + } catch (err) {
382 return _ipport; 424 return _ipport;
383 } 425 }
384 426
385 } 427 }
  428 +
386 //通过IP查找IP对象 429 //通过IP查找IP对象
387 - static getIpItem(ip,ipList){  
388 - if(!ip||!ipList) { 430 + static getIpItem(ip, ipList) {
  431 + if (!ip || !ipList) {
389 return null; 432 return null;
390 } 433 }
391 - for(let i=0;i<ipList.length;i++){  
392 - let item=ipList[i];  
393 - if(item&&item.ip==ip){ 434 + for (let i = 0; i < ipList.length; i++) {
  435 + let item = ipList[i];
  436 + if (item && item.ip == ip) {
394 return item; 437 return item;
395 } 438 }
396 } 439 }
@@ -398,11 +441,11 @@ class GlobalConfig { @@ -398,11 +441,11 @@ class GlobalConfig {
398 } 441 }
399 } 442 }
400 443
401 -GlobalConfig.statusCode_0 = { "code": 0, message: "SDK 未初始化" };  
402 -GlobalConfig.statusCode_1 = { "code": 1, message: "未加入课堂" };  
403 -GlobalConfig.statusCode_2 = { "code": 2, message: "已经加入课堂" };  
404 -GlobalConfig.statusCode_3 = { "code": 3, message: "已经离开课堂" };  
405 -GlobalConfig.statusCode_4 = { "code": 4, message: "未知状态" }; 444 +GlobalConfig.statusCode_0 = {"code": 0, message: "SDK 未初始化"};
  445 +GlobalConfig.statusCode_1 = {"code": 1, message: "未加入课堂"};
  446 +GlobalConfig.statusCode_2 = {"code": 2, message: "已经加入课堂"};
  447 +GlobalConfig.statusCode_3 = {"code": 3, message: "已经离开课堂"};
  448 +GlobalConfig.statusCode_4 = {"code": 4, message: "未知状态"};
406 449
407 GlobalConfig.screenWidth = 1024; 450 GlobalConfig.screenWidth = 1024;
408 GlobalConfig.screenHeight = 768; 451 GlobalConfig.screenHeight = 768;
@@ -412,7 +455,7 @@ GlobalConfig.msType = 1; //逶ョ蜑榊崋螳夂畑霑吩クェ @@ -412,7 +455,7 @@ GlobalConfig.msType = 1; //逶ョ蜑榊崋螳夂畑霑吩クェ
412 GlobalConfig.messageDelay = false; //是否启用消息延迟 455 GlobalConfig.messageDelay = false; //是否启用消息延迟
413 GlobalConfig.mcuDelay = 0; //默认的延迟时间(单位-秒) 456 GlobalConfig.mcuDelay = 0; //默认的延迟时间(单位-秒)
414 457
415 -GlobalConfig.classExit=false;//是否关闭课堂,如果关闭之后不再连接MCU 458 +GlobalConfig.classExit = false;//是否关闭课堂,如果关闭之后不再连接MCU
416 459
417 GlobalConfig.docDelay = 1600; //文档模块加入成功之后延迟发送送成功的消息给主模块(sdk内部使用) 460 GlobalConfig.docDelay = 1600; //文档模块加入成功之后延迟发送送成功的消息给主模块(sdk内部使用)
418 GlobalConfig.portal = ""; //Sass IP 461 GlobalConfig.portal = ""; //Sass IP
@@ -464,7 +507,6 @@ GlobalConfig.hlsPullListFinal = []; //譛扈磯画叫逧ЗLS諡画オ∝慍蝮髮粋 @@ -464,7 +507,6 @@ GlobalConfig.hlsPullListFinal = []; //譛扈磯画叫逧ЗLS諡画オ∝慍蝮髮粋
464 GlobalConfig.rsPullListFinal = []; //最终选择的录制回放HLS拉流地址集合 507 GlobalConfig.rsPullListFinal = []; //最终选择的录制回放HLS拉流地址集合
465 508
466 509
467 -  
468 //连接MCU的IP+端口 510 //连接MCU的IP+端口
469 GlobalConfig.MCUServerIP = ""; 511 GlobalConfig.MCUServerIP = "";
470 GlobalConfig.MCUServerPort = ''; 512 GlobalConfig.MCUServerPort = '';
@@ -499,7 +541,7 @@ GlobalConfig.maxMediaChannels = 0; //譛螟ァ髻ウ隗「題キッ謨ー御サ・髻ウ隗「題キッ謨ー @@ -499,7 +541,7 @@ GlobalConfig.maxMediaChannels = 0; //譛螟ァ髻ウ隗「題キッ謨ー御サ・髻ウ隗「題キッ謨ー
499 GlobalConfig.hasCamera = false; //摄像头是否可用 541 GlobalConfig.hasCamera = false; //摄像头是否可用
500 GlobalConfig.hasMicrophone = false; //麦克风是否可用 542 GlobalConfig.hasMicrophone = false; //麦克风是否可用
501 543
502 -GlobalConfig.returnCitySN=null;//获取的ip数据 {"cip":"60.253.214.122","cid":"110000","cname":"北京市"} 544 +GlobalConfig.returnCitySN = null;//获取的ip数据 {"cip":"60.253.214.122","cid":"110000","cname":"北京市"}
503 GlobalConfig.deviceType = 0; //设备类型 0:电脑 1:ios 2:安卓 545 GlobalConfig.deviceType = 0; //设备类型 0:电脑 1:ios 2:安卓
504 GlobalConfig.userIp = ""; //用户当前IP 546 GlobalConfig.userIp = ""; //用户当前IP
505 GlobalConfig.userId = 0; 547 GlobalConfig.userId = 0;
@@ -508,7 +550,7 @@ GlobalConfig.handUpTime = 0; @@ -508,7 +550,7 @@ GlobalConfig.handUpTime = 0;
508 GlobalConfig.level = 0; 550 GlobalConfig.level = 0;
509 GlobalConfig.openCamera = 0; 551 GlobalConfig.openCamera = 0;
510 GlobalConfig.openMicrophones = 0; 552 GlobalConfig.openMicrophones = 0;
511 -GlobalConfig.selfDisEnableDrawTime=1;//记录是否禁用画笔,0为启用画笔,大于0时被禁用的时间戳 553 +GlobalConfig.selfDisEnableDrawTime = 1;//记录是否禁用画笔,0为启用画笔,大于0时被禁用的时间戳
512 554
513 //视频质量相关设置 555 //视频质量相关设置
514 GlobalConfig.fps = 15; //帧频 556 GlobalConfig.fps = 15; //帧频
@@ -526,7 +568,7 @@ GlobalConfig.autoGain = false; //閾ェ蜉ィ隹鰍鮗ヲ蜈矩」朱浹驥 @@ -526,7 +568,7 @@ GlobalConfig.autoGain = false; //閾ェ蜉ィ隹鰍鮗ヲ蜈矩」朱浹驥
526 GlobalConfig.speakerVolume = 80; //扬声器音量(0-80) 568 GlobalConfig.speakerVolume = 80; //扬声器音量(0-80)
527 GlobalConfig.micCode = 0; //麦克风模式 569 GlobalConfig.micCode = 0; //麦克风模式
528 570
529 -GlobalConfig.optionJsonData="";//音视频模块推流时的可选参数,这个由外部传入 571 +GlobalConfig.optionJsonData = "";//音视频模块推流时的可选参数,这个由外部传入
530 GlobalConfig.audioRecords = []; 572 GlobalConfig.audioRecords = [];
531 GlobalConfig.videoRecords = []; 573 GlobalConfig.videoRecords = [];
532 GlobalConfig.status = 0 574 GlobalConfig.status = 0
@@ -570,7 +612,7 @@ GlobalConfig.updateRecordTimeDelay = 5; //(遘)悟酔豁・荳谺。隸セ蝣ょス募宛迥カ諤 @@ -570,7 +612,7 @@ GlobalConfig.updateRecordTimeDelay = 5; //(遘)悟酔豁・荳谺。隸セ蝣ょス募宛迥カ諤
570 GlobalConfig.updateClassInfoDelay = 10; //(秒),同步一次课堂状态的并保存到Sass 612 GlobalConfig.updateClassInfoDelay = 10; //(秒),同步一次课堂状态的并保存到Sass
571 GlobalConfig.msDynamicChooseIpDelay = 60 * 3; //(秒)MS动态选点的间隔 613 GlobalConfig.msDynamicChooseIpDelay = 60 * 3; //(秒)MS动态选点的间隔
572 //GlobalConfig.serverTimestamp=0;//当前的系统时间戳 用get set 获取 614 //GlobalConfig.serverTimestamp=0;//当前的系统时间戳 用get set 获取
573 -GlobalConfig.whiteboardId=2359297;//白板文档的ID 615 +GlobalConfig.whiteboardId = 2359297;//白板文档的ID
574 GlobalConfig.activeDocId = 0; //当前激活的文档ID 616 GlobalConfig.activeDocId = 0; //当前激活的文档ID
575 GlobalConfig.activeDocCurPage = 1; //当前激活的文档的当前页 617 GlobalConfig.activeDocCurPage = 1; //当前激活的文档的当前页
576 618
@@ -583,9 +625,8 @@ GlobalConfig.classAllParam = {}; //Sass逶エ謗・霑泌屓逧園譛芽ッセ蝣ゆソ。諱ッ(譛蜈ィ) @@ -583,9 +625,8 @@ GlobalConfig.classAllParam = {}; //Sass逶エ謗・霑泌屓逧園譛芽ッセ蝣ゆソ。諱ッ(譛蜈ィ)
583 GlobalConfig.classDetail = {}; //Sass直接返回的当前课堂基本信息 625 GlobalConfig.classDetail = {}; //Sass直接返回的当前课堂基本信息
584 626
585 627
586 -  
587 GlobalConfig.isRecordPlayBack = false; //是否是录制回放,默认是否 628 GlobalConfig.isRecordPlayBack = false; //是否是录制回放,默认是否
588 -GlobalConfig.allowRecordMaxTime = 48*60*60; //(秒)允许录制的最长时间 629 +GlobalConfig.allowRecordMaxTime = 48 * 60 * 60; //(秒)允许录制的最长时间
589 630
590 GlobalConfig.siteId_letv = 'shchuanbao'; //乐视,MS不需要动态选点的站点 631 GlobalConfig.siteId_letv = 'shchuanbao'; //乐视,MS不需要动态选点的站点
591 GlobalConfig.ssTunnelAppURL = ''; //屏幕共享插件的地址 632 GlobalConfig.ssTunnelAppURL = ''; //屏幕共享插件的地址
@@ -593,36 +634,36 @@ GlobalConfig.serverTime = 0; //譛榊苅蝎ィ蠖灘燕譌カ髣エ謌ウ @@ -593,36 +634,36 @@ GlobalConfig.serverTime = 0; //譛榊苅蝎ィ蠖灘燕譌カ髣エ謌ウ
593 GlobalConfig.serverAndLoacTimeDistanc = 0; //本地时间和服务器时间错的差值; 634 GlobalConfig.serverAndLoacTimeDistanc = 0; //本地时间和服务器时间错的差值;
594 GlobalConfig.logUrl = ""; //日志上报地址; 635 GlobalConfig.logUrl = ""; //日志上报地址;
595 636
596 -GlobalConfig.rosterNumber=0;//当前总人数  
597 -GlobalConfig.rosters={};//当前课堂内的人员数据 637 +GlobalConfig.rosterNumber = 0;//当前总人数
  638 +GlobalConfig.rosters = {};//当前课堂内的人员数据
598 639
599 GlobalConfig.isMobile = false; //是否是移动端 640 GlobalConfig.isMobile = false; //是否是移动端
600 -GlobalConfig.language="";//浏览器语言  
601 -GlobalConfig.platform="pc";//平台 IOS/ANDROID/PC  
602 -GlobalConfig.explorer="未知";//浏览器  
603 -GlobalConfig.explorerVersion="未知";//浏览器版本  
604 -GlobalConfig.os="未知";//系统 641 +GlobalConfig.language = "";//浏览器语言
  642 +GlobalConfig.platform = "pc";//平台 IOS/ANDROID/PC
  643 +GlobalConfig.explorer = "未知";//浏览器
  644 +GlobalConfig.explorerVersion = "未知";//浏览器版本
  645 +GlobalConfig.os = "未知";//系统
605 646
606 -GlobalConfig.locationProtocol="http://";//https;或http:  
607 -GlobalConfig.websocketProtocol="ws://";//wss或ws  
608 -GlobalConfig.isHttps=false;//是否是https 647 +GlobalConfig.locationProtocol = "http://";//https;或http:
  648 +GlobalConfig.websocketProtocol = "ws://";//wss或ws
  649 +GlobalConfig.isHttps = false;//是否是https
609 650
610 -GlobalConfig.openFlash=false;//使用flash通话模式。默认为false,使用的是webRtc 651 +GlobalConfig.openFlash = false;//使用flash通话模式。默认为false,使用的是webRtc
611 //webRtc 652 //webRtc
612 GlobalConfig.appId = ''; 653 GlobalConfig.appId = '';
613 GlobalConfig.appCertificate = ""; 654 GlobalConfig.appCertificate = "";
614 GlobalConfig.appRecordingKey = ""; 655 GlobalConfig.appRecordingKey = "";
615 GlobalConfig.channelId = ""; 656 GlobalConfig.channelId = "";
616 -GlobalConfig.channelKey =""; 657 +GlobalConfig.channelKey = "";
617 GlobalConfig.userUid = 0; 658 GlobalConfig.userUid = 0;
618 -GlobalConfig.recordInterfaces="";//控制开启录制和录制状态改变的接口  
619 -GlobalConfig.getRecordInfoInterfaces="";//获取媒体录制信息数据的接口  
620 -GlobalConfig.stopRecordingInterfaces="";//停止录制的接口  
621 -GlobalConfig.getTxRecordInfoInterfaces="";//获取媒体录制信息数据的接口(tx)  
622 -GlobalConfig.getRecordFileURLAgoInterfaces="";//获取媒体录制信息数据的接口(ago)  
623 -GlobalConfig.getChannelToken="";//获取token的地址  
624 -GlobalConfig.recordFileSever="";//录制文件路径和文件地址(ago)  
625 -GlobalConfig.videoScale=1;//视频的缩放倍数,默认1倍无缩放 659 +GlobalConfig.recordInterfaces = "";//控制开启录制和录制状态改变的接口
  660 +GlobalConfig.getRecordInfoInterfaces = "";//获取媒体录制信息数据的接口
  661 +GlobalConfig.stopRecordingInterfaces = "";//停止录制的接口
  662 +GlobalConfig.getTxRecordInfoInterfaces = "";//获取媒体录制信息数据的接口(tx)
  663 +GlobalConfig.getRecordFileURLAgoInterfaces = "";//获取媒体录制信息数据的接口(ago)
  664 +GlobalConfig.getChannelToken = "";//获取token的地址
  665 +GlobalConfig.recordFileSever = "";//录制文件路径和文件地址(ago)
  666 +GlobalConfig.videoScale = 1;//视频的缩放倍数,默认1倍无缩放
626 667
627 export default GlobalConfig; 668 export default GlobalConfig;
628 669
@@ -245,7 +245,7 @@ class ConferApe extends Ape { @@ -245,7 +245,7 @@ class ConferApe extends Ape {
245 optional string filename = 4; // 录像文件名称,filename中增加目录部分 245 optional string filename = 4; // 录像文件名称,filename中增加目录部分
246 }*/ 246 }*/
247 247
248 - if(this.recordStatus==conferRecordSendPdu.record){ 248 + if(this.recordStatus==true){
249 //已经有录制文件,不再发送 249 //已经有录制文件,不再发送
250 return; 250 return;
251 } 251 }
@@ -533,7 +533,6 @@ class ConferApe extends Ape { @@ -533,7 +533,6 @@ class ConferApe extends Ape {
533 }); 533 });
534 } else { 534 } else {
535 loger.warn("踢人失败-参数无效") 535 loger.warn("踢人失败-参数无效")
536 - console.log(_param);  
537 } 536 }
538 } 537 }
539 538
@@ -862,15 +862,18 @@ class WebRtcApe extends Emiter { @@ -862,15 +862,18 @@ class WebRtcApe extends Emiter {
862 }); 862 });
863 } 863 }
864 864
865 - //调用媒体服务停止录制  
866 - stopRecordingMedia() {  
867 - //192.168.31.8:3000/recordInfo/stopRecording/  
868 - if (!GlobalConfig.stopRecordingInterfaces) {  
869 - loger.log("调用服务器端开启录制->失败->接口地址无效"); 865 + /*
  866 + * 切换音视频的录制状态
  867 + * */
  868 + changeMediaRecordStatus(_params) {
  869 + if (!GlobalConfig.recordInterfaces||!_params) {
  870 + loger.warn("切换音视频的录制状态->失败->接口地址无效",_params);
870 return; 871 return;
871 } 872 }
872 - let url = GlobalConfig.locationProtocol + GlobalConfig.stopRecordingInterfaces;  
873 - let data = this.packMediaInfoData(WebRtcApe.RECORD_STATUS_2); 873 + loger.warn("切换音视频的录制状态->"+_params);
  874 + let url = GlobalConfig.locationProtocol + GlobalConfig.recordInterfaces;
  875 + let curTimestamp = new Date().getTime();
  876 + let data = `appId=${GlobalConfig.appId}&channel=${GlobalConfig.channelId}&channelKey=${GlobalConfig.appCertificate}&uid=${GlobalConfig.userUid}&status=${_params.status}&userId=${GlobalConfig.userId}&userName=${GlobalConfig.userName}&userRole=${GlobalConfig.userRole}&timestamp=${curTimestamp}&recordTimestamp=${GlobalConfig.recordTimestamp}`;
874 fetch(encodeURI(url), { 877 fetch(encodeURI(url), {
875 method: 'POST', 878 method: 'POST',
876 headers: { 879 headers: {
@@ -883,19 +886,19 @@ class WebRtcApe extends Emiter { @@ -883,19 +886,19 @@ class WebRtcApe extends Emiter {
883 if (ret.ok) { 886 if (ret.ok) {
884 return ret.json(); 887 return ret.json();
885 } else { 888 } else {
886 - loger.error(`调用服务器端开启录制-网络异常.状态码:${ret.status}`); 889 + loger.error(`切换音视频的录制状态-网络异常.状态码:${ret.status}`);
887 throw ''; 890 throw '';
888 } 891 }
889 }) 892 })
890 .then(ret => { 893 .then(ret => {
891 if (ret) { 894 if (ret) {
892 - loger.log('调用服务器端开启录制完成', ret); 895 + loger.log('切换音视频的录制状态->完成', ret);
893 } else { 896 } else {
894 - loger.warn('调用服务器端开启录制 失败.', ret); 897 + loger.warn('切换音视频的录制状态 失败.', ret);
895 } 898 }
896 }) 899 })
897 .catch(err => { 900 .catch(err => {
898 - loger.error(`调用服务器端开启录制.状态码:${err}`); 901 + loger.error(`切换音视频的录制状态.状态码:${err}`);
899 }); 902 });
900 } 903 }
901 } 904 }