AlexWang

合并dev

此 diff 太大无法显示。
@@ -33,7 +33,7 @@ import QuestionApe from 'apes/QuestionApe'; @@ -33,7 +33,7 @@ import QuestionApe from 'apes/QuestionApe';
33 import UTF8 from 'utf-8'; 33 import UTF8 from 'utf-8';
34 34
35 let loger = Loger.getLoger('McuClient'); 35 let loger = Loger.getLoger('McuClient');
36 -let _sdkInfo = { "version": "v1.36.1.20170619", "author": "www.3mang.com" }; 36 +let _sdkInfo = { "version": "v1.36.8.20170620", "author": "www.3mang.com" };
37 37
38 //APE 38 //APE
39 let _sass; 39 let _sass;
@@ -1233,651 +1233,820 @@ export default class MessageEntrance extends Emiter { @@ -1233,651 +1233,820 @@ export default class MessageEntrance extends Emiter {
1233 } 1233 }
1234 } 1234 }
1235 1235
  1236 + << << << < HEAD
1236 //ChatApe 1237 //ChatApe
1237 // 发送聊天消息 1238 // 发送聊天消息
1238 _sendChatMsg(_messageInfo) { 1239 _sendChatMsg(_messageInfo) {
1239 if (!_mcu.connected) { 1240 if (!_mcu.connected) {
1240 loger.warn(GlobalConfig.getCurrentStatus()); 1241 loger.warn(GlobalConfig.getCurrentStatus());
1241 - return { "code": ApeConsts.RETURN_FAILED, "data": "" };  
1242 - }  
1243 - if (_messageInfo === null || EngineUtils.isEmptyObject(_messageInfo)) {  
1244 - loger.log('发送聊天消息失败->参数错误', _messageInfo);  
1245 - return { "code": ApeConsts.RETURN_FAILED, "data": "" };  
1246 - }  
1247 - if (_chat_ape) {  
1248 - _chat_ape.sendChatMsg(_messageInfo);  
1249 - }  
1250 - }  
1251 -  
1252 - //监听摄像头麦克风状态  
1253 - userDeviecStatusChange(_data) {  
1254 - /* nodeId:GlobalConfig.nodeId,  
1255 - userRole:GlobalConfig.userRole,  
1256 - userName:GlobalConfig.userName,  
1257 - userId:GlobalConfig.userId,  
1258 - openCamera:GlobalConfig.openCamera,  
1259 - openMicrophones:GlobalConfig.openMicrophones*/  
1260 - if (_confer_ape) {  
1261 - _confer_ape.updaterUserDeviecStatusChange(_data);  
1262 - }  
1263 - } 1242 + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; === === =
  1243 + //获取课堂所有参数 api/meeting/detail.do? flash中的接口文件是 getClassParam.do
  1244 + _sassGetClassParamSuccessHandler(_data) {
  1245 + loger.log('获取课堂课堂信息完成.');
  1246 + //包含整个课堂最全的信息,储存数据
  1247 + if (_data) {
  1248 + GlobalConfig.mcuDelay = _data.h5Delay || 0; //mcu消息延迟的时间间隔,单位(秒),结合客户端传的messageDelay的值使用
  1249 + GlobalConfig.className = _data.meetingName || "";
  1250 + GlobalConfig.classBeginTime = _data.beginTime || "";
  1251 + GlobalConfig.classEndTime = _data.endTime || "";
  1252 + GlobalConfig.userIp = _data.userIp || "";
  1253 +
  1254 + GlobalConfig.maxVideoChannels = _data.maxVideoChannels;
  1255 + GlobalConfig.maxAudioChannels = _data.maxAudioChannels;
  1256 + GlobalConfig.maxMediaChannels = Math.max(GlobalConfig.maxVideoChannels, GlobalConfig.maxAudioChannels);
  1257 +
  1258 + GlobalConfig.ssTunnelAppURL = _data.ssTunnelAppURL || ''; //屏幕共享插件的地址
  1259 +
  1260 + //视频质量相关设置,每次加入课堂都按最新的获取设置
  1261 + GlobalConfig.fps = _data.fps || 15;
  1262 + GlobalConfig.gop = _data.gop || 3;
  1263 + GlobalConfig.videoQuality = parseInt(_data.videoQuality);
  1264 + GlobalConfig.curVideoQuality = GlobalConfig.videoQuality;
  1265 +
  1266 + //是否自动开始(身份是host的时候才用到的)
  1267 + GlobalConfig.isAutoStartClass = _data.autoRecord || 0;
  1268 +
  1269 + GlobalConfig.serverTime = _data.serverTime || new Date().getTime(); //获取服务器时间戳
  1270 + GlobalConfig.serverAndLoacTimeDistanc = (new Date().getTime() - GlobalConfig.serverTime) / 1000; //当前系统时间和服务器时间的差值 (秒)
  1271 + loger.warn("服务器时间:" + GlobalConfig.serverTime + " 系统时间:" + new Date().getTime() + " 时间差:" + GlobalConfig.serverAndLoacTimeDistanc);
  1272 +
  1273 + GlobalConfig.setDocListPrepare(_data.docListPrepare); //提前上传的文档列表
  1274 + GlobalConfig.setRecordList(_data.recordList); //录制回放地址
  1275 + GlobalConfig.setDocList(_data.docList); //文档地址
  1276 + GlobalConfig.setMsList(_data.msList); //推流播流服务器地址(需要对列表中的地址进行分类,里面包含了推流和拉流的地址,目前主要是乐视的需要区分开)
  1277 + GlobalConfig.setRsList(_data.rsList); //播放m3u8格式的地址(录制回放时使用)
  1278 + GlobalConfig.setMcuList(_data.mcuList); //mcu
  1279 + GlobalConfig.setMusicList(_data.musicList); //
  1280 + GlobalConfig.setMusicListPrepare(_data.musicListPrepare); //提前上传的声音文件列表
  1281 + GlobalConfig.setVideoCDNAddr(_data.videoCDNAddr); //cdn加速的拉流地址,直播的时候才使用
  1282 + GlobalConfig.setMediaShareList(_data.sharedMediaList); //提前上传的媒体共享文件列表
  1283 +
  1284 + //MCU地址
  1285 + if (_data.mcuList && _data.mcuList.length > 0) {
  1286 + //随机选择一个
  1287 + let index = parseInt(Math.random() * _data.mcuList.length);
  1288 + GlobalConfig.MCUServerIP = _data.mcuList[index].ip || "";
  1289 + GlobalConfig.MCUServerPort = _data.mcuList[index].port || "";
  1290 + loger.log('初始->MCU->.', GlobalConfig.MCUServerIP, GlobalConfig.MCUServerPort);
  1291 + }
1264 1292
1265 - //屏幕共享  
1266 - //开始屏幕共享  
1267 - _publishScreenShare(_param) {  
1268 - if (_video_ape) {  
1269 - _video_ape.publishScreenShare(_param);  
1270 - }  
1271 - }  
1272 - //停止屏幕共享  
1273 - _stopPublishScreenShare(_param) {  
1274 - if (_video_ape) {  
1275 - _video_ape.stopPublishScreenShare(_param);  
1276 - }  
1277 - }  
1278 - //VidoeApe  
1279 - videoUpdate(_data) {  
1280 - //视频同步的消息发送改变,需要通知ferApe模块中的用户更新状态  
1281 - if (_confer_ape) {  
1282 - _confer_ape.updaterRosterStatus(_data);  
1283 - }  
1284 - } 1293 + //录制回放时m3u8播流地址
  1294 + if (_data.rsList && _data.rsList.length > 0) {
  1295 + let index = parseInt(Math.random() * _data.rsList.length);
  1296 + GlobalConfig.RS_RECORD_PLAY_IP = _data.rsList[index].ip || "";
  1297 + GlobalConfig.RS_RECORD_PLAY_PORT = _data.rsList[index].port || "";
  1298 + loger.log('初始->RS->.', GlobalConfig.RS_RECORD_PLAY_IP, GlobalConfig.RS_RECORD_PLAY_PORT);
  1299 + }
1285 1300
1286 - _sendVideoBroadcastMsg(_param) {  
1287 - if (!_mcu.connected) {  
1288 - loger.warn(GlobalConfig.getCurrentStatus());  
1289 - return { "code": ApeConsts.RETURN_FAILED, "data": "" };  
1290 - }  
1291 - if (_video_ape) {  
1292 - return _video_ape.sendVideoBroadcastMsg(_param);  
1293 - }  
1294 - } 1301 + //上课中音视频推流地址
  1302 + if (GlobalConfig.msList && GlobalConfig.msList.length > 0) {
  1303 + let index = parseInt(Math.random() * GlobalConfig.msList.length);
  1304 + GlobalConfig.MS_PUBLISH_IP = GlobalConfig.msList[index].ip || "";
  1305 + GlobalConfig.MS_PUBLISH_PORT = GlobalConfig.msList[index].port || "";
  1306 + }
  1307 + loger.log('初始->MS->.', GlobalConfig.MS_PUBLISH_IP, GlobalConfig.MS_PUBLISH_PORT);
  1308 +
  1309 + //播流的地址和推流地址需要分开的时候,单独设置拉流的地址 rtmp(目前乐视使用)
  1310 + if (GlobalConfig.pullRtmpList && GlobalConfig.pullRtmpList.length > 0) {
  1311 + //有单独的rtmp拉流地址
  1312 + let index = parseInt(Math.random() * GlobalConfig.pullRtmpList.length);
  1313 + GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.pullRtmpList[index].ip || "";
  1314 + GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.pullRtmpList[index].port || "";
  1315 + } else {
  1316 + //如果没有单独的rtmp拉流地址,和推流地址一样即可
  1317 + GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.MS_PUBLISH_IP;
  1318 + GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.MS_PUBLISH_PORT;
  1319 + }
1295 1320
1296 - _getVideoPlayPath(_param) {  
1297 - if (_video_ape) {  
1298 - return _video_ape.getPlayVideoPath(_param);  
1299 - }  
1300 - } 1321 + loger.log('初始->MSPull->.', GlobalConfig.MS_PLAY_RTMP_IP, GlobalConfig.MS_PLAY_RTMP_PORT);
  1322 +
  1323 + //播流的地址和推流地址需要分开的时候,单独设置拉流的地址 hls(目前乐视使用)
  1324 + if (GlobalConfig.hlsList && GlobalConfig.hlsList.length > 0) {
  1325 + //有单独的hls拉流地址
  1326 + let index = parseInt(Math.random() * GlobalConfig.hlsList.length);
  1327 + GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.hlsList[index].ip || "";
  1328 + GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.hlsList[index].port || "";
  1329 + } else {
  1330 + //没有单独的hls拉流地址,和录制回放地址一样即可
  1331 + GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.RS_RECORD_PLAY_IP;
  1332 + GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.RS_RECORD_PLAY_PORT;
  1333 + }
  1334 + loger.log('初始->MSHls->.', GlobalConfig.MS_PLAY_HLS_IP, GlobalConfig.MS_PLAY_HLS_PORT);
  1335 +
  1336 + //直播的时候,拉流(rtmp和hls)需要从 videoCDNAddr中获取
  1337 + //20170531-新规则,所有课堂类型都支持加速
  1338 + // if(GlobalConfig.classType==ApeConsts.CLASS_TYPE_2&&GlobalConfig.videoCDNAddrList.length>0){
  1339 + if (GlobalConfig.videoCDNAddrList.length > 0) {
  1340 + //videoCDNAddrList中rtmppush和hls是混在一起的,需要分离开;
  1341 + let listLen = GlobalConfig.videoCDNAddrList.length;
  1342 + for (let i = 0; i < listLen; i++) {
  1343 + let ipItem = GlobalConfig.videoCDNAddrList[i];
  1344 + if (ipItem) {
  1345 + if (ipItem.indexOf('hls') >= 0) {
  1346 + //直播的时候m3u8拉流地址
  1347 + GlobalConfig.MS_PLAY_HLS_IP = ipItem; //ip包含了端口
  1348 + GlobalConfig.MS_PLAY_HLS_PORT = "";
  1349 + loger.log('videoCDNAddr>初始->MSHls', GlobalConfig.MS_PLAY_HLS_IP);
  1350 + } else if (ipItem.indexOf('rtmppull') >= 0) {
  1351 + //直播的时候rtmp拉流地址
  1352 + GlobalConfig.MS_PLAY_RTMP_IP = ipItem; //ip包含了端口
  1353 + GlobalConfig.MS_PLAY_RTMP_PORT = '';
  1354 + loger.log('videoCDNAddr->初始->MSPull', GlobalConfig.MS_PLAY_RTMP_IP);
  1355 + }
  1356 + }
  1357 + }
1301 1358
1302 - _getVideoPublishPath(_param) {  
1303 - if (_video_ape) {  
1304 - return _video_ape.getPublishVideoPath(_param);  
1305 - }  
1306 - } 1359 + } else {
  1360 + loger.log('不需要videoCDNAddr->');
  1361 + }
1307 1362
1308 - _getVideoAllChannelInfo(_param) {  
1309 - if (_video_ape) {  
1310 - return _video_ape.getAllChannelInfo(_param);  
1311 - }  
1312 - } 1363 + //文档地址
  1364 + if (_data.docList && _data.docList.length > 0) {
  1365 + //doc上传地址,随机获取一个
  1366 + let index = parseInt(Math.random() * _data.docList.length);
  1367 + loger.log("docServer->", _data.docList[index]);
  1368 + GlobalConfig.DOCServerIP = _data.docList[index].ip || "";
  1369 + GlobalConfig.DOCServerPort = _data.docList[index].port || "";
  1370 + loger.log('初始->DOC->.', GlobalConfig.DOCServerIP, GlobalConfig.DOCServerPort);
  1371 + }
1313 1372
1314 - _publishVideo(_param) {  
1315 - if (!_mcu.connected) {  
1316 - loger.warn(GlobalConfig.getCurrentStatus());  
1317 - return { "code": ApeConsts.RETURN_FAILED, "data": "" };  
1318 - }  
1319 - if (_video_ape) {  
1320 - return _video_ape.publishVideo(_param);  
1321 - }  
1322 - } 1373 + //record
  1374 + if (_data.recordList && _data.recordList.length > 0) {
  1375 + let index = parseInt(Math.random() * _data.recordList.length);
  1376 + GlobalConfig.RecordServerIP = _data.recordList[index].ip || "";
  1377 + GlobalConfig.RecordServerPort = _data.recordList[index].port || "";
  1378 + loger.log('初始->RECORD->.', GlobalConfig.RecordServerIP, GlobalConfig.RecordServerPort);
  1379 + }
1323 1380
1324 - _stopPublishVideo(_param) {  
1325 - if (!_mcu.connected) {  
1326 - loger.warn(GlobalConfig.getCurrentStatus());  
1327 - return { "code": ApeConsts.RETURN_FAILED, "data": "" };  
1328 - }  
1329 - if (_video_ape) {  
1330 - return _video_ape.stopPublishVideo(_param);  
1331 - }  
1332 - } 1381 + }
  1382 + //这里需要考虑是否加延迟处理,课堂信息刚获取完成,客户端需要根据数据创建界面UI,等创建完成后再加入课堂是最合适的(目前没有加延迟)
  1383 + this._emit(MessageTypes.CLASS_GET_INFO_SUCCESS, GlobalConfig.getClassInfo());
  1384 +
  1385 + if (_data.currentInfo) {
  1386 + //根据从Sass获取的数据信息,同步最后一次保存的课堂状态信息
  1387 + loger.log("本地同步最后一次保存过的课堂状态信息");
  1388 + try {
  1389 + GlobalConfig.setClassStatusInfo(JSON.parse(_data.currentInfo));
  1390 + } catch (err) {
  1391 + GlobalConfig.setClassStatusInfo(_data.currentInfo);
  1392 + }
  1393 + loger.log(GlobalConfig.classStatusInfo);
  1394 + } else {
  1395 + loger.log("还没有保存过课堂状信息");
  1396 + }
1333 1397
1334 - //AudioApe  
1335 - audioUpdate(_data) {  
1336 - //音频同步的消息发送改变,需要通知ferApe模块中的用户更新状态  
1337 - if (_confer_ape) {  
1338 - _confer_ape.updaterRosterStatus(_data); 1398 + //录制回放不需要获取ip信息和选点
  1399 + if (GlobalConfig.isRecordPlayBack) {
  1400 + if (_recordPlayback) {
  1401 + //开启录制回放流程
  1402 + loger.log("开启录制回放流程");
  1403 + _recordPlayback.readyRecordPlay();
  1404 + } else {
  1405 + loger.warn("开启录制回放流程失败->还未创建模块");
  1406 + }
  1407 + } else {
  1408 + //根据用户的userIp获取信息,选点
  1409 + this.getUserIpInfo();
  1410 + } >>> >>> > 51e886 c5e7fcd06f9e4a662071aaec162c455e1d
  1411 + }
  1412 + if (_messageInfo === null || EngineUtils.isEmptyObject(_messageInfo)) {
  1413 + loger.log('发送聊天消息失败->参数错误', _messageInfo);
  1414 + return { "code": ApeConsts.RETURN_FAILED, "data": "" };
  1415 + }
  1416 + if (_chat_ape) {
  1417 + _chat_ape.sendChatMsg(_messageInfo);
  1418 + }
1339 } 1419 }
1340 - }  
1341 1420
1342 - sendAudioCommandMsg(_param) {  
1343 - if (!_mcu.connected) {  
1344 - loger.warn(GlobalConfig.getCurrentStatus());  
1345 - return { "code": ApeConsts.RETURN_FAILED, "data": "" };  
1346 - }  
1347 - if (_audio_ape) {  
1348 - return _audio_ape.sendAudioBroadcastMsg(_param); 1421 + //监听摄像头麦克风状态
  1422 + userDeviecStatusChange(_data) {
  1423 + /* nodeId:GlobalConfig.nodeId,
  1424 + userRole:GlobalConfig.userRole,
  1425 + userName:GlobalConfig.userName,
  1426 + userId:GlobalConfig.userId,
  1427 + openCamera:GlobalConfig.openCamera,
  1428 + openMicrophones:GlobalConfig.openMicrophones*/
  1429 + if (_confer_ape) {
  1430 + _confer_ape.updaterUserDeviecStatusChange(_data);
  1431 + }
1349 } 1432 }
1350 - }  
1351 1433
1352 - _getPlayAudioPath(_param) {  
1353 - if (_audio_ape) {  
1354 - return _audio_ape.getAudioPlayPath(_param); 1434 + //屏幕共享
  1435 + //开始屏幕共享
  1436 + _publishScreenShare(_param) {
  1437 + if (_video_ape) {
  1438 + _video_ape.publishScreenShare(_param);
  1439 + }
  1440 + }
  1441 + //停止屏幕共享
  1442 + _stopPublishScreenShare(_param) {
  1443 + if (_video_ape) {
  1444 + _video_ape.stopPublishScreenShare(_param);
  1445 + }
  1446 + }
  1447 + //VidoeApe
  1448 + videoUpdate(_data) {
  1449 + //视频同步的消息发送改变,需要通知ferApe模块中的用户更新状态
  1450 + if (_confer_ape) {
  1451 + _confer_ape.updaterRosterStatus(_data);
  1452 + }
1355 } 1453 }
1356 - }  
1357 1454
1358 - _getPublishAudioPath(_param) {  
1359 - if (_audio_ape) {  
1360 - return _audio_ape.getAudioPublishPath(_param); 1455 + _sendVideoBroadcastMsg(_param) {
  1456 + if (!_mcu.connected) {
  1457 + loger.warn(GlobalConfig.getCurrentStatus());
  1458 + return { "code": ApeConsts.RETURN_FAILED, "data": "" };
  1459 + }
  1460 + if (_video_ape) {
  1461 + return _video_ape.sendVideoBroadcastMsg(_param);
  1462 + }
1361 } 1463 }
1362 - }  
1363 1464
1364 - _getAudioAllChannelInfo(_param) {  
1365 - if (_audio_ape) {  
1366 - return _audio_ape.getAllChannelInfo(_param); 1465 + _getVideoPlayPath(_param) {
  1466 + if (_video_ape) {
  1467 + return _video_ape.getPlayVideoPath(_param);
  1468 + }
1367 } 1469 }
1368 - }  
1369 1470
1370 - _publishAudio(_param) {  
1371 - if (!_mcu.connected) {  
1372 - loger.warn(GlobalConfig.getCurrentStatus());  
1373 - return { "code": ApeConsts.RETURN_FAILED, "data": "" };  
1374 - }  
1375 - if (_audio_ape) {  
1376 - return _audio_ape.publishAudio(_param); 1471 + _getVideoPublishPath(_param) {
  1472 + if (_video_ape) {
  1473 + return _video_ape.getPublishVideoPath(_param);
  1474 + }
1377 } 1475 }
1378 - }  
1379 1476
1380 - _stopPublishAudio(_param) {  
1381 - if (!_mcu.connected) {  
1382 - loger.warn(GlobalConfig.getCurrentStatus());  
1383 - return { "code": ApeConsts.RETURN_FAILED, "data": "" };  
1384 - }  
1385 - if (_audio_ape) {  
1386 - return _audio_ape.stopPublishAudio(_param); 1477 + _getVideoAllChannelInfo(_param) {
  1478 + if (_video_ape) {
  1479 + return _video_ape.getAllChannelInfo(_param);
  1480 + }
1387 } 1481 }
1388 - }  
1389 1482
1390 - //WhiteBoardApe  
1391 - // 添加标注,发送信息  
1392 - _sendInsertAnnotaion(_param) {  
1393 - if (!_mcu.connected) {  
1394 - loger.warn(GlobalConfig.getCurrentStatus());  
1395 - return;  
1396 - }  
1397 - if (_whiteboard_ape) {  
1398 - _whiteboard_ape.sendInsetAnnotaion(_param); 1483 + _publishVideo(_param) {
  1484 + if (!_mcu.connected) {
  1485 + loger.warn(GlobalConfig.getCurrentStatus());
  1486 + return { "code": ApeConsts.RETURN_FAILED, "data": "" };
  1487 + }
  1488 + if (_video_ape) {
  1489 + return _video_ape.publishVideo(_param);
  1490 + }
1399 } 1491 }
1400 - }  
1401 1492
1402 - //CursorApe  
1403 - // 添加鼠标同步  
1404 - _sendInsertCursor(_param) {  
1405 - if (!_mcu.connected) {  
1406 - loger.warn(GlobalConfig.getCurrentStatus());  
1407 - return;  
1408 - }  
1409 - if (_cursor_ape) {  
1410 - _cursor_ape.sendInsertCursor(_param); 1493 + _stopPublishVideo(_param) {
  1494 + if (!_mcu.connected) {
  1495 + loger.warn(GlobalConfig.getCurrentStatus());
  1496 + return { "code": ApeConsts.RETURN_FAILED, "data": "" };
  1497 + }
  1498 + if (_video_ape) {
  1499 + return _video_ape.stopPublishVideo(_param);
  1500 + }
1411 } 1501 }
1412 - }  
1413 1502
1414 - //删除当前页面上的所有标注  
1415 - _sendDeleteCurPageAnnotation(_param) {  
1416 - if (!_mcu.connected) {  
1417 - loger.warn(GlobalConfig.getCurrentStatus());  
1418 - return;  
1419 - }  
1420 - if (_whiteboard_ape) {  
1421 - _whiteboard_ape.sendDeleteCurPageAnnotation(_param); 1503 + //AudioApe
  1504 + audioUpdate(_data) {
  1505 + //音频同步的消息发送改变,需要通知ferApe模块中的用户更新状态
  1506 + if (_confer_ape) {
  1507 + _confer_ape.updaterRosterStatus(_data);
  1508 + }
1422 } 1509 }
1423 - }  
1424 1510
1425 - //删除所有标注  
1426 - _sendDeleteAllAnnotation(_param) {  
1427 - if (!_mcu.connected) {  
1428 - loger.warn(GlobalConfig.getCurrentStatus());  
1429 - return;  
1430 - }  
1431 - if (_whiteboard_ape) {  
1432 - _whiteboard_ape.sendDeleteAllAnnotation(_param); 1511 + sendAudioCommandMsg(_param) {
  1512 + if (!_mcu.connected) {
  1513 + loger.warn(GlobalConfig.getCurrentStatus());
  1514 + return { "code": ApeConsts.RETURN_FAILED, "data": "" };
  1515 + }
  1516 + if (_audio_ape) {
  1517 + return _audio_ape.sendAudioBroadcastMsg(_param);
  1518 + }
1433 } 1519 }
1434 - }  
1435 1520
1436 - //返回上一步标注  
1437 - _sendGotoPrev(_param) {  
1438 - if (_whiteboard_ape) {  
1439 - _whiteboard_ape.sendGotoPrev(_param); 1521 + _getPlayAudioPath(_param) {
  1522 + if (_audio_ape) {
  1523 + return _audio_ape.getAudioPlayPath(_param);
  1524 + }
1440 } 1525 }
1441 - }  
1442 1526
1443 - //DocApe  
1444 - //获取文档的所有资源地址  
1445 - _getDocFullAddress(_param) {  
1446 - if (_doc_ape) {  
1447 - return _doc_ape.getDocFullAddress(_param);  
1448 - } else {  
1449 - loger.error("文档模块还没有创建无法获取");  
1450 - return { "code": ApeConsts.RETURN_FAILED, "data": "文档模块还没有创建无法获取" }; 1527 + _getPublishAudioPath(_param) {
  1528 + if (_audio_ape) {
  1529 + return _audio_ape.getAudioPublishPath(_param);
  1530 + }
1451 } 1531 }
1452 - }  
1453 1532
1454 - //获取文档完整路径  
1455 - _getDocImageFullPath(_param) {  
1456 - if (_doc_ape) {  
1457 - return _doc_ape.getDocImageFullPath(_param);  
1458 - } else {  
1459 - loger.error("文档模块还没有创建无法获取");  
1460 - return []; 1533 + _getAudioAllChannelInfo(_param) {
  1534 + if (_audio_ape) {
  1535 + return _audio_ape.getAllChannelInfo(_param);
  1536 + }
1461 } 1537 }
1462 - }  
1463 1538
1464 - _getDocPDFFullPath(_param) {  
1465 - if (_doc_ape) {  
1466 - return _doc_ape.getDocPDFFullPath(_param);  
1467 - } else {  
1468 - loger.error("文档模块还没有创建,无法获取");  
1469 - return []; 1539 + _publishAudio(_param) {
  1540 + if (!_mcu.connected) {
  1541 + loger.warn(GlobalConfig.getCurrentStatus());
  1542 + return { "code": ApeConsts.RETURN_FAILED, "data": "" };
  1543 + }
  1544 + if (_audio_ape) {
  1545 + return _audio_ape.publishAudio(_param);
  1546 + }
1470 } 1547 }
1471 - }  
1472 1548
1473 - //上传文档  
1474 - _sendDocumentUpload(_param) {  
1475 - if (!_mcu.connected) {  
1476 - loger.warn(GlobalConfig.getCurrentStatus());  
1477 - return;  
1478 - }  
1479 - if (_doc_ape) {  
1480 - _doc_ape.documentUpload(_param); 1549 + _stopPublishAudio(_param) {
  1550 + if (!_mcu.connected) {
  1551 + loger.warn(GlobalConfig.getCurrentStatus());
  1552 + return { "code": ApeConsts.RETURN_FAILED, "data": "" };
  1553 + }
  1554 + if (_audio_ape) {
  1555 + return _audio_ape.stopPublishAudio(_param);
  1556 + }
1481 } 1557 }
1482 - }  
1483 1558
1484 - //切换文档  
1485 - _sendDocumentSwitchDoc(_param) {  
1486 - if (!_mcu.connected) {  
1487 - loger.warn(GlobalConfig.getCurrentStatus());  
1488 - return;  
1489 - }  
1490 - if (_doc_ape) {  
1491 - _doc_ape.documentSwitchDoc(_param); 1559 + //WhiteBoardApe
  1560 + // 添加标注,发送信息
  1561 + _sendInsertAnnotaion(_param) {
  1562 + if (!_mcu.connected) {
  1563 + loger.warn(GlobalConfig.getCurrentStatus());
  1564 + return;
  1565 + }
  1566 + if (_whiteboard_ape) {
  1567 + _whiteboard_ape.sendInsetAnnotaion(_param);
  1568 + }
1492 } 1569 }
1493 - }  
1494 1570
1495 - //操作文档(翻页)  
1496 - _sendDocumentSwitchPage(_param) { 1571 + //CursorApe
  1572 + // 添加鼠标同步
  1573 + _sendInsertCursor(_param) {
1497 if (!_mcu.connected) { 1574 if (!_mcu.connected) {
1498 loger.warn(GlobalConfig.getCurrentStatus()); 1575 loger.warn(GlobalConfig.getCurrentStatus());
1499 return; 1576 return;
1500 } 1577 }
1501 - if (_doc_ape) {  
1502 - _doc_ape.documentSwitchPage(_param); 1578 + if (_cursor_ape) {
  1579 + _cursor_ape.sendInsertCursor(_param);
1503 } 1580 }
1504 } 1581 }
1505 - //操作文档(页码上的动画步骤操作)  
1506 - _sendDocumentSwitchAnimation(_param) { 1582 +
  1583 + //删除当前页面上的所有标注
  1584 + _sendDeleteCurPageAnnotation(_param) {
1507 if (!_mcu.connected) { 1585 if (!_mcu.connected) {
1508 loger.warn(GlobalConfig.getCurrentStatus()); 1586 loger.warn(GlobalConfig.getCurrentStatus());
1509 return; 1587 return;
1510 } 1588 }
1511 - if (_doc_ape) {  
1512 - _doc_ape.documentSwitchAnimation(_param); 1589 + if (_whiteboard_ape) {
  1590 + _whiteboard_ape.sendDeleteCurPageAnnotation(_param);
1513 } 1591 }
1514 } 1592 }
1515 - //操作文档(缩放、滚动...)  
1516 - _sendDocumentCommand(_param) {  
1517 - if (!_mcu.connected) {  
1518 - loger.warn(GlobalConfig.getCurrentStatus());  
1519 - return;  
1520 - }  
1521 - if (_doc_ape) {  
1522 - _doc_ape.documentCommand(_param);  
1523 - }  
1524 - }  
1525 1593
1526 - //删除文档  
1527 - _sendDocumentDelete(_param) {  
1528 - if (!_mcu.connected) {  
1529 - loger.warn(GlobalConfig.getCurrentStatus());  
1530 - return;  
1531 - }  
1532 - if (_doc_ape) {  
1533 - _doc_ape.documentDelete(_param); 1594 + //删除所有标注
  1595 + _sendDeleteAllAnnotation(_param) {
  1596 + if (!_mcu.connected) {
  1597 + loger.warn(GlobalConfig.getCurrentStatus());
  1598 + return;
  1599 + }
  1600 + if (_whiteboard_ape) {
  1601 + _whiteboard_ape.sendDeleteAllAnnotation(_param);
  1602 + }
1534 } 1603 }
1535 - }  
1536 1604
1537 - //删除所有文档  
1538 - _documentDeleteAll(_param) {  
1539 - if (!_mcu.connected) {  
1540 - loger.warn(GlobalConfig.getCurrentStatus());  
1541 - return;  
1542 - }  
1543 - if (_doc_ape) {  
1544 - _doc_ape.documentDeleteAll(_param); 1605 + //返回上一步标注
  1606 + _sendGotoPrev(_param) {
  1607 + if (_whiteboard_ape) {
  1608 + _whiteboard_ape.sendGotoPrev(_param);
  1609 + }
1545 } 1610 }
1546 - }  
1547 1611
1548 - //// 文档变更,白板也需要做处理  
1549 - docUpdateHandler(_data) {  
1550 - if (!_mcu.connected && !GlobalConfig.isRecordPlayBack) {  
1551 - loger.warn(GlobalConfig.getCurrentStatus());  
1552 - return;  
1553 - }  
1554 - //loger.log('Doc UpdateId ->');  
1555 - //loger.log(_data);  
1556 - if (_whiteboard_ape) {  
1557 - _whiteboard_ape.docUpdateHandler(_data); 1612 + //DocApe
  1613 + //获取文档的所有资源地址
  1614 + _getDocFullAddress(_param) {
  1615 + if (_doc_ape) {
  1616 + return _doc_ape.getDocFullAddress(_param);
  1617 + } else {
  1618 + loger.error("文档模块还没有创建无法获取");
  1619 + return { "code": ApeConsts.RETURN_FAILED, "data": "文档模块还没有创建无法获取" };
  1620 + }
1558 } 1621 }
1559 - }  
1560 1622
1561 - //文档删除,白板也需要做处理  
1562 - docDeleteHandler(_data) {  
1563 - if (_whiteboard_ape) {  
1564 - _whiteboard_ape.docDeleteHandler(_data); 1623 + //获取文档完整路径
  1624 + _getDocImageFullPath(_param) {
  1625 + if (_doc_ape) {
  1626 + return _doc_ape.getDocImageFullPath(_param);
  1627 + } else {
  1628 + loger.error("文档模块还没有创建无法获取");
  1629 + return [];
  1630 + }
1565 } 1631 }
1566 - }  
1567 1632
1568 - //文档加入频道成功,同步到MCU服务器上的数据  
1569 - docJoinChannelSuccess() {  
1570 - loger.log("docJoinChannelSuccess->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.docListPrepare.length);  
1571 - //loger.log("docJoinChannelSuccess docListPrepare=");  
1572 - //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传  
1573 - if (GlobalConfig.isHost && GlobalConfig.docListPrepare.length > 0) {  
1574 - for (let i = 0; i < GlobalConfig.docListPrepare.length; i++) {  
1575 - let value = GlobalConfig.docListPrepare[i];  
1576 - if (value) {  
1577 - //loger.log("判断是否需要把提前上传的文档上传到mcu", value);  
1578 - let paramInfo = {  
1579 - "pageNum": value.pdfSize,  
1580 - "fileName": value.name,  
1581 - "fileType": value.type,  
1582 - "relativeUrl": value.relativeLocation,  
1583 - "url": value.absoluteLocation,  
1584 - "creatUserId": value.createUserID,  
1585 - "docId": value.id,  
1586 - "md5": value.MD5,  
1587 - "visible": false  
1588 - };  
1589 - this._sendDocumentUpload(paramInfo);  
1590 - } 1633 + _getDocPDFFullPath(_param) {
  1634 + if (_doc_ape) {
  1635 + return _doc_ape.getDocPDFFullPath(_param);
  1636 + } else {
  1637 + loger.error("文档模块还没有创建,无法获取");
  1638 + return [];
1591 } 1639 }
1592 } 1640 }
1593 - }  
1594 1641
1595 - //媒体共享模块的接口  
1596 - //上传  
1597 - _sendMediaSharedUpload(_param) { 1642 + //上传文档
  1643 + _sendDocumentUpload(_param) {
1598 if (!_mcu.connected) { 1644 if (!_mcu.connected) {
1599 loger.warn(GlobalConfig.getCurrentStatus()); 1645 loger.warn(GlobalConfig.getCurrentStatus());
1600 return; 1646 return;
1601 } 1647 }
1602 - if (_mediaShareApe) {  
1603 - _mediaShareApe.mediaSharedUpload(_param); 1648 + if (_doc_ape) {
  1649 + _doc_ape.documentUpload(_param);
1604 } 1650 }
1605 } 1651 }
1606 - //Sass删除媒体文件数据  
1607 - _sassDeletMediaShare(_param) { 1652 +
  1653 + //切换文档
  1654 + _sendDocumentSwitchDoc(_param) {
1608 if (!_mcu.connected) { 1655 if (!_mcu.connected) {
1609 loger.warn(GlobalConfig.getCurrentStatus()); 1656 loger.warn(GlobalConfig.getCurrentStatus());
1610 return; 1657 return;
1611 } 1658 }
  1659 + if (_doc_ape) {
  1660 + _doc_ape.documentSwitchDoc(_param);
  1661 + }
  1662 + }
1612 1663
1613 - //判断传入的参数是否存在  
1614 - if (_param == null || EngineUtils.isEmptyObject(_param)) {  
1615 - loger.error('删除媒体文件失败->参数错误', _param);  
1616 - this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_MEDIASHARE_DELETE_FAILED_PARAM);  
1617 - return; 1664 + //操作文档(翻页)
  1665 + _sendDocumentSwitchPage(_param) {
  1666 + if (!_mcu.connected) {
  1667 + loger.warn(GlobalConfig.getCurrentStatus());
  1668 + return;
  1669 + }
  1670 + if (_doc_ape) {
  1671 + _doc_ape.documentSwitchPage(_param);
  1672 + }
1618 } 1673 }
1619 - //判断必要的参数字段值  
1620 - if (_param.itemIdx == null || isNaN(_param.itemIdx) || _param.fileId == null || _param.fileId == "") {  
1621 - loger.error('删除媒体文件失败->', _param);  
1622 - this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_MEDIASHARE_DELETE_FAILED_PARAM); 1674 + //操作文档(页码上的动画步骤操作)
  1675 + _sendDocumentSwitchAnimation(_param) {
  1676 + if (!_mcu.connected) {
  1677 + loger.warn(GlobalConfig.getCurrentStatus());
  1678 + return;
  1679 + }
  1680 + if (_doc_ape) {
  1681 + _doc_ape.documentSwitchAnimation(_param);
  1682 + }
  1683 + }
  1684 + //操作文档(缩放、滚动...)
  1685 + _sendDocumentCommand(_param) {
  1686 + if (!_mcu.connected) {
  1687 + loger.warn(GlobalConfig.getCurrentStatus());
1623 return; 1688 return;
1624 } 1689 }
1625 - loger.log('删除媒体文件->', _param);  
1626 -  
1627 - if (_sass) {  
1628 - _sass.sassDeletMediaShare(_param); 1690 + if (_doc_ape) {
  1691 + _doc_ape.documentCommand(_param);
1629 } 1692 }
1630 } 1693 }
1631 - //删除  
1632 - _sendMediaSharedDelete(_param) { 1694 +
  1695 + //删除文档
  1696 + _sendDocumentDelete(_param) {
1633 if (!_mcu.connected) { 1697 if (!_mcu.connected) {
1634 loger.warn(GlobalConfig.getCurrentStatus()); 1698 loger.warn(GlobalConfig.getCurrentStatus());
1635 return; 1699 return;
1636 } 1700 }
1637 - if (_mediaShareApe) {  
1638 - _mediaShareApe.mediaSharedDelete(_param); 1701 + if (_doc_ape) {
  1702 + _doc_ape.documentDelete(_param);
1639 } 1703 }
1640 } 1704 }
1641 - //更新媒体文件的状态信息  
1642 - _sendMediaSharedUpdate(_param) { 1705 +
  1706 + //删除所有文档
  1707 + _documentDeleteAll(_param) {
1643 if (!_mcu.connected) { 1708 if (!_mcu.connected) {
1644 loger.warn(GlobalConfig.getCurrentStatus()); 1709 loger.warn(GlobalConfig.getCurrentStatus());
1645 return; 1710 return;
1646 } 1711 }
1647 - if (_mediaShareApe) {  
1648 - _mediaShareApe.mediaSharedUpdate(_param); 1712 + if (_doc_ape) {
  1713 + _doc_ape.documentDeleteAll(_param);
1649 } 1714 }
1650 } 1715 }
1651 - //播放  
1652 - _sendMediaSharedPlay(_param) {  
1653 - if (!_mcu.connected) { 1716 +
  1717 + //// 文档变更,白板也需要做处理
  1718 + docUpdateHandler(_data) {
  1719 + if (!_mcu.connected && !GlobalConfig.isRecordPlayBack) {
1654 loger.warn(GlobalConfig.getCurrentStatus()); 1720 loger.warn(GlobalConfig.getCurrentStatus());
1655 return; 1721 return;
1656 } 1722 }
1657 - if (_mediaShareApe) {  
1658 - _mediaShareApe.mediaSharedPlay(_param); 1723 + //loger.log('Doc UpdateId ->');
  1724 + //loger.log(_data);
  1725 + if (_whiteboard_ape) {
  1726 + _whiteboard_ape.docUpdateHandler(_data);
1659 } 1727 }
1660 } 1728 }
1661 - //停止  
1662 - _sendMediaSharedStop(_param) {  
1663 - if (!_mcu.connected) {  
1664 - loger.warn(GlobalConfig.getCurrentStatus());  
1665 - return;  
1666 - }  
1667 - if (_mediaShareApe) {  
1668 - _mediaShareApe.mediaSharedStop(_param); 1729 +
  1730 + //文档删除,白板也需要做处理
  1731 + docDeleteHandler(_data) {
  1732 + if (_whiteboard_ape) {
  1733 + _whiteboard_ape.docDeleteHandler(_data);
  1734 + }
1669 } 1735 }
1670 - }  
1671 1736
1672 - //媒体共享模块加入频道成功,同步到MCU服务器上的数据  
1673 - mediaShareApeJoinChannelSuccess() {  
1674 - loger.log("媒体共享模块加入频道成功->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.sharedMediaList.length);  
1675 - console.log("媒体共享模数据->", GlobalConfig.sharedMediaList);  
1676 - //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传  
1677 - if (GlobalConfig.isHost && GlobalConfig.sharedMediaList.length > 0) {  
1678 - for (let i = 0; i < GlobalConfig.sharedMediaList.length; i++) {  
1679 - let value = GlobalConfig.sharedMediaList[i];  
1680 - if (value) {  
1681 - let paramInfo = {  
1682 - "status": 0,  
1683 - "creatUserId": value.creatUserId,  
1684 - "creatUserName": value.createUserName,  
1685 - "url": value.url,  
1686 - "fileType": value.type,  
1687 - "fileId": "" + value.id,  
1688 - "fileName": value.name,  
1689 - "seek": 0  
1690 - };  
1691 - this._sendMediaSharedUpload(paramInfo); 1737 + //文档加入频道成功,同步到MCU服务器上的数据
  1738 + docJoinChannelSuccess() {
  1739 + loger.log("docJoinChannelSuccess->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.docListPrepare.length);
  1740 + //loger.log("docJoinChannelSuccess docListPrepare=");
  1741 + //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
  1742 + if (GlobalConfig.isHost && GlobalConfig.docListPrepare.length > 0) {
  1743 + for (let i = 0; i < GlobalConfig.docListPrepare.length; i++) {
  1744 + let value = GlobalConfig.docListPrepare[i];
  1745 + if (value) {
  1746 + //loger.log("判断是否需要把提前上传的文档上传到mcu", value);
  1747 + let paramInfo = {
  1748 + "pageNum": value.pdfSize,
  1749 + "fileName": value.name,
  1750 + "fileType": value.type,
  1751 + "relativeUrl": value.relativeLocation,
  1752 + "url": value.absoluteLocation,
  1753 + "creatUserId": value.createUserID,
  1754 + "docId": value.id,
  1755 + "md5": value.MD5,
  1756 + "visible": false
  1757 + };
  1758 + this._sendDocumentUpload(paramInfo);
  1759 + }
1692 } 1760 }
1693 } 1761 }
1694 } 1762 }
1695 - }  
1696 1763
1697 - //录制回放相关的处理------------------------------------------------  
1698 - //录制回放初始化  
1699 - _initRecordPlayback(_param) {  
1700 - //{"classId":"1653304953","portal":"112.126.80.182:80","userRole":"normal","userId":0}  
1701 - if (_param == null) {  
1702 - loger.error('录制回放初始化失败->参数错误');  
1703 - this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_INIT_RECORD_PLAY_BACK_FAILED);  
1704 - return;  
1705 - }  
1706 - //判断必要的参数字段值  
1707 - if (_param.classId == null || isNaN(_param.classId) || _param.portal == null || _param.portal == "") {  
1708 - loger.error('录制回放初始化失败->', _param);  
1709 - this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_INIT_RECORD_PLAY_BACK_FAILED);  
1710 - return;  
1711 - }  
1712 - loger.log('录制回放初始化->', _param); 1764 + //媒体共享模块的接口
  1765 + //上传
  1766 + _sendMediaSharedUpload(_param) {
  1767 + if (!_mcu.connected) {
  1768 + loger.warn(GlobalConfig.getCurrentStatus());
  1769 + return;
  1770 + }
  1771 + if (_mediaShareApe) {
  1772 + _mediaShareApe.mediaSharedUpload(_param);
  1773 + }
  1774 + }
  1775 + //Sass删除媒体文件数据
  1776 + _sassDeletMediaShare(_param) {
  1777 + if (!_mcu.connected) {
  1778 + loger.warn(GlobalConfig.getCurrentStatus());
  1779 + return;
  1780 + }
1713 1781
1714 - //保存参数  
1715 - GlobalConfig.isRecordPlayBack = true; //设置为录制回放状态  
1716 - GlobalConfig.classId = parseInt(_param.classId);  
1717 - GlobalConfig.portal = _param.portal;  
1718 - GlobalConfig.userRole = ApeConsts.normal; //*************很重要,录制回放的时候,身份模式是普通人********  
1719 - GlobalConfig.userId = _param.userId || "0";  
1720 - GlobalConfig.userName = _param.userName || ""; 1782 + //判断传入的参数是否存在
  1783 + if (_param == null || EngineUtils.isEmptyObject(_param)) {
  1784 + loger.error('删除媒体文件失败->参数错误', _param);
  1785 + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_MEDIASHARE_DELETE_FAILED_PARAM);
  1786 + return;
  1787 + }
  1788 + //判断必要的参数字段值
  1789 + if (_param.itemIdx == null || isNaN(_param.itemIdx) || _param.fileId == null || _param.fileId == "") {
  1790 + loger.error('删除媒体文件失败->', _param);
  1791 + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_MEDIASHARE_DELETE_FAILED_PARAM);
  1792 + return;
  1793 + }
  1794 + loger.log('删除媒体文件->', _param);
1721 1795
1722 - //获取课堂最完整的数据,录制回放需要获取课堂数据  
1723 - if (_sass) {  
1724 - _sass.getClassParam(); 1796 + if (_sass) {
  1797 + _sass.sassDeletMediaShare(_param);
  1798 + }
  1799 + }
  1800 + //删除
  1801 + _sendMediaSharedDelete(_param) {
  1802 + if (!_mcu.connected) {
  1803 + loger.warn(GlobalConfig.getCurrentStatus());
  1804 + return;
  1805 + }
  1806 + if (_mediaShareApe) {
  1807 + _mediaShareApe.mediaSharedDelete(_param);
  1808 + }
  1809 + }
  1810 + //更新媒体文件的状态信息
  1811 + _sendMediaSharedUpdate(_param) {
  1812 + if (!_mcu.connected) {
  1813 + loger.warn(GlobalConfig.getCurrentStatus());
  1814 + return;
  1815 + }
  1816 + if (_mediaShareApe) {
  1817 + _mediaShareApe.mediaSharedUpdate(_param);
  1818 + }
  1819 + }
  1820 + //播放
  1821 + _sendMediaSharedPlay(_param) {
  1822 + if (!_mcu.connected) {
  1823 + loger.warn(GlobalConfig.getCurrentStatus());
  1824 + return;
  1825 + }
  1826 + if (_mediaShareApe) {
  1827 + _mediaShareApe.mediaSharedPlay(_param);
  1828 + }
  1829 + }
  1830 + //停止
  1831 + _sendMediaSharedStop(_param) {
  1832 + if (!_mcu.connected) {
  1833 + loger.warn(GlobalConfig.getCurrentStatus());
  1834 + return;
  1835 + }
  1836 + if (_mediaShareApe) {
  1837 + _mediaShareApe.mediaSharedStop(_param);
  1838 + }
1725 } 1839 }
1726 - }  
1727 1840
1728 - //开始录制回放  
1729 - _startRecordPlayback(_param) {  
1730 - if (_recordPlayback) {  
1731 - _recordPlayback.startRecordPlayback(_param); 1841 + //媒体共享模块加入频道成功,同步到MCU服务器上的数据
  1842 + mediaShareApeJoinChannelSuccess() {
  1843 + loger.log("媒体共享模块加入频道成功->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.sharedMediaList.length);
  1844 + console.log("媒体共享模数据->", GlobalConfig.sharedMediaList);
  1845 + //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
  1846 + if (GlobalConfig.isHost && GlobalConfig.sharedMediaList.length > 0) {
  1847 + for (let i = 0; i < GlobalConfig.sharedMediaList.length; i++) {
  1848 + let value = GlobalConfig.sharedMediaList[i];
  1849 + if (value) {
  1850 + let paramInfo = {
  1851 + "status": 0,
  1852 + "creatUserId": value.creatUserId,
  1853 + "creatUserName": value.createUserName,
  1854 + "url": value.url,
  1855 + "fileType": value.type,
  1856 + "fileId": "" + value.id,
  1857 + "fileName": value.name,
  1858 + "seek": 0
  1859 + };
  1860 + this._sendMediaSharedUpload(paramInfo);
  1861 + }
  1862 + }
  1863 + }
1732 } 1864 }
1733 - }  
1734 1865
1735 - //停止录制回放  
1736 - _stopRecordPlayback(_param) {  
1737 - if (_recordPlayback) {  
1738 - _recordPlayback.stopRecordPlayback(_param);  
1739 - }  
1740 - } 1866 + //录制回放相关的处理------------------------------------------------
  1867 + //录制回放初始化
  1868 + _initRecordPlayback(_param) {
  1869 + //{"classId":"1653304953","portal":"112.126.80.182:80","userRole":"normal","userId":0}
  1870 + if (_param == null) {
  1871 + loger.error('录制回放初始化失败->参数错误');
  1872 + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_INIT_RECORD_PLAY_BACK_FAILED);
  1873 + return;
  1874 + }
  1875 + //判断必要的参数字段值
  1876 + if (_param.classId == null || isNaN(_param.classId) || _param.portal == null || _param.portal == "") {
  1877 + loger.error('录制回放初始化失败->', _param);
  1878 + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_INIT_RECORD_PLAY_BACK_FAILED);
  1879 + return;
  1880 + }
  1881 + loger.log('录制回放初始化->', _param);
1741 1882
1742 - //暂停录制回放  
1743 - _pauseRecordPlayback(_param) {  
1744 - if (_recordPlayback) {  
1745 - _recordPlayback.pauseRecordPlayback(_param);  
1746 - }  
1747 - } 1883 + //保存参数
  1884 + GlobalConfig.isRecordPlayBack = true; //设置为录制回放状态
  1885 + GlobalConfig.classId = parseInt(_param.classId);
  1886 + GlobalConfig.portal = _param.portal;
  1887 + GlobalConfig.userRole = ApeConsts.normal; //*************很重要,录制回放的时候,身份模式是普通人********
  1888 + GlobalConfig.userId = _param.userId || "0";
  1889 + GlobalConfig.userName = _param.userName || "";
1748 1890
1749 - //seek录制回放  
1750 - _seekRecordPlayback(_param) {  
1751 - if (_recordPlayback) {  
1752 - _recordPlayback.seekRecordPlayback(_param); 1891 + //获取课堂最完整的数据,录制回放需要获取课堂数据
  1892 + if (_sass) {
  1893 + _sass.getClassParam();
  1894 + }
1753 } 1895 }
1754 - }  
1755 1896
1756 - //录制回放状态更新  
1757 - _recordPlaybackClearDataHandler(_param) {  
1758 - loger.log("录制回放状态更新->")  
1759 - if (_doc_ape) {  
1760 - _doc_ape.clearData();  
1761 - }  
1762 - if (_whiteboard_ape) {  
1763 - _whiteboard_ape.clearData();  
1764 - }  
1765 - if (_video_ape) {  
1766 - _video_ape.clearData(); 1897 + //开始录制回放
  1898 + _startRecordPlayback(_param) {
  1899 + if (_recordPlayback) {
  1900 + _recordPlayback.startRecordPlayback(_param);
  1901 + }
1767 } 1902 }
1768 - }  
1769 -  
1770 - //录制回放加入 课堂成功  
1771 - _joinRecordPlaybackSuccessHandler(_data) {  
1772 - loger.log('加入录制回放成功.');  
1773 - GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_2);  
1774 -  
1775 - //返回给客户端初始化成功的数据  
1776 - let joinClassSuccessCallBackData = {};  
1777 1903
1778 - joinClassSuccessCallBackData.isRecordPlayBack = GlobalConfig.isRecordPlayBack;  
1779 -  
1780 - joinClassSuccessCallBackData.DOCServerIP = GlobalConfig.DOCServerIP;  
1781 - joinClassSuccessCallBackData.DOCServerPort = GlobalConfig.DOCServerPort;  
1782 -  
1783 - joinClassSuccessCallBackData.classStatus = GlobalConfig.classStatus;  
1784 - joinClassSuccessCallBackData.classId = GlobalConfig.classId;  
1785 - joinClassSuccessCallBackData.className = GlobalConfig.className;  
1786 - joinClassSuccessCallBackData.h5Module = GlobalConfig.h5Module;  
1787 - joinClassSuccessCallBackData.isHost = GlobalConfig.isHost; //  
1788 - joinClassSuccessCallBackData.maxAudioChannels = GlobalConfig.maxAudioChannels;  
1789 - joinClassSuccessCallBackData.maxVideoChannels = GlobalConfig.maxVideoChannels;  
1790 - joinClassSuccessCallBackData.maxMediaChannels = GlobalConfig.maxMediaChannels;  
1791 -  
1792 - joinClassSuccessCallBackData.mcuDelay = GlobalConfig.mcuDelay;  
1793 -  
1794 - joinClassSuccessCallBackData.msType = GlobalConfig.msType;  
1795 - joinClassSuccessCallBackData.nodeId = GlobalConfig.nodeId;  
1796 - joinClassSuccessCallBackData.password = GlobalConfig.password;  
1797 - joinClassSuccessCallBackData.passwordRequired = GlobalConfig.passwordRequired; // 老师的默认是true  
1798 - //GlobalConfig.passwordRequired 老师的默认是true  
1799 - //GlobalConfig.portal=_data.portal;  
1800 - joinClassSuccessCallBackData.role = GlobalConfig.role;  
1801 - joinClassSuccessCallBackData.siteId = GlobalConfig.siteId;  
1802 - joinClassSuccessCallBackData.topNodeID = GlobalConfig.topNodeID;  
1803 - joinClassSuccessCallBackData.userId = GlobalConfig.userId;  
1804 - joinClassSuccessCallBackData.userName = GlobalConfig.userName;  
1805 - joinClassSuccessCallBackData.userRole = GlobalConfig.userRole;  
1806 - joinClassSuccessCallBackData.userType = GlobalConfig.userType;  
1807 -  
1808 - joinClassSuccessCallBackData.siteId = GlobalConfig.siteId;  
1809 - joinClassSuccessCallBackData.classId = GlobalConfig.classId;  
1810 - joinClassSuccessCallBackData.userRole = GlobalConfig.userRole;  
1811 - joinClassSuccessCallBackData.userId = GlobalConfig.userId;  
1812 - joinClassSuccessCallBackData.passwordRequired = GlobalConfig.passwordRequired;  
1813 - joinClassSuccessCallBackData.classType = GlobalConfig.classType || ApeConsts.CLASS_TYPE_1;  
1814 -  
1815 - joinClassSuccessCallBackData.country = GlobalConfig.country; //国家  
1816 - joinClassSuccessCallBackData.city = GlobalConfig.city; //城市  
1817 - joinClassSuccessCallBackData.province = GlobalConfig.province; //服务商  
1818 - joinClassSuccessCallBackData.isp = GlobalConfig.isp; //服务商  
1819 -  
1820 - joinClassSuccessCallBackData.classTimestamp = GlobalConfig.classTimestamp; //课堂进行的累积时间  
1821 - joinClassSuccessCallBackData.recordTimestamp = GlobalConfig.recordTimestamp; //录制累积的总时间  
1822 - joinClassSuccessCallBackData.recordPlaybackMaxTime = GlobalConfig.recordPlaybackMaxTime; //录制回放的总时间  
1823 -  
1824 - joinClassSuccessCallBackData.fps = GlobalConfig.fps;  
1825 - joinClassSuccessCallBackData.gop = GlobalConfig.gop;  
1826 - joinClassSuccessCallBackData.videoQuality = GlobalConfig.videoQuality;  
1827 -  
1828 - joinClassSuccessCallBackData.ssTunnelAppURL = GlobalConfig.ssTunnelAppURL;  
1829 - joinClassSuccessCallBackData.currentSceneTableId = GlobalConfig.currentSceneTableId; //文档区域的模块显示  
1830 - loger.log(joinClassSuccessCallBackData);  
1831 - //和加入课堂成功使用同样的消息处理  
1832 - this._emit(MessageTypes.CLASS_JOIN_SUCCESS, joinClassSuccessCallBackData);  
1833 - }  
1834 -  
1835 - // //答题卡  
1836 - _creatQuestion(_param) {  
1837 - if (!_mcu.connected) {  
1838 - loger.warn(GlobalConfig.getCurrentStatus());  
1839 - return;  
1840 - }  
1841 - if (_questionApe) {  
1842 - _questionApe.creatQuestion(_param); 1904 + //停止录制回放
  1905 + _stopRecordPlayback(_param) {
  1906 + if (_recordPlayback) {
  1907 + _recordPlayback.stopRecordPlayback(_param);
  1908 + }
1843 } 1909 }
1844 - }  
1845 - _getQuestion(_param) {  
1846 - if (!_mcu.connected) {  
1847 - loger.warn(GlobalConfig.getCurrentStatus());  
1848 - return; 1910 +
  1911 + //暂停录制回放
  1912 + _pauseRecordPlayback(_param) {
  1913 + if (_recordPlayback) {
  1914 + _recordPlayback.pauseRecordPlayback(_param);
  1915 + }
1849 } 1916 }
1850 - if (_questionApe) {  
1851 - _questionApe.getQuestion(_param); 1917 +
  1918 + //seek录制回放
  1919 + _seekRecordPlayback(_param) {
  1920 + if (_recordPlayback) {
  1921 + _recordPlayback.seekRecordPlayback(_param);
  1922 + }
1852 } 1923 }
1853 - }  
1854 - _getQuestionResult(_param) {  
1855 - if (!_mcu.connected) {  
1856 - loger.warn(GlobalConfig.getCurrentStatus());  
1857 - return; 1924 +
  1925 + //录制回放状态更新
  1926 + _recordPlaybackClearDataHandler(_param) {
  1927 + loger.log("录制回放状态更新->")
  1928 + if (_doc_ape) {
  1929 + _doc_ape.clearData();
  1930 + }
  1931 + if (_whiteboard_ape) {
  1932 + _whiteboard_ape.clearData();
  1933 + }
  1934 + if (_video_ape) {
  1935 + _video_ape.clearData();
  1936 + }
1858 } 1937 }
1859 - if (_questionApe) {  
1860 - _questionApe.getQuestionResult(_param); 1938 +
  1939 + //录制回放加入 课堂成功
  1940 + _joinRecordPlaybackSuccessHandler(_data) {
  1941 + loger.log('加入录制回放成功.');
  1942 + GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_2);
  1943 +
  1944 + //返回给客户端初始化成功的数据
  1945 + let joinClassSuccessCallBackData = {};
  1946 +
  1947 + joinClassSuccessCallBackData.isRecordPlayBack = GlobalConfig.isRecordPlayBack;
  1948 +
  1949 + joinClassSuccessCallBackData.DOCServerIP = GlobalConfig.DOCServerIP;
  1950 + joinClassSuccessCallBackData.DOCServerPort = GlobalConfig.DOCServerPort;
  1951 +
  1952 + joinClassSuccessCallBackData.classStatus = GlobalConfig.classStatus;
  1953 + joinClassSuccessCallBackData.classId = GlobalConfig.classId;
  1954 + joinClassSuccessCallBackData.className = GlobalConfig.className;
  1955 + joinClassSuccessCallBackData.h5Module = GlobalConfig.h5Module;
  1956 + joinClassSuccessCallBackData.isHost = GlobalConfig.isHost; //
  1957 + joinClassSuccessCallBackData.maxAudioChannels = GlobalConfig.maxAudioChannels;
  1958 + joinClassSuccessCallBackData.maxVideoChannels = GlobalConfig.maxVideoChannels;
  1959 + joinClassSuccessCallBackData.maxMediaChannels = GlobalConfig.maxMediaChannels;
  1960 +
  1961 + joinClassSuccessCallBackData.mcuDelay = GlobalConfig.mcuDelay;
  1962 +
  1963 + joinClassSuccessCallBackData.msType = GlobalConfig.msType;
  1964 + joinClassSuccessCallBackData.nodeId = GlobalConfig.nodeId;
  1965 + joinClassSuccessCallBackData.password = GlobalConfig.password;
  1966 + joinClassSuccessCallBackData.passwordRequired = GlobalConfig.passwordRequired; // 老师的默认是true
  1967 + //GlobalConfig.passwordRequired 老师的默认是true
  1968 + //GlobalConfig.portal=_data.portal;
  1969 + joinClassSuccessCallBackData.role = GlobalConfig.role;
  1970 + joinClassSuccessCallBackData.siteId = GlobalConfig.siteId;
  1971 + joinClassSuccessCallBackData.topNodeID = GlobalConfig.topNodeID;
  1972 + joinClassSuccessCallBackData.userId = GlobalConfig.userId;
  1973 + joinClassSuccessCallBackData.userName = GlobalConfig.userName;
  1974 + joinClassSuccessCallBackData.userRole = GlobalConfig.userRole;
  1975 + joinClassSuccessCallBackData.userType = GlobalConfig.userType;
  1976 +
  1977 + joinClassSuccessCallBackData.siteId = GlobalConfig.siteId;
  1978 + joinClassSuccessCallBackData.classId = GlobalConfig.classId;
  1979 + joinClassSuccessCallBackData.userRole = GlobalConfig.userRole;
  1980 + joinClassSuccessCallBackData.userId = GlobalConfig.userId;
  1981 + joinClassSuccessCallBackData.passwordRequired = GlobalConfig.passwordRequired;
  1982 + joinClassSuccessCallBackData.classType = GlobalConfig.classType || ApeConsts.CLASS_TYPE_1;
  1983 +
  1984 + joinClassSuccessCallBackData.country = GlobalConfig.country; //国家
  1985 + joinClassSuccessCallBackData.city = GlobalConfig.city; //城市
  1986 + joinClassSuccessCallBackData.province = GlobalConfig.province; //服务商
  1987 + joinClassSuccessCallBackData.isp = GlobalConfig.isp; //服务商
  1988 +
  1989 + joinClassSuccessCallBackData.classTimestamp = GlobalConfig.classTimestamp; //课堂进行的累积时间
  1990 + joinClassSuccessCallBackData.recordTimestamp = GlobalConfig.recordTimestamp; //录制累积的总时间
  1991 + joinClassSuccessCallBackData.recordPlaybackMaxTime = GlobalConfig.recordPlaybackMaxTime; //录制回放的总时间
  1992 +
  1993 + joinClassSuccessCallBackData.fps = GlobalConfig.fps;
  1994 + joinClassSuccessCallBackData.gop = GlobalConfig.gop;
  1995 + joinClassSuccessCallBackData.videoQuality = GlobalConfig.videoQuality;
  1996 +
  1997 + joinClassSuccessCallBackData.ssTunnelAppURL = GlobalConfig.ssTunnelAppURL;
  1998 + joinClassSuccessCallBackData.currentSceneTableId = GlobalConfig.currentSceneTableId; //文档区域的模块显示
  1999 + loger.log(joinClassSuccessCallBackData);
  2000 + //和加入课堂成功使用同样的消息处理
  2001 + this._emit(MessageTypes.CLASS_JOIN_SUCCESS, joinClassSuccessCallBackData);
  2002 + }
  2003 +
  2004 + // //答题卡
  2005 + _creatQuestion(_param) {
  2006 + if (!_mcu.connected) {
  2007 + loger.warn(GlobalConfig.getCurrentStatus());
  2008 + return;
  2009 + }
  2010 + if (_questionApe) {
  2011 + _questionApe.creatQuestion(_param);
  2012 + }
1861 } 2013 }
1862 - }  
1863 - _stopQuestion(_param) {  
1864 - if (!_mcu.connected) {  
1865 - loger.warn(GlobalConfig.getCurrentStatus());  
1866 - return; 2014 + _getQuestion(_param) {
  2015 + if (!_mcu.connected) {
  2016 + loger.warn(GlobalConfig.getCurrentStatus());
  2017 + return;
  2018 + }
  2019 + if (_questionApe) {
  2020 + _questionApe.getQuestion(_param);
  2021 + }
1867 } 2022 }
1868 - if (_questionApe) {  
1869 - _questionApe.stopQuestion(_param); 2023 + _getQuestionResult(_param) {
  2024 + if (!_mcu.connected) {
  2025 + loger.warn(GlobalConfig.getCurrentStatus());
  2026 + return;
  2027 + }
  2028 + if (_questionApe) {
  2029 + _questionApe.getQuestionResult(_param);
  2030 + }
1870 } 2031 }
1871 - }  
1872 - _sendAnswer(_param) {  
1873 - if (!_mcu.connected) {  
1874 - loger.warn(GlobalConfig.getCurrentStatus());  
1875 - return; 2032 + _stopQuestion(_param) {
  2033 + if (!_mcu.connected) {
  2034 + loger.warn(GlobalConfig.getCurrentStatus());
  2035 + return;
  2036 + }
  2037 + if (_questionApe) {
  2038 + _questionApe.stopQuestion(_param);
  2039 + }
1876 } 2040 }
1877 - if (_questionApe) {  
1878 - _questionApe.sendAnswer(_param); 2041 + _sendAnswer(_param) {
  2042 + if (!_mcu.connected) {
  2043 + loger.warn(GlobalConfig.getCurrentStatus());
  2044 + return;
  2045 + }
  2046 + if (_questionApe) {
  2047 + _questionApe.sendAnswer(_param);
  2048 + }
1879 } 2049 }
1880 - }  
1881 2050
1882 -} 2051 + }
1883 2052
@@ -37,7 +37,7 @@ class EngineUtils{ @@ -37,7 +37,7 @@ class EngineUtils{
37 37
38 //生成时间戳毫秒 38 //生成时间戳毫秒
39 static creatTimestamp(){ 39 static creatTimestamp(){
40 - let time = parseInt(new Date().getTime()/1000);//精确到 40 + let time = parseInt(new Date().getTime()/1000);//精确到秒
41 return time; 41 return time;
42 } 42 }
43 //生成时间戳 string 43 //生成时间戳 string
@@ -460,6 +460,7 @@ GlobalConfig.allowRecordMaxTime = 14400; //(秒)允许录制的最长时间, @@ -460,6 +460,7 @@ GlobalConfig.allowRecordMaxTime = 14400; //(秒)允许录制的最长时间,
460 460
461 GlobalConfig.siteId_letv = 'shchuanbao'; //乐视,MS不需要动态选点的站点 461 GlobalConfig.siteId_letv = 'shchuanbao'; //乐视,MS不需要动态选点的站点
462 GlobalConfig.ssTunnelAppURL = ''; //屏幕共享插件的地址 462 GlobalConfig.ssTunnelAppURL = ''; //屏幕共享插件的地址
463 - 463 +GlobalConfig.serverTime = 0; //服务器当前时间戳
  464 +GlobalConfig.serverAndLoacTimeDistanc = 0; //本地时间和服务器时间错的差值;
464 export default GlobalConfig; 465 export default GlobalConfig;
465 466
@@ -89,15 +89,11 @@ MessageTypes.DOC_BROADCAST = "doc_broadcast"; // @@ -89,15 +89,11 @@ MessageTypes.DOC_BROADCAST = "doc_broadcast"; //
89 MessageTypes.MEDIA_SHARED_DELETE = "media_shared_delete"; //删除媒体文件 89 MessageTypes.MEDIA_SHARED_DELETE = "media_shared_delete"; //删除媒体文件
90 MessageTypes.MEDIA_SHARED_UPDATE = "media_shared_update"; //更新媒体文件(添加、变更) 90 MessageTypes.MEDIA_SHARED_UPDATE = "media_shared_update"; //更新媒体文件(添加、变更)
91 91
92 -//答题卡 92 +//答题卡和点名共用
93 MessageTypes.START_ANSWER_QUESTION = "start_answer_question"; //开始答题 93 MessageTypes.START_ANSWER_QUESTION = "start_answer_question"; //开始答题
94 MessageTypes.UPDATE_ANSWER_QUESTION = "update_answer_question"; //更新答题数据 94 MessageTypes.UPDATE_ANSWER_QUESTION = "update_answer_question"; //更新答题数据
95 MessageTypes.STOP_ANSWER_QUESTION = "stop_answer_question"; //停止答题 95 MessageTypes.STOP_ANSWER_QUESTION = "stop_answer_question"; //停止答题
96 -  
97 -//点名  
98 -MessageTypes.START_CALL_THE_ROLL = "start_call_the_roll"; //开始点名  
99 -MessageTypes.UPDATE_CALL_THE_ROLL = "update_call_the_roll"; //更新点名数据  
100 -MessageTypes.STOP_CALL_THE_ROLL = "stop_call_the_roll"; //停止点名 96 +MessageTypes.UPDATE_QUESTION_TIME = "update_question_time"; //更新答题时间
101 97
102 //白板笔记事件定义 98 //白板笔记事件定义
103 MessageTypes.WHITEBOARD_ANNOTATION_UPDATE = "whiteboard_annotation_update"; // 'whiteboard.annotation.update'; 99 MessageTypes.WHITEBOARD_ANNOTATION_UPDATE = "whiteboard_annotation_update"; // 'whiteboard.annotation.update';
@@ -23,8 +23,10 @@ class QuestionApe extends Ape { @@ -23,8 +23,10 @@ class QuestionApe extends Ape {
23 ApeConsts.QUESTION_SESSION_NAME, 23 ApeConsts.QUESTION_SESSION_NAME,
24 ApeConsts.QUESTION_SESSION_TAG 24 ApeConsts.QUESTION_SESSION_TAG
25 ); 25 );
  26 +
26 this.questionList={};//MCU同步的题目数据 27 this.questionList={};//MCU同步的题目数据
27 - this.questionDataList={};//Sass保存的题目内容数据 28 + this.questionTimer=new TimerCounter();//答题卡计时器
  29 + this.questionTimer.addTimerCallBack(this.questionTimerCounterUptate.bind(this), 1);//计时器监听
28 30
29 //监听Sass事件 31 //监听Sass事件
30 this._sass=Sass; 32 this._sass=Sass;
@@ -47,6 +49,34 @@ class QuestionApe extends Ape { @@ -47,6 +49,34 @@ class QuestionApe extends Ape {
47 this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.CONFERENCE_OBJ_QUESTION_ID, 49 this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.CONFERENCE_OBJ_QUESTION_ID,
48 ApeConsts.CONFERENCE_OBJ_QUESTION_NAME, ApeConsts.CONFERENCE_OBJ_QUESTION_TAG, 0, new ArrayBuffer); 50 ApeConsts.CONFERENCE_OBJ_QUESTION_NAME, ApeConsts.CONFERENCE_OBJ_QUESTION_TAG, 0, new ArrayBuffer);
49 } 51 }
  52 + //答题卡计时器
  53 + questionTimerCounterUptate() {
  54 + if (!this.mcu.connected) {
  55 + loger.warn('MCU 连接已经断开');
  56 + if(this.questionTimer){
  57 + this.questionTimer.stopTimer();
  58 + }
  59 + }
  60 + //console.log("时间差:"+GlobalConfig.serverAndLoacTimeDistanc+' questionTimerCounterUptate',this.questionList);
  61 + for(let key in this.questionList){
  62 + let question=this.questionList[key];
  63 + if(question){
  64 + let currentTime=EngineUtils.creatTimestamp()-GlobalConfig.serverAndLoacTimeDistanc;//将当的时间减去服务器时间差
  65 +
  66 + let timestamp=parseInt(question.timeLimit-(currentTime-question.timestamp));
  67 + if(timestamp>=0){
  68 + loger.log("question->type:"+question.type,"倒计时:"+timestamp);
  69 + this._emit(MessageTypes.UPDATE_QUESTION_TIME,{type:question.type,itemIdx:question.itemIdx,timestamp:timestamp});
  70 + }else {
  71 + this.stopQuestion({itemIdx:question.itemIdx});
  72 + }
  73 +
  74 + }
  75 + }
  76 + if( this.questionTimer&&Object.keys(this.questionList).length<1){
  77 + this.questionTimer.stopTimer();
  78 + }
  79 + }
50 80
51 //更新信息 81 //更新信息
52 sendUpdaterTable(_param) { 82 sendUpdaterTable(_param) {
@@ -140,34 +170,33 @@ class QuestionApe extends Ape { @@ -140,34 +170,33 @@ class QuestionApe extends Ape {
140 //停止答题 170 //停止答题
141 loger.log("更新答题数据"); 171 loger.log("更新答题数据");
142 if(GlobalConfig.isHost){ 172 if(GlobalConfig.isHost){
143 - //老师,只统计数据,不答题  
144 - //先判断时间是否超时  
145 - let timeDistance=EngineUtils.creatTimestamp()-model.timestamp;  
146 - loger.log("答题卡显示倒计时->timeDistance:"+timeDistance);  
147 - timeDistance=model.timeLimit-timeDistance;  
148 - if(timeDistance<=0){  
149 - //答题卡时间到,需要停止  
150 - loger.log("答题卡时间到->需要停止");  
151 - this.stopQuestion(model);  
152 - }else {  
153 - this.getQuestionResult(model);  
154 - }  
155 - 173 + ////老师,只统计数据,不答题
  174 + ////先判断时间是否超时
  175 + //let timeDistance=EngineUtils.creatTimestamp()-model.timestamp;
  176 + //loger.log("答题卡显示倒计时->timeDistance:"+timeDistance);
  177 + //timeDistance=model.timeLimit-timeDistance;
  178 + //if(timeDistance<=0){
  179 + // //答题卡时间到,需要停止
  180 + // loger.log("答题卡时间到->需要停止");
  181 + // this.stopQuestion(model);
  182 + //}else {
  183 + // this.getQuestionResult(model);
  184 + //}
  185 + this.getQuestionResult(model);
156 }else if(GlobalConfig.isNormal) { 186 }else if(GlobalConfig.isNormal) {
157 //学生->如果自己已经提交过答案就不需要再显示 187 //学生->如果自己已经提交过答案就不需要再显示
158 if(model.totalUserList.indexOf(GlobalConfig.userId)>=0){ 188 if(model.totalUserList.indexOf(GlobalConfig.userId)>=0){
159 loger.log("已经提交过答案-不需要显示答题卡->userId:"+GlobalConfig.userId); 189 loger.log("已经提交过答案-不需要显示答题卡->userId:"+GlobalConfig.userId);
  190 + //delete this.questionList[itemIdx];
160 }else { 191 }else {
161 //显示答题卡数据 192 //显示答题卡数据
162 this._emit(MessageTypes.START_ANSWER_QUESTION,model); 193 this._emit(MessageTypes.START_ANSWER_QUESTION,model);
163 } 194 }
164 } 195 }
  196 + if( this.questionTimer){
  197 + this.questionTimer.startTimer();
  198 + }
165 break; 199 break;
166 - //case 4:  
167 - // //停止点名  
168 - // loger.log("更新点名数据");  
169 - // this._emit(MessageTypes.UPDATE_CALL_THE_ROLL,model);  
170 - // break;  
171 default : 200 default :
172 break; 201 break;
173 } 202 }
@@ -191,15 +220,17 @@ class QuestionApe extends Ape { @@ -191,15 +220,17 @@ class QuestionApe extends Ape {
191 case 1: 220 case 1:
192 case 2: 221 case 2:
193 case 3: 222 case 3:
  223 + case 4:
  224 + case 100:
194 //停止答题 225 //停止答题
195 loger.log("停止答题->",itemDataInfo); 226 loger.log("停止答题->",itemDataInfo);
196 this._emit(MessageTypes.STOP_ANSWER_QUESTION,itemDataInfo); 227 this._emit(MessageTypes.STOP_ANSWER_QUESTION,itemDataInfo);
197 break; 228 break;
198 - case 4:  
199 - //停止点名  
200 - loger.log("停止点名");  
201 - this._emit(MessageTypes.STOP_CALL_THE_ROLL,itemDataInfo);  
202 - break; 229 + //case 100:
  230 + // //停止点名
  231 + // loger.log("停止点名");
  232 + // this._emit(MessageTypes.STOP_CALL_THE_ROLL,itemDataInfo);
  233 + // break;
203 default : 234 default :
204 break; 235 break;
205 } 236 }
@@ -234,7 +265,7 @@ class QuestionApe extends Ape { @@ -234,7 +265,7 @@ class QuestionApe extends Ape {
234 modelPdu.type = parseInt(_param.type)||0; 265 modelPdu.type = parseInt(_param.type)||0;
235 modelPdu.questionId= parseInt(_param.questionId)||0; 266 modelPdu.questionId= parseInt(_param.questionId)||0;
236 modelPdu.timeLimit= parseInt(_param.timeLimit)||1;//有效时间 267 modelPdu.timeLimit= parseInt(_param.timeLimit)||1;//有效时间
237 - modelPdu.timestamp= parseInt(_param.timestamp)||EngineUtils.creatTimestamp();//创建的时间 268 + modelPdu.timestamp= parseInt(_param.timestamp)||parseInt(EngineUtils.creatTimestamp()- GlobalConfig.serverAndLoacTimeDistanc);;//创建的时间(秒)
238 modelPdu.content= _param.content||[];//题干 269 modelPdu.content= _param.content||[];//题干
239 modelPdu.options= _param.options||[];//选项列表 270 modelPdu.options= _param.options||[];//选项列表
240 modelPdu.answer= _param.answer||[];//用户选择的选项索引 271 modelPdu.answer= _param.answer||[];//用户选择的选项索引
@@ -352,16 +383,11 @@ class QuestionApe extends Ape { @@ -352,16 +383,11 @@ class QuestionApe extends Ape {
352 _sassCreatQuestionSuccessHandler(_data){ 383 _sassCreatQuestionSuccessHandler(_data){
353 //loger.log("创建答题卡成功",_data); 384 //loger.log("创建答题卡成功",_data);
354 if(_data){ 385 if(_data){
355 - //this.questionDataList[_data.questionId]=_data;//保存题目数据  
356 - 386 + //获取当前对方系统时间,再减去服务器时间差
  387 + let timestamp=parseInt(EngineUtils.creatTimestamp()- GlobalConfig.serverAndLoacTimeDistanc);//创建答题卡的时间(秒)
357 let questionItem=_data; 388 let questionItem=_data;
358 - /* //判断是答题还是点名,type=100的时候是点名  
359 - if(questionItem.type==100){  
360 - questionItem.itemIdx=ApeConsts.CONFERENCE_OBJ_QUESTION_ID+1;  
361 - }else {  
362 - questionItem.itemIdx=ApeConsts.CONFERENCE_OBJ_QUESTION_ID;  
363 - }*/  
364 - questionItem.itemIdx=EngineUtils.creatTimestamp(); 389 + questionItem.itemIdx=timestamp;
  390 + questionItem.timestamp=timestamp;
365 this.sendUpdaterTable(questionItem); 391 this.sendUpdaterTable(questionItem);
366 } 392 }
367 393