1.新增添加和删除外部流地址的接口;2.新增的外部流地址数据显示和储存按文档数据处理;type类型为video,可以删除;3.文档数据模块增加4个流地址字段;
正在显示
8 个修改的文件
包含
636 行增加
和
329 行删除
| @@ -62,19 +62,19 @@ export default class MessageEntrance extends Emiter { | @@ -62,19 +62,19 @@ export default class MessageEntrance extends Emiter { | ||
| 62 | constructor() { | 62 | constructor() { |
| 63 | super(); | 63 | super(); |
| 64 | //sdk 信息 | 64 | //sdk 信息 |
| 65 | - GlobalConfig.sdkVersion = "v2.21.3.20171024"; | 65 | + GlobalConfig.sdkVersion = "v2.22.7.20171026"; |
| 66 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); | 66 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); |
| 67 | console.log("sdkVersion:" + GlobalConfig.sdkVersion); | 67 | console.log("sdkVersion:" + GlobalConfig.sdkVersion); |
| 68 | //设置 | 68 | //设置 |
| 69 | - let locationProtocol= location.protocol; | ||
| 70 | - if(locationProtocol=="https:"){ | ||
| 71 | - GlobalConfig.isHttps=true; | ||
| 72 | - GlobalConfig.locationProtocol="https://"; | ||
| 73 | - GlobalConfig.websocketProtocol="wss://"; | ||
| 74 | - }else { | ||
| 75 | - GlobalConfig.isHttps=false; | ||
| 76 | - GlobalConfig.locationProtocol="http://"; | ||
| 77 | - GlobalConfig.websocketProtocol="ws://"; | 69 | + let locationProtocol = location.protocol; |
| 70 | + if (locationProtocol == "https:") { | ||
| 71 | + GlobalConfig.isHttps = true; | ||
| 72 | + GlobalConfig.locationProtocol = "https://"; | ||
| 73 | + GlobalConfig.websocketProtocol = "wss://"; | ||
| 74 | + } else { | ||
| 75 | + GlobalConfig.isHttps = false; | ||
| 76 | + GlobalConfig.locationProtocol = "http://"; | ||
| 77 | + GlobalConfig.websocketProtocol = "ws://"; | ||
| 78 | } | 78 | } |
| 79 | loger.warn("protocol:" + GlobalConfig.locationProtocol); | 79 | loger.warn("protocol:" + GlobalConfig.locationProtocol); |
| 80 | //获取设备和系统信息 | 80 | //获取设备和系统信息 |
| @@ -91,12 +91,12 @@ export default class MessageEntrance extends Emiter { | @@ -91,12 +91,12 @@ export default class MessageEntrance extends Emiter { | ||
| 91 | this.isGetFastestRtmpPullCallback = false; //是否RTMP拉流地址测试结束 | 91 | this.isGetFastestRtmpPullCallback = false; //是否RTMP拉流地址测试结束 |
| 92 | this.isGetFastestHlsPullCallback = false; //是否HLS拉流地址测试结束 | 92 | this.isGetFastestHlsPullCallback = false; //是否HLS拉流地址测试结束 |
| 93 | this.isGetFastestRsCallback = false; //是否录制回放HLS拉流地址测试结束 | 93 | this.isGetFastestRsCallback = false; //是否录制回放HLS拉流地址测试结束 |
| 94 | - this.saveClassStatusTimer=0;//保存课堂数据的计时器间隔,防止同一瞬间多次提交 | ||
| 95 | - this.joinChannelTimer=0;//加入音视频通道的间隔 | 94 | + this.saveClassStatusTimer = 0;//保存课堂数据的计时器间隔,防止同一瞬间多次提交 |
| 95 | + this.joinChannelTimer = 0;//加入音视频通道的间隔 | ||
| 96 | //全局的Error处理 | 96 | //全局的Error处理 |
| 97 | this.on(MessageTypes.MCU_ERROR, this._mcuErrorHandler.bind(this)); | 97 | this.on(MessageTypes.MCU_ERROR, this._mcuErrorHandler.bind(this)); |
| 98 | 98 | ||
| 99 | - _webRtc=WebRtcApe; | 99 | + _webRtc = WebRtcApe; |
| 100 | _webRtc.on('*', (type, data) => this._emit(type, data)); | 100 | _webRtc.on('*', (type, data) => this._emit(type, data)); |
| 101 | _webRtc.on(MessageTypes.USER_DEVICE_STATUS_CHAANGE, this.userDeviecStatusChange.bind(this)); //监听摄像头和麦克风的开启状态 | 101 | _webRtc.on(MessageTypes.USER_DEVICE_STATUS_CHAANGE, this.userDeviecStatusChange.bind(this)); //监听摄像头和麦克风的开启状态 |
| 102 | _webRtc.on(MessageTypes.MEDIA_PUBLISH_STATUS_CHANGE, this.mediaPublishStatusChange.bind(this)); //webRtc推流状态发生改变 | 102 | _webRtc.on(MessageTypes.MEDIA_PUBLISH_STATUS_CHANGE, this.mediaPublishStatusChange.bind(this)); //webRtc推流状态发生改变 |
| @@ -107,7 +107,7 @@ export default class MessageEntrance extends Emiter { | @@ -107,7 +107,7 @@ export default class MessageEntrance extends Emiter { | ||
| 107 | _sass.on(_sass.SUCCESS, this._sassJoinSuccessHandler.bind(this)); //通过SASS平台验证(密码和MD5) | 107 | _sass.on(_sass.SUCCESS, this._sassJoinSuccessHandler.bind(this)); //通过SASS平台验证(密码和MD5) |
| 108 | _sass.on(_sass.CLASS_INIT_SUCCESS, this._sassInitSuccessHandler.bind(this)); //获取课堂初始化信息 | 108 | _sass.on(_sass.CLASS_INIT_SUCCESS, this._sassInitSuccessHandler.bind(this)); //获取课堂初始化信息 |
| 109 | //_sass.on(_sass.CLASS_GET_CLASS_DETAIL, this._sassGetClassDetailSuccessHandler.bind(this));//获取课堂的基本信息 | 109 | //_sass.on(_sass.CLASS_GET_CLASS_DETAIL, this._sassGetClassDetailSuccessHandler.bind(this));//获取课堂的基本信息 |
| 110 | - _sass.on(_sass.CLASS_GET_CLASS_PARAM, this._sassGetClassParamSuccessHandler.bind(this)); //获取课堂的最全信息和历史保存的数据 | 110 | + _sass.on(_sass.CLASS_GET_CLASS_PARAM, this._sassGetClassParamSuccessHandler.bind(this)); //SAAS获取课堂的最全信息和历史保存的数据 |
| 111 | 111 | ||
| 112 | _sass.on(_sass.CLASS_SAVE_STATUS_INFO_SUCCESS, this._sassSaveClassStatusInfoSuccessHandler.bind(this)); //保存课堂状态信息 | 112 | _sass.on(_sass.CLASS_SAVE_STATUS_INFO_SUCCESS, this._sassSaveClassStatusInfoSuccessHandler.bind(this)); //保存课堂状态信息 |
| 113 | _sass.on(_sass.CLASS_SAVE_RECORD_INFO_SUCCESS, this._sassSaveClassRecordInfoSuccessHandler.bind(this)); //保存课堂录制信息 | 113 | _sass.on(_sass.CLASS_SAVE_RECORD_INFO_SUCCESS, this._sassSaveClassRecordInfoSuccessHandler.bind(this)); //保存课堂录制信息 |
| @@ -117,7 +117,7 @@ export default class MessageEntrance extends Emiter { | @@ -117,7 +117,7 @@ export default class MessageEntrance extends Emiter { | ||
| 117 | 117 | ||
| 118 | //选点模块 | 118 | //选点模块 |
| 119 | _ipManager = new IpManager(); | 119 | _ipManager = new IpManager(); |
| 120 | - _base64=new Base64Module(); | 120 | + _base64 = new Base64Module(); |
| 121 | 121 | ||
| 122 | // 底层MCU消息层 | 122 | // 底层MCU消息层 |
| 123 | _mcu = Mcu; | 123 | _mcu = Mcu; |
| @@ -148,7 +148,7 @@ export default class MessageEntrance extends Emiter { | @@ -148,7 +148,7 @@ export default class MessageEntrance extends Emiter { | ||
| 148 | //_confer_ape.on(MessageTypes.SWITCH_RTMP_PULL_IP, this._switchRtmpPullIpHandler.bind(this)); //MS 拉流地址动态选点 | 148 | //_confer_ape.on(MessageTypes.SWITCH_RTMP_PULL_IP, this._switchRtmpPullIpHandler.bind(this)); //MS 拉流地址动态选点 |
| 149 | //_confer_ape.on(MessageTypes.SWITCH_HLS_IP, this._switchHlsIpHandler.bind(this)); //MS HLS动态选点 | 149 | //_confer_ape.on(MessageTypes.SWITCH_HLS_IP, this._switchHlsIpHandler.bind(this)); //MS HLS动态选点 |
| 150 | _confer_ape.on(MessageTypes.STOP_ALL_MEDIA_PUBLISH, this._stopAllMediaPublishHandler.bind(this)); //课堂状态发生改变,需要停止当前的所有推流 | 150 | _confer_ape.on(MessageTypes.STOP_ALL_MEDIA_PUBLISH, this._stopAllMediaPublishHandler.bind(this)); //课堂状态发生改变,需要停止当前的所有推流 |
| 151 | - _confer_ape.on(MessageTypes.CLASS_UPDATE_ROSTER,this._onRosterUpdateHandler.bind(this)); | 151 | + _confer_ape.on(MessageTypes.CLASS_UPDATE_ROSTER, this._onRosterUpdateHandler.bind(this)); |
| 152 | 152 | ||
| 153 | _chat_ape = new ChatApe(); | 153 | _chat_ape = new ChatApe(); |
| 154 | _chat_ape.on('*', (type, data) => this._emit(type, data)); | 154 | _chat_ape.on('*', (type, data) => this._emit(type, data)); |
| @@ -222,6 +222,10 @@ export default class MessageEntrance extends Emiter { | @@ -222,6 +222,10 @@ export default class MessageEntrance extends Emiter { | ||
| 222 | this.publishScreenShare = this._publishScreenShare.bind(this); | 222 | this.publishScreenShare = this._publishScreenShare.bind(this); |
| 223 | this.stopPublishScreenShare = this._stopPublishScreenShare.bind(this); | 223 | this.stopPublishScreenShare = this._stopPublishScreenShare.bind(this); |
| 224 | 224 | ||
| 225 | + //推送外部流 | ||
| 226 | + this.publishExternalLink = this._publishExternalLink.bind(this); | ||
| 227 | + this.stopPublishExternalLink = this._stopPublishExternalLink.bind(this); | ||
| 228 | + | ||
| 225 | //videoApe | 229 | //videoApe |
| 226 | this.getVideoPublishPath = this._getVideoPublishPath.bind(this); | 230 | this.getVideoPublishPath = this._getVideoPublishPath.bind(this); |
| 227 | this.getVideoAllChannelInfo = this._getVideoAllChannelInfo.bind(this); | 231 | this.getVideoAllChannelInfo = this._getVideoAllChannelInfo.bind(this); |
| @@ -261,7 +265,7 @@ export default class MessageEntrance extends Emiter { | @@ -261,7 +265,7 @@ export default class MessageEntrance extends Emiter { | ||
| 261 | //获取文档图片的完整路径 | 265 | //获取文档图片的完整路径 |
| 262 | this.getDocPDFFullPath = this._getDocPDFFullPath.bind(this); //获取文档的完整路径 | 266 | this.getDocPDFFullPath = this._getDocPDFFullPath.bind(this); //获取文档的完整路径 |
| 263 | this.getDocFullAddress = this._getDocFullAddress.bind(this); //获取文档资源地址 | 267 | this.getDocFullAddress = this._getDocFullAddress.bind(this); //获取文档资源地址 |
| 264 | - this.hideCurrentDocument=this._hideCurrentDocument.bind(this);//隐藏当前显示的文档 | 268 | + this.hideCurrentDocument = this._hideCurrentDocument.bind(this);//隐藏当前显示的文档 |
| 265 | this.switchToWhiteboard = this._switchToWhiteboard.bind(this); //切换到白板文档 | 269 | this.switchToWhiteboard = this._switchToWhiteboard.bind(this); //切换到白板文档 |
| 266 | //媒体共享模块 | 270 | //媒体共享模块 |
| 267 | this.mediaSharedUpload = this._sendMediaSharedUpload.bind(this); //上传 | 271 | this.mediaSharedUpload = this._sendMediaSharedUpload.bind(this); //上传 |
| @@ -287,19 +291,19 @@ export default class MessageEntrance extends Emiter { | @@ -287,19 +291,19 @@ export default class MessageEntrance extends Emiter { | ||
| 287 | this.stopQuestion = this._stopQuestion.bind(this); | 291 | this.stopQuestion = this._stopQuestion.bind(this); |
| 288 | 292 | ||
| 289 | //webrtc | 293 | //webrtc |
| 290 | - this.publishMedia=this._publishMedia.bind(this); | ||
| 291 | - this.unpublishMedia=this._unpublishMedia.bind(this); | ||
| 292 | - this.changeDevices=this._changeDevices.bind(this); | ||
| 293 | - this.setConfigPublisher=this._setConfigPublisher.bind(this); | ||
| 294 | - this.setLocalMediaView=this._setLocalMediaView.bind(this);//设置自己的视图 | ||
| 295 | - this.setHostRemoteMediaView=this._setHostRemoteMediaView.bind(this);//设置远程老师的视图 | ||
| 296 | - this.setNormalRemoteMediaView=this._setNormalRemoteMediaView.bind(this);//设置远程学生的视图 | ||
| 297 | - this.setInvisibleMediaView=this._setInvisibleMediaView.bind(this);//设置监课身份的视图 | 294 | + this.publishMedia = this._publishMedia.bind(this); |
| 295 | + this.unpublishMedia = this._unpublishMedia.bind(this); | ||
| 296 | + this.changeDevices = this._changeDevices.bind(this); | ||
| 297 | + this.setConfigPublisher = this._setConfigPublisher.bind(this); | ||
| 298 | + this.setLocalMediaView = this._setLocalMediaView.bind(this);//设置自己的视图 | ||
| 299 | + this.setHostRemoteMediaView = this._setHostRemoteMediaView.bind(this);//设置远程老师的视图 | ||
| 300 | + this.setNormalRemoteMediaView = this._setNormalRemoteMediaView.bind(this);//设置远程学生的视图 | ||
| 301 | + this.setInvisibleMediaView = this._setInvisibleMediaView.bind(this);//设置监课身份的视图 | ||
| 298 | 302 | ||
| 299 | - this.setAppConfig=this._setAppConfig.bind(this); | ||
| 300 | - this.recordControl=this._mediaRecordControl.bind(this); | 303 | + this.setAppConfig = this._setAppConfig.bind(this); |
| 304 | + this.recordControl = this._mediaRecordControl.bind(this); | ||
| 301 | 305 | ||
| 302 | - this.changeRtcVideoConfig=this._changeRtcVideoConfig.bind(this);//设置webRtc视频视图的缩放 | 306 | + this.changeRtcVideoConfig = this._changeRtcVideoConfig.bind(this);//设置webRtc视频视图的缩放 |
| 303 | 307 | ||
| 304 | this.setDeviceInfo = this._setDeviceInfo.bind(this); //设置设备信息(麦克风,摄像头等等.....) | 308 | this.setDeviceInfo = this._setDeviceInfo.bind(this); //设置设备信息(麦克风,摄像头等等.....) |
| 305 | this.setMessageDelay = this._setMessageDelay.bind(this); //设置是否延迟消息 | 309 | this.setMessageDelay = this._setMessageDelay.bind(this); //设置是否延迟消息 |
| @@ -314,7 +318,12 @@ export default class MessageEntrance extends Emiter { | @@ -314,7 +318,12 @@ export default class MessageEntrance extends Emiter { | ||
| 314 | this.addWarn = this._addWarn.bind(this); | 318 | this.addWarn = this._addWarn.bind(this); |
| 315 | this.addError = this._addError.bind(this); | 319 | this.addError = this._addError.bind(this); |
| 316 | 320 | ||
| 317 | - this.hasFreePublishChannel=this._hasFreePublishChannel.bind(this);//判断是否还有空闲的推流通道 | 321 | + this.hasFreePublishChannel = this._hasFreePublishChannel.bind(this);//判断是否还有空闲的推流通道 |
| 322 | + | ||
| 323 | + | ||
| 324 | + //添加外部流数据和删除外部流数据 | ||
| 325 | + this.deleteMediaExternalLink=this._deleteMediaExternalLink.bind(this); | ||
| 326 | + this.addMediaExternalLink=this._addMediaExternalLink.bind(this); | ||
| 318 | } | 327 | } |
| 319 | 328 | ||
| 320 | //设置是否输出日志 | 329 | //设置是否输出日志 |
| @@ -337,21 +346,21 @@ export default class MessageEntrance extends Emiter { | @@ -337,21 +346,21 @@ export default class MessageEntrance extends Emiter { | ||
| 337 | //上传log日志 | 346 | //上传log日志 |
| 338 | _addLog(_data) { | 347 | _addLog(_data) { |
| 339 | if (_data) { | 348 | if (_data) { |
| 340 | - LogManager.addLog(LogManager.LOG, _data.msg||""); | 349 | + LogManager.addLog(LogManager.LOG, _data.msg || ""); |
| 341 | } | 350 | } |
| 342 | } | 351 | } |
| 343 | 352 | ||
| 344 | //上传warn日志 | 353 | //上传warn日志 |
| 345 | _addWarn(_data) { | 354 | _addWarn(_data) { |
| 346 | if (_data) { | 355 | if (_data) { |
| 347 | - LogManager.addLog(LogManager.WARN, _data.msg||""); | 356 | + LogManager.addLog(LogManager.WARN, _data.msg || ""); |
| 348 | } | 357 | } |
| 349 | } | 358 | } |
| 350 | 359 | ||
| 351 | //上传error日志 | 360 | //上传error日志 |
| 352 | _addError(_data) { | 361 | _addError(_data) { |
| 353 | if (_data) { | 362 | if (_data) { |
| 354 | - LogManager.addLog(LogManager.ERROR, _data.msg||""); | 363 | + LogManager.addLog(LogManager.ERROR, _data.msg || ""); |
| 355 | } | 364 | } |
| 356 | } | 365 | } |
| 357 | 366 | ||
| @@ -434,7 +443,7 @@ export default class MessageEntrance extends Emiter { | @@ -434,7 +443,7 @@ export default class MessageEntrance extends Emiter { | ||
| 434 | //当前的课堂状态信息发生改变,需要保存课堂状态到Sass | 443 | //当前的课堂状态信息发生改变,需要保存课堂状态到Sass |
| 435 | _onClassStatusInfoChange(_param) { | 444 | _onClassStatusInfoChange(_param) { |
| 436 | //如果MCU连接已经断开,不发送 | 445 | //如果MCU连接已经断开,不发送 |
| 437 | - if (!_mcu||!_mcu.connected) { | 446 | + if (!_mcu || !_mcu.connected) { |
| 438 | loger.warn("不能保存课堂状态", GlobalConfig.getCurrentStatus()); | 447 | loger.warn("不能保存课堂状态", GlobalConfig.getCurrentStatus()); |
| 439 | return; | 448 | return; |
| 440 | } | 449 | } |
| @@ -443,7 +452,7 @@ export default class MessageEntrance extends Emiter { | @@ -443,7 +452,7 @@ export default class MessageEntrance extends Emiter { | ||
| 443 | 452 | ||
| 444 | //如果是第一次点击开始上课,需要创建录制时的文件名 | 453 | //如果是第一次点击开始上课,需要创建录制时的文件名 |
| 445 | _onClassRecordStart(_param) { | 454 | _onClassRecordStart(_param) { |
| 446 | - if (!_mcu||!_mcu.connected) { | 455 | + if (!_mcu || !_mcu.connected) { |
| 447 | loger.warn("不能保存课堂状态", GlobalConfig.getCurrentStatus()); | 456 | loger.warn("不能保存课堂状态", GlobalConfig.getCurrentStatus()); |
| 448 | return; | 457 | return; |
| 449 | } | 458 | } |
| @@ -463,7 +472,7 @@ export default class MessageEntrance extends Emiter { | @@ -463,7 +472,7 @@ export default class MessageEntrance extends Emiter { | ||
| 463 | 472 | ||
| 464 | //录制状态发送改变,更新所有模块的当前数据发送到MCU | 473 | //录制状态发送改变,更新所有模块的当前数据发送到MCU |
| 465 | updaterRecordAllApeStatus(_param) { | 474 | updaterRecordAllApeStatus(_param) { |
| 466 | - if(GlobalConfig.isRecordPlayBack||!_confer_ape){ | 475 | + if (GlobalConfig.isRecordPlayBack || !_confer_ape) { |
| 467 | return; | 476 | return; |
| 468 | } | 477 | } |
| 469 | //老师身份和非录制回放的时候执行,录制状态发送改变,需要更新当前的数据,否则已有的消息会录制不上 | 478 | //老师身份和非录制回放的时候执行,录制状态发送改变,需要更新当前的数据,否则已有的消息会录制不上 |
| @@ -496,17 +505,18 @@ export default class MessageEntrance extends Emiter { | @@ -496,17 +505,18 @@ export default class MessageEntrance extends Emiter { | ||
| 496 | _onClassDeleteRoster(_data) { | 505 | _onClassDeleteRoster(_data) { |
| 497 | 506 | ||
| 498 | } | 507 | } |
| 508 | + | ||
| 499 | //人员更新 | 509 | //人员更新 |
| 500 | - _onClassUpdateRoster(_data){ | ||
| 501 | - if(!_data){ | 510 | + _onClassUpdateRoster(_data) { |
| 511 | + if (!_data) { | ||
| 502 | return; | 512 | return; |
| 503 | } | 513 | } |
| 504 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2||GlobalConfig.deviceType==3||_data.nodeId==GlobalConfig.nodeId){ | 514 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2 || GlobalConfig.deviceType == 3 || _data.nodeId == GlobalConfig.nodeId) { |
| 505 | return; | 515 | return; |
| 506 | } | 516 | } |
| 507 | - if(_webRtc){ | ||
| 508 | - let user=GlobalConfig.rosters[_data.nodeId]; | ||
| 509 | - if(user&&user.openCamera==0){ | 517 | + if (_webRtc) { |
| 518 | + let user = GlobalConfig.rosters[_data.nodeId]; | ||
| 519 | + if (user && user.openCamera == 0) { | ||
| 510 | _webRtc.closeRemoteVideoView(_data); | 520 | _webRtc.closeRemoteVideoView(_data); |
| 511 | } | 521 | } |
| 512 | } | 522 | } |
| @@ -559,14 +569,14 @@ export default class MessageEntrance extends Emiter { | @@ -559,14 +569,14 @@ export default class MessageEntrance extends Emiter { | ||
| 559 | //保存参数 | 569 | //保存参数 |
| 560 | GlobalConfig.isRecordPlayBack = false; //设置为非录制回放状态 | 570 | GlobalConfig.isRecordPlayBack = false; //设置为非录制回放状态 |
| 561 | GlobalConfig.classId = parseInt(_param.classId); | 571 | GlobalConfig.classId = parseInt(_param.classId); |
| 562 | - GlobalConfig.portal = _param.portal||""; | ||
| 563 | - GlobalConfig.openFlash=Boolean(_param.openFlash); | ||
| 564 | - if(GlobalConfig.isHttps==true){ | 572 | + GlobalConfig.portal = _param.portal || ""; |
| 573 | + GlobalConfig.openFlash = Boolean(_param.openFlash); | ||
| 574 | + if (GlobalConfig.isHttps == true) { | ||
| 565 | //https的时候替换所有80端口 | 575 | //https的时候替换所有80端口 |
| 566 | - GlobalConfig.portal= GlobalConfig.replacePort(GlobalConfig.portal,":80",""); | 576 | + GlobalConfig.portal = GlobalConfig.replacePort(GlobalConfig.portal, ":80", ""); |
| 567 | } | 577 | } |
| 568 | 578 | ||
| 569 | - GlobalConfig.userId = ""+_param.userId || "0"; | 579 | + GlobalConfig.userId = "" + _param.userId || "0"; |
| 570 | //H5处理 | 580 | //H5处理 |
| 571 | GlobalConfig.isH5 = _param.isH5 || false;//外部传入的参数,是否是H5 | 581 | GlobalConfig.isH5 = _param.isH5 || false;//外部传入的参数,是否是H5 |
| 572 | if (GlobalConfig.isH5 == true) { | 582 | if (GlobalConfig.isH5 == true) { |
| @@ -591,21 +601,21 @@ export default class MessageEntrance extends Emiter { | @@ -591,21 +601,21 @@ export default class MessageEntrance extends Emiter { | ||
| 591 | GlobalConfig.userRole = ApeConsts.normal; | 601 | GlobalConfig.userRole = ApeConsts.normal; |
| 592 | } | 602 | } |
| 593 | //如果没有名字或没有userId的时候,需要随机生成 | 603 | //如果没有名字或没有userId的时候,需要随机生成 |
| 594 | - let timestampStr=new Date().getTime().toString(); | ||
| 595 | - timestampStr=timestampStr.substr(timestampStr.length-4); | ||
| 596 | - if(GlobalConfig.userRole==ApeConsts.host){ | ||
| 597 | - timestampStr="T"+timestampStr; | ||
| 598 | - }else if(GlobalConfig.userRole==ApeConsts.assistant) { | 604 | + let timestampStr = new Date().getTime().toString(); |
| 605 | + timestampStr = timestampStr.substr(timestampStr.length - 4); | ||
| 606 | + if (GlobalConfig.userRole == ApeConsts.host) { | ||
| 607 | + timestampStr = "T" + timestampStr; | ||
| 608 | + } else if (GlobalConfig.userRole == ApeConsts.assistant) { | ||
| 599 | timestampStr = "A" + timestampStr; | 609 | timestampStr = "A" + timestampStr; |
| 600 | - }else if(GlobalConfig.userRole==ApeConsts.presenter){ | ||
| 601 | - timestampStr="P"+timestampStr; | ||
| 602 | - }else { | ||
| 603 | - timestampStr="S"+timestampStr; | 610 | + } else if (GlobalConfig.userRole == ApeConsts.presenter) { |
| 611 | + timestampStr = "P" + timestampStr; | ||
| 612 | + } else { | ||
| 613 | + timestampStr = "S" + timestampStr; | ||
| 604 | } | 614 | } |
| 605 | //如果没有名字,随机起一个名字 | 615 | //如果没有名字,随机起一个名字 |
| 606 | - GlobalConfig.userName = _param.userName ||timestampStr; | 616 | + GlobalConfig.userName = _param.userName || timestampStr; |
| 607 | //如果没有userId或者为"0",随机生成 | 617 | //如果没有userId或者为"0",随机生成 |
| 608 | - if (!GlobalConfig.userId||GlobalConfig.userId == "0") { | 618 | + if (!GlobalConfig.userId || GlobalConfig.userId == "0") { |
| 609 | GlobalConfig.userId = timestampStr; | 619 | GlobalConfig.userId = timestampStr; |
| 610 | } | 620 | } |
| 611 | 621 | ||
| @@ -646,10 +656,10 @@ export default class MessageEntrance extends Emiter { | @@ -646,10 +656,10 @@ export default class MessageEntrance extends Emiter { | ||
| 646 | //loger.log("autoLoginMd5", GlobalConfig.classId, GlobalConfig.userId, GlobalConfig.userRole); | 656 | //loger.log("autoLoginMd5", GlobalConfig.classId, GlobalConfig.userId, GlobalConfig.userRole); |
| 647 | let autoLoginMd5 = MD5("" + GlobalConfig.classId + GlobalConfig.userId + GlobalConfig.userRole); | 657 | let autoLoginMd5 = MD5("" + GlobalConfig.classId + GlobalConfig.userId + GlobalConfig.userRole); |
| 648 | //loger.log("joinClass-GlobalConfig.autoLogin", GlobalConfig.autoLogin, "autoLoginMd5-", autoLoginMd5); | 658 | //loger.log("joinClass-GlobalConfig.autoLogin", GlobalConfig.autoLogin, "autoLoginMd5-", autoLoginMd5); |
| 649 | - if (GlobalConfig.autoLogin && autoLoginMd5 == GlobalConfig.autoLogin||GlobalConfig.isInvisible) { | 659 | + if (GlobalConfig.autoLogin && autoLoginMd5 == GlobalConfig.autoLogin || GlobalConfig.isInvisible) { |
| 650 | // MD5(classId+userId+userRole)==m | 660 | // MD5(classId+userId+userRole)==m |
| 651 | //自动登录,跳过验证流程 | 661 | //自动登录,跳过验证流程 |
| 652 | - loger.log("自动登录->"+GlobalConfig.userRole); | 662 | + loger.log("自动登录->" + GlobalConfig.userRole); |
| 653 | this._sassJoinSuccessHandler(); | 663 | this._sassJoinSuccessHandler(); |
| 654 | } else { | 664 | } else { |
| 655 | //不能自动登录,开始校验 | 665 | //不能自动登录,开始校验 |
| @@ -695,7 +705,7 @@ export default class MessageEntrance extends Emiter { | @@ -695,7 +705,7 @@ export default class MessageEntrance extends Emiter { | ||
| 695 | 705 | ||
| 696 | // 通过SASS平台验证(密码和MD5) | 706 | // 通过SASS平台验证(密码和MD5) |
| 697 | _sassJoinSuccessHandler(_data) { | 707 | _sassJoinSuccessHandler(_data) { |
| 698 | - //获取课堂最完整的数据 | 708 | + //SAAS获取课堂最完整的数据 |
| 699 | if (_sass) { | 709 | if (_sass) { |
| 700 | _sass.getClassParam(); | 710 | _sass.getClassParam(); |
| 701 | } | 711 | } |
| @@ -1041,11 +1051,11 @@ export default class MessageEntrance extends Emiter { | @@ -1041,11 +1051,11 @@ export default class MessageEntrance extends Emiter { | ||
| 1041 | 1051 | ||
| 1042 | //保存课堂状态信息 | 1052 | //保存课堂状态信息 |
| 1043 | _sassSaveClassStatusInfo(_param) { | 1053 | _sassSaveClassStatusInfo(_param) { |
| 1044 | - if (!_mcu||!_mcu.connected) { | 1054 | + if (!_mcu || !_mcu.connected) { |
| 1045 | loger.warn("不能保存课堂数据->MCU已经断开"); | 1055 | loger.warn("不能保存课堂数据->MCU已经断开"); |
| 1046 | - return ; | 1056 | + return; |
| 1047 | } | 1057 | } |
| 1048 | - if(!_confer_ape){ | 1058 | + if (!_confer_ape) { |
| 1049 | return; | 1059 | return; |
| 1050 | } | 1060 | } |
| 1051 | //{isForce:true} isForce->是否强制提交(true为是) | 1061 | //{isForce:true} isForce->是否强制提交(true为是) |
| @@ -1054,14 +1064,14 @@ export default class MessageEntrance extends Emiter { | @@ -1054,14 +1064,14 @@ export default class MessageEntrance extends Emiter { | ||
| 1054 | if (_param && _param.isForce == true) { | 1064 | if (_param && _param.isForce == true) { |
| 1055 | isForce = true; | 1065 | isForce = true; |
| 1056 | } | 1066 | } |
| 1057 | - if (_confer_ape.checkHasRecordControl()||isForce) { | 1067 | + if (_confer_ape.checkHasRecordControl() || isForce) { |
| 1058 | //POST 保存数据 | 1068 | //POST 保存数据 |
| 1059 | clearTimeout(this.saveClassStatusTimer); | 1069 | clearTimeout(this.saveClassStatusTimer); |
| 1060 | - this.saveClassStatusTimer=setTimeout(()=>{ | 1070 | + this.saveClassStatusTimer = setTimeout(()=> { |
| 1061 | _sass.saveClassStatusInfo({"classStatusInfo": GlobalConfig.classStatusInfo}); //保存课堂状态信息 | 1071 | _sass.saveClassStatusInfo({"classStatusInfo": GlobalConfig.classStatusInfo}); //保存课堂状态信息 |
| 1062 | - },1000); | 1072 | + }, 1000); |
| 1063 | } else { | 1073 | } else { |
| 1064 | - loger.log("没有保存课堂状态信息的权限->当前身份->"+GlobalConfig.userRole); | 1074 | + loger.log("没有保存课堂状态信息的权限->当前身份->" + GlobalConfig.userRole); |
| 1065 | } | 1075 | } |
| 1066 | } | 1076 | } |
| 1067 | 1077 | ||
| @@ -1123,29 +1133,30 @@ export default class MessageEntrance extends Emiter { | @@ -1123,29 +1133,30 @@ export default class MessageEntrance extends Emiter { | ||
| 1123 | GlobalConfig.screenWidth = window.screen.width; | 1133 | GlobalConfig.screenWidth = window.screen.width; |
| 1124 | GlobalConfig.screenHeight = window.screen.height; | 1134 | GlobalConfig.screenHeight = window.screen.height; |
| 1125 | 1135 | ||
| 1126 | - GlobalConfig.channelId = ""+GlobalConfig.siteId+"_"+GlobalConfig.classId; | 1136 | + GlobalConfig.channelId = "" + GlobalConfig.siteId + "_" + GlobalConfig.classId; |
| 1127 | GlobalConfig.userUid = GlobalConfig.nodeId; | 1137 | GlobalConfig.userUid = GlobalConfig.nodeId; |
| 1128 | - GlobalConfig.channelKey=""; | ||
| 1129 | - GlobalConfig.rosters={};//情况人员数据列表 | 1138 | + GlobalConfig.channelKey = ""; |
| 1139 | + GlobalConfig.rosters = {};//情况人员数据列表 | ||
| 1130 | 1140 | ||
| 1131 | //判断是否需要获取加入音视频通话频道的channelKey | 1141 | //判断是否需要获取加入音视频通话频道的channelKey |
| 1132 | - if(GlobalConfig.appCertificate){ | 1142 | + if (GlobalConfig.appCertificate) { |
| 1133 | loger.log("加入视频通话模块->需要先获取channelKey") | 1143 | loger.log("加入视频通话模块->需要先获取channelKey") |
| 1134 | //获取channelKey | 1144 | //获取channelKey |
| 1135 | - _sass.getChannelKeyToken((_data)=>{ | 1145 | + _sass.getChannelKeyToken((_data)=> { |
| 1136 | //{"code":200,"channelKey":"005AQAoAEQzQUQxNzFDOEQwOEU3OTVGMjlCMzZDRUZENTNGOTU0RDY4N0ZGMUEQANylukzO70ocgrNX9hlkNNWvpLBZ9buDAy/fuVkAAA==","uid":"751373669"} | 1146 | //{"code":200,"channelKey":"005AQAoAEQzQUQxNzFDOEQwOEU3OTVGMjlCMzZDRUZENTNGOTU0RDY4N0ZGMUEQANylukzO70ocgrNX9hlkNNWvpLBZ9buDAy/fuVkAAA==","uid":"751373669"} |
| 1137 | - if(_data&&_data.channelKey){ | ||
| 1138 | - GlobalConfig.channelKey=_data.channelKey||""; | 1147 | + if (_data && _data.channelKey) { |
| 1148 | + GlobalConfig.channelKey = _data.channelKey || ""; | ||
| 1139 | } | 1149 | } |
| 1140 | this._joinClassSuccessSeting(); | 1150 | this._joinClassSuccessSeting(); |
| 1141 | }) | 1151 | }) |
| 1142 | - }else { | 1152 | + } else { |
| 1143 | loger.log("加入视频通话模块->不需要获取channelKey") | 1153 | loger.log("加入视频通话模块->不需要获取channelKey") |
| 1144 | this._joinClassSuccessSeting(); | 1154 | this._joinClassSuccessSeting(); |
| 1145 | } | 1155 | } |
| 1146 | } | 1156 | } |
| 1157 | + | ||
| 1147 | //加入课堂成功之后设置本地数据和返回数据给客户端 | 1158 | //加入课堂成功之后设置本地数据和返回数据给客户端 |
| 1148 | - _joinClassSuccessSeting(){ | 1159 | + _joinClassSuccessSeting() { |
| 1149 | //返回给客户端初始化成功的数据 | 1160 | //返回给客户端初始化成功的数据 |
| 1150 | let joinClassSuccessCallBackData = {}; | 1161 | let joinClassSuccessCallBackData = {}; |
| 1151 | joinClassSuccessCallBackData.isRecordPlayBack = GlobalConfig.isRecordPlayBack; | 1162 | joinClassSuccessCallBackData.isRecordPlayBack = GlobalConfig.isRecordPlayBack; |
| @@ -1205,8 +1216,8 @@ export default class MessageEntrance extends Emiter { | @@ -1205,8 +1216,8 @@ export default class MessageEntrance extends Emiter { | ||
| 1205 | joinClassSuccessCallBackData.explorerVersion = GlobalConfig.explorerVersion; | 1216 | joinClassSuccessCallBackData.explorerVersion = GlobalConfig.explorerVersion; |
| 1206 | joinClassSuccessCallBackData.os = GlobalConfig.os; | 1217 | joinClassSuccessCallBackData.os = GlobalConfig.os; |
| 1207 | 1218 | ||
| 1208 | - joinClassSuccessCallBackData.channelId =GlobalConfig.channelId ; | ||
| 1209 | - joinClassSuccessCallBackData.channelKey =GlobalConfig.channelKey ; | 1219 | + joinClassSuccessCallBackData.channelId = GlobalConfig.channelId; |
| 1220 | + joinClassSuccessCallBackData.channelKey = GlobalConfig.channelKey; | ||
| 1210 | joinClassSuccessCallBackData.userUid = GlobalConfig.userUid; | 1221 | joinClassSuccessCallBackData.userUid = GlobalConfig.userUid; |
| 1211 | joinClassSuccessCallBackData.appId = GlobalConfig.appId; | 1222 | joinClassSuccessCallBackData.appId = GlobalConfig.appId; |
| 1212 | joinClassSuccessCallBackData.appCertificate = GlobalConfig.appCertificate; | 1223 | joinClassSuccessCallBackData.appCertificate = GlobalConfig.appCertificate; |
| @@ -1220,7 +1231,7 @@ export default class MessageEntrance extends Emiter { | @@ -1220,7 +1231,7 @@ export default class MessageEntrance extends Emiter { | ||
| 1220 | LogManager.userRole = GlobalConfig.userRole;//userRole | 1231 | LogManager.userRole = GlobalConfig.userRole;//userRole |
| 1221 | LogManager.userName = GlobalConfig.userName;//用户名称 | 1232 | LogManager.userName = GlobalConfig.userName;//用户名称 |
| 1222 | LogManager.logUrl = GlobalConfig.logUrl;//日志服务器地址 //http://log.3mang.com | 1233 | LogManager.logUrl = GlobalConfig.logUrl;//日志服务器地址 //http://log.3mang.com |
| 1223 | - LogManager.platform=GlobalConfig.platform; | 1234 | + LogManager.platform = GlobalConfig.platform; |
| 1224 | loger.log('加入课堂成功->'); | 1235 | loger.log('加入课堂成功->'); |
| 1225 | loger.log(joinClassSuccessCallBackData); | 1236 | loger.log(joinClassSuccessCallBackData); |
| 1226 | 1237 | ||
| @@ -1228,25 +1239,30 @@ export default class MessageEntrance extends Emiter { | @@ -1228,25 +1239,30 @@ export default class MessageEntrance extends Emiter { | ||
| 1228 | this._emit(MessageTypes.CLASS_JOIN_SUCCESS, joinClassSuccessCallBackData); | 1239 | this._emit(MessageTypes.CLASS_JOIN_SUCCESS, joinClassSuccessCallBackData); |
| 1229 | 1240 | ||
| 1230 | //主讲人和老师可以设置旁录 | 1241 | //主讲人和老师可以设置旁录 |
| 1231 | - if(GlobalConfig.appId&&!GlobalConfig.openFlash){ | 1242 | + if (GlobalConfig.appId && !GlobalConfig.openFlash) { |
| 1232 | //加入之前先设置旁录地址,只有直播支持旁路(1路流) | 1243 | //加入之前先设置旁录地址,只有直播支持旁路(1路流) |
| 1233 | - if(_webRtc&&GlobalConfig.isTeachOrAssistant&&GlobalConfig.maxMediaChannels==1){ | 1244 | + if (_webRtc && GlobalConfig.isTeachOrAssistant && GlobalConfig.maxMediaChannels == 1) { |
| 1234 | let curTimestamp = new Date().getTime(); | 1245 | let curTimestamp = new Date().getTime(); |
| 1235 | - let streamId=GlobalConfig.siteId+"_"+GlobalConfig.classId+"_"+GlobalConfig.userId+"_"+curTimestamp; | 1246 | + let streamId = GlobalConfig.siteId + "_" + GlobalConfig.classId + "_" + GlobalConfig.userId + "_" + curTimestamp; |
| 1236 | //传入固定的流Id | 1247 | //传入固定的流Id |
| 1237 | - let publishData=this._getVideoPublishPath({streamId:streamId}); | ||
| 1238 | - loger.log("加入之前先设置旁录地址",publishData); | ||
| 1239 | - if(publishData&&publishData.code==0){ | 1248 | + let publishData = this._getVideoPublishPath({streamId: streamId}); |
| 1249 | + loger.log("加入之前先设置旁录地址", publishData); | ||
| 1250 | + if (publishData && publishData.code == 0) { | ||
| 1240 | _webRtc.setConfigPublisherUrl(publishData.publishUrl); | 1251 | _webRtc.setConfigPublisherUrl(publishData.publishUrl); |
| 1241 | - let m3u8Stream = _video_ape.getPlayVideoPath({"type": "m3u8", "streamId":streamId}); | ||
| 1242 | - let rtmpStream = _video_ape.getPlayVideoPath({"type": "rtmp", "streamId":streamId}); | ||
| 1243 | - _webRtc.setRtmpM3u8Path({m3u8Url:m3u8Stream.playUrl,rtmpUrl:rtmpStream.playUrl}); | 1252 | + let m3u8Stream = _video_ape.getPlayVideoPath({"type": "m3u8", "streamId": streamId}); |
| 1253 | + let rtmpStream = _video_ape.getPlayVideoPath({"type": "rtmp", "streamId": streamId}); | ||
| 1254 | + _webRtc.setRtmpM3u8Path({m3u8Url: m3u8Stream.playUrl, rtmpUrl: rtmpStream.playUrl}); | ||
| 1244 | } | 1255 | } |
| 1245 | } | 1256 | } |
| 1246 | - setTimeout(()=>{ | 1257 | + setTimeout(()=> { |
| 1247 | //加入音视频通话模块,延迟一秒处理,因为视频需要根据用户列表信息来判断放的位置,太早的话用户列表没有数据 | 1258 | //加入音视频通话模块,延迟一秒处理,因为视频需要根据用户列表信息来判断放的位置,太早的话用户列表没有数据 |
| 1248 | - this._joinChannel({channelId:GlobalConfig.channelId,channelKey:GlobalConfig.channelKey ,uid:GlobalConfig.userUid,info:""+GlobalConfig.userRole}); | ||
| 1249 | - },1600); | 1259 | + this._joinChannel({ |
| 1260 | + channelId: GlobalConfig.channelId, | ||
| 1261 | + channelKey: GlobalConfig.channelKey, | ||
| 1262 | + uid: GlobalConfig.userUid, | ||
| 1263 | + info: "" + GlobalConfig.userRole | ||
| 1264 | + }); | ||
| 1265 | + }, 1600); | ||
| 1250 | } | 1266 | } |
| 1251 | } | 1267 | } |
| 1252 | 1268 | ||
| @@ -1269,21 +1285,21 @@ export default class MessageEntrance extends Emiter { | @@ -1269,21 +1285,21 @@ export default class MessageEntrance extends Emiter { | ||
| 1269 | } else { | 1285 | } else { |
| 1270 | if (GlobalConfig.mcuListFinal && GlobalConfig.mcuListFinal.length > 0) { | 1286 | if (GlobalConfig.mcuListFinal && GlobalConfig.mcuListFinal.length > 0) { |
| 1271 | //如果当前没有设置过mcu的ip和端口随机选择一个 | 1287 | //如果当前没有设置过mcu的ip和端口随机选择一个 |
| 1272 | - if(!GlobalConfig.MCUServerIP||GlobalConfig.mcuListFinal.length==1){ | 1288 | + if (!GlobalConfig.MCUServerIP || GlobalConfig.mcuListFinal.length == 1) { |
| 1273 | let index = parseInt(Math.random() * GlobalConfig.mcuListFinal.length); | 1289 | let index = parseInt(Math.random() * GlobalConfig.mcuListFinal.length); |
| 1274 | GlobalConfig.MCUServerIP = GlobalConfig.mcuListFinal[index].ip || ""; | 1290 | GlobalConfig.MCUServerIP = GlobalConfig.mcuListFinal[index].ip || ""; |
| 1275 | GlobalConfig.MCUServerPort = GlobalConfig.mcuListFinal[index].port || ""; | 1291 | GlobalConfig.MCUServerPort = GlobalConfig.mcuListFinal[index].port || ""; |
| 1276 | - }else { | 1292 | + } else { |
| 1277 | //当前mcu已经有值,需要选择一个新的 | 1293 | //当前mcu已经有值,需要选择一个新的 |
| 1278 | - for(let i=0;i<GlobalConfig.mcuListFinal.length;i++){ | ||
| 1279 | - if(GlobalConfig.MCUServerIP == GlobalConfig.mcuListFinal[i].ip){ | 1294 | + for (let i = 0; i < GlobalConfig.mcuListFinal.length; i++) { |
| 1295 | + if (GlobalConfig.MCUServerIP == GlobalConfig.mcuListFinal[i].ip) { | ||
| 1280 | //获取下一个MCU | 1296 | //获取下一个MCU |
| 1281 | - let nextMcu= GlobalConfig.mcuListFinal[i+1]; | ||
| 1282 | - if(!nextMcu){ | 1297 | + let nextMcu = GlobalConfig.mcuListFinal[i + 1]; |
| 1298 | + if (!nextMcu) { | ||
| 1283 | //如果下一个mcu不存在就使用第一个 | 1299 | //如果下一个mcu不存在就使用第一个 |
| 1284 | - nextMcu=GlobalConfig.mcuListFinal[0]; | 1300 | + nextMcu = GlobalConfig.mcuListFinal[0]; |
| 1285 | } | 1301 | } |
| 1286 | - if(nextMcu){ | 1302 | + if (nextMcu) { |
| 1287 | GlobalConfig.MCUServerIP = nextMcu.ip || ""; | 1303 | GlobalConfig.MCUServerIP = nextMcu.ip || ""; |
| 1288 | GlobalConfig.MCUServerPort = nextMcu.port || ""; | 1304 | GlobalConfig.MCUServerPort = nextMcu.port || ""; |
| 1289 | } | 1305 | } |
| @@ -1315,18 +1331,19 @@ export default class MessageEntrance extends Emiter { | @@ -1315,18 +1331,19 @@ export default class MessageEntrance extends Emiter { | ||
| 1315 | loger.log('课堂状态发生改变,需要停止当前的所有推流'); | 1331 | loger.log('课堂状态发生改变,需要停止当前的所有推流'); |
| 1316 | this._emit(MessageTypes.MEDIA_STOP_PUBLISH); | 1332 | this._emit(MessageTypes.MEDIA_STOP_PUBLISH); |
| 1317 | } | 1333 | } |
| 1334 | + | ||
| 1318 | //用更状态数据发送变更 | 1335 | //用更状态数据发送变更 |
| 1319 | - _onRosterUpdateHandler(_data){ | 1336 | + _onRosterUpdateHandler(_data) { |
| 1320 | //数据无效/ios/android 不处理数据 | 1337 | //数据无效/ios/android 不处理数据 |
| 1321 | - if(!_data||GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 1338 | + if (!_data || GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { |
| 1322 | return; | 1339 | return; |
| 1323 | } | 1340 | } |
| 1324 | - let nodeData=_data.nodeData; | 1341 | + let nodeData = _data.nodeData; |
| 1325 | //数据用户是pc或H5不处理 | 1342 | //数据用户是pc或H5不处理 |
| 1326 | - if(!nodeData||nodeData.deviceType==0||nodeData.deviceType==3){ | 1343 | + if (!nodeData || nodeData.deviceType == 0 || nodeData.deviceType == 3) { |
| 1327 | return; | 1344 | return; |
| 1328 | } | 1345 | } |
| 1329 | - if(nodeData.openCamera>0&&_webRtc){ | 1346 | + if (nodeData.openCamera > 0 && _webRtc) { |
| 1330 | loger.log("收到移动端用户数据更新,当前是开启摄像头状态,需要尝试添加一个远程视频"); | 1347 | loger.log("收到移动端用户数据更新,当前是开启摄像头状态,需要尝试添加一个远程视频"); |
| 1331 | _webRtc.tryAddMobileStream(_data.nodeId); | 1348 | _webRtc.tryAddMobileStream(_data.nodeId); |
| 1332 | } | 1349 | } |
| @@ -1344,7 +1361,7 @@ export default class MessageEntrance extends Emiter { | @@ -1344,7 +1361,7 @@ export default class MessageEntrance extends Emiter { | ||
| 1344 | GlobalConfig.MS_PUBLISH_PORT = _param.port || ""; | 1361 | GlobalConfig.MS_PUBLISH_PORT = _param.port || ""; |
| 1345 | } | 1362 | } |
| 1346 | GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.MS_PUBLISH_IP; | 1363 | GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.MS_PUBLISH_IP; |
| 1347 | - GlobalConfig.MS_PLAY_RTMP_PORT =GlobalConfig.MS_PUBLISH_PORT; | 1364 | + GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.MS_PUBLISH_PORT; |
| 1348 | loger.warn('手动切换MS->', GlobalConfig.MS_PUBLISH_IP + ":" + GlobalConfig.MS_PUBLISH_PORT); | 1365 | loger.warn('手动切换MS->', GlobalConfig.MS_PUBLISH_IP + ":" + GlobalConfig.MS_PUBLISH_PORT); |
| 1349 | loger.warn('手动切换RTMP->', GlobalConfig.MS_PLAY_RTMP_IP + ":" + GlobalConfig.MS_PLAY_RTMP_PORT); | 1366 | loger.warn('手动切换RTMP->', GlobalConfig.MS_PLAY_RTMP_IP + ":" + GlobalConfig.MS_PLAY_RTMP_PORT); |
| 1350 | //更换完用户当前的MS地址,需要更新用户数据 | 1367 | //更换完用户当前的MS地址,需要更新用户数据 |
| @@ -1353,10 +1370,10 @@ export default class MessageEntrance extends Emiter { | @@ -1353,10 +1370,10 @@ export default class MessageEntrance extends Emiter { | ||
| 1353 | } | 1370 | } |
| 1354 | 1371 | ||
| 1355 | //音视频模块对当前正在播放的流进行更换MS | 1372 | //音视频模块对当前正在播放的流进行更换MS |
| 1356 | - if(_video_ape){ | 1373 | + if (_video_ape) { |
| 1357 | _video_ape.changeMediaMs(); | 1374 | _video_ape.changeMediaMs(); |
| 1358 | } | 1375 | } |
| 1359 | - if(_audio_ape){ | 1376 | + if (_audio_ape) { |
| 1360 | _audio_ape.changeMediaMs(); | 1377 | _audio_ape.changeMediaMs(); |
| 1361 | } | 1378 | } |
| 1362 | } | 1379 | } |
| @@ -1523,7 +1540,7 @@ export default class MessageEntrance extends Emiter { | @@ -1523,7 +1540,7 @@ export default class MessageEntrance extends Emiter { | ||
| 1523 | loger.warn(GlobalConfig.getCurrentStatus()); | 1540 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 1524 | return; | 1541 | return; |
| 1525 | } | 1542 | } |
| 1526 | - if(GlobalConfig.isRecordPlayBack){ | 1543 | + if (GlobalConfig.isRecordPlayBack) { |
| 1527 | return; | 1544 | return; |
| 1528 | } | 1545 | } |
| 1529 | if (_confer_ape) { | 1546 | if (_confer_ape) { |
| @@ -1548,7 +1565,7 @@ export default class MessageEntrance extends Emiter { | @@ -1548,7 +1565,7 @@ export default class MessageEntrance extends Emiter { | ||
| 1548 | } | 1565 | } |
| 1549 | 1566 | ||
| 1550 | //控制课堂全局是否可绘制的状态 | 1567 | //控制课堂全局是否可绘制的状态 |
| 1551 | - _changeDrawStatus(_param){ | 1568 | + _changeDrawStatus(_param) { |
| 1552 | if (!_mcu.connected) { | 1569 | if (!_mcu.connected) { |
| 1553 | loger.warn(GlobalConfig.getCurrentStatus()); | 1570 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 1554 | return; | 1571 | return; |
| @@ -1558,6 +1575,7 @@ export default class MessageEntrance extends Emiter { | @@ -1558,6 +1575,7 @@ export default class MessageEntrance extends Emiter { | ||
| 1558 | _confer_ape.changeDrawStatus(_param); | 1575 | _confer_ape.changeDrawStatus(_param); |
| 1559 | } | 1576 | } |
| 1560 | } | 1577 | } |
| 1578 | + | ||
| 1561 | //暂停上课 | 1579 | //暂停上课 |
| 1562 | _sendPauseClass(_param) { | 1580 | _sendPauseClass(_param) { |
| 1563 | if (!_mcu.connected) { | 1581 | if (!_mcu.connected) { |
| @@ -1648,10 +1666,11 @@ export default class MessageEntrance extends Emiter { | @@ -1648,10 +1666,11 @@ export default class MessageEntrance extends Emiter { | ||
| 1648 | _confer_ape.changeHandUpStatus(_param); | 1666 | _confer_ape.changeHandUpStatus(_param); |
| 1649 | } | 1667 | } |
| 1650 | } | 1668 | } |
| 1669 | + | ||
| 1651 | /* | 1670 | /* |
| 1652 | * 控制画笔使用状态 | 1671 | * 控制画笔使用状态 |
| 1653 | * */ | 1672 | * */ |
| 1654 | - _controlDrawStatus(_param){ | 1673 | + _controlDrawStatus(_param) { |
| 1655 | //{nodeId:333333,isDisEnableDraw:true} | 1674 | //{nodeId:333333,isDisEnableDraw:true} |
| 1656 | if (!_mcu.connected) { | 1675 | if (!_mcu.connected) { |
| 1657 | loger.warn(GlobalConfig.getCurrentStatus()); | 1676 | loger.warn(GlobalConfig.getCurrentStatus()); |
| @@ -1661,9 +1680,10 @@ export default class MessageEntrance extends Emiter { | @@ -1661,9 +1680,10 @@ export default class MessageEntrance extends Emiter { | ||
| 1661 | _confer_ape.controlDrawStatus(_param); | 1680 | _confer_ape.controlDrawStatus(_param); |
| 1662 | } | 1681 | } |
| 1663 | } | 1682 | } |
| 1683 | + | ||
| 1664 | //停止上课 | 1684 | //停止上课 |
| 1665 | _sendCloseClass(_param) { | 1685 | _sendCloseClass(_param) { |
| 1666 | - if (!_mcu||!_mcu.connected) { | 1686 | + if (!_mcu || !_mcu.connected) { |
| 1667 | loger.warn(GlobalConfig.getCurrentStatus()); | 1687 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 1668 | return {"code": ApeConsts.RETURN_FAILED, "data": ""}; | 1688 | return {"code": ApeConsts.RETURN_FAILED, "data": ""}; |
| 1669 | } | 1689 | } |
| @@ -1721,28 +1741,28 @@ export default class MessageEntrance extends Emiter { | @@ -1721,28 +1741,28 @@ export default class MessageEntrance extends Emiter { | ||
| 1721 | 1741 | ||
| 1722 | //获取课堂所有参数(20170727新规则) api/meeting/detail.do? flash中的接口文件是 getClassParam.do | 1742 | //获取课堂所有参数(20170727新规则) api/meeting/detail.do? flash中的接口文件是 getClassParam.do |
| 1723 | _sassGetClassParamSuccessHandler(_data) { | 1743 | _sassGetClassParamSuccessHandler(_data) { |
| 1724 | - loger.log('获取课堂课堂信息完成.',_data.appConfig); | 1744 | + loger.log('获取课堂课堂信息完成.', _data.appConfig); |
| 1725 | //包含整个课堂最全的信息,储存数据 | 1745 | //包含整个课堂最全的信息,储存数据 |
| 1726 | if (_data) { | 1746 | if (_data) { |
| 1727 | //老师\助教默认启用画笔功能,其他身份默认禁用画笔功能 | 1747 | //老师\助教默认启用画笔功能,其他身份默认禁用画笔功能 |
| 1728 | - if(GlobalConfig.userRole==ApeConsts.host|| | ||
| 1729 | - GlobalConfig.userRole==ApeConsts.assistant|| | ||
| 1730 | - GlobalConfig.userRole==ApeConsts.presenter){ | ||
| 1731 | - GlobalConfig.selfDisEnableDrawTime=0; | 1748 | + if (GlobalConfig.userRole == ApeConsts.host || |
| 1749 | + GlobalConfig.userRole == ApeConsts.assistant || | ||
| 1750 | + GlobalConfig.userRole == ApeConsts.presenter) { | ||
| 1751 | + GlobalConfig.selfDisEnableDrawTime = 0; | ||
| 1732 | } | 1752 | } |
| 1733 | 1753 | ||
| 1734 | GlobalConfig.mcuDelay = _data.h5Delay || 0; //mcu消息延迟的时间间隔,单位(秒),结合客户端传的messageDelay的值使用 | 1754 | GlobalConfig.mcuDelay = _data.h5Delay || 0; //mcu消息延迟的时间间隔,单位(秒),结合客户端传的messageDelay的值使用 |
| 1735 | GlobalConfig.className = _data.meetingName || ""; | 1755 | GlobalConfig.className = _data.meetingName || ""; |
| 1736 | GlobalConfig.classBeginTime = _data.beginTime || ""; | 1756 | GlobalConfig.classBeginTime = _data.beginTime || ""; |
| 1737 | GlobalConfig.classEndTime = _data.endTime || ""; | 1757 | GlobalConfig.classEndTime = _data.endTime || ""; |
| 1738 | - GlobalConfig.siteId=_data.siteID||"";//这个字段ID是大写的 | ||
| 1739 | - GlobalConfig.channelId = ""+GlobalConfig.siteId+"_"+GlobalConfig.classId; | 1758 | + GlobalConfig.siteId = _data.siteID || "";//这个字段ID是大写的 |
| 1759 | + GlobalConfig.channelId = "" + GlobalConfig.siteId + "_" + GlobalConfig.classId; | ||
| 1740 | //sdk获取ip失败就使用saas返回的 | 1760 | //sdk获取ip失败就使用saas返回的 |
| 1741 | - if(!GlobalConfig.userIp){ | 1761 | + if (!GlobalConfig.userIp) { |
| 1742 | GlobalConfig.userIp = _data.userIp || ""; | 1762 | GlobalConfig.userIp = _data.userIp || ""; |
| 1743 | - loger.warn("使用从Sass返回的userIp",GlobalConfig.userIp); | ||
| 1744 | - }else { | ||
| 1745 | - loger.warn("使用SDK获取的userIp",GlobalConfig.userIp); | 1763 | + loger.warn("使用从Sass返回的userIp", GlobalConfig.userIp); |
| 1764 | + } else { | ||
| 1765 | + loger.warn("使用SDK获取的userIp", GlobalConfig.userIp); | ||
| 1746 | } | 1766 | } |
| 1747 | 1767 | ||
| 1748 | 1768 | ||
| @@ -1762,9 +1782,9 @@ export default class MessageEntrance extends Emiter { | @@ -1762,9 +1782,9 @@ export default class MessageEntrance extends Emiter { | ||
| 1762 | //是否自动开始(身份是host的时候才用到的) | 1782 | //是否自动开始(身份是host的时候才用到的) |
| 1763 | GlobalConfig.isAutoStartClass = _data.autoRecord || 0; | 1783 | GlobalConfig.isAutoStartClass = _data.autoRecord || 0; |
| 1764 | GlobalConfig.logUrl = _data.logUrl || ""; | 1784 | GlobalConfig.logUrl = _data.logUrl || ""; |
| 1765 | - GlobalConfig.logUrl=GlobalConfig.logUrl.replace("https://",""); | ||
| 1766 | - GlobalConfig.logUrl=GlobalConfig.logUrl.replace("http://",""); | ||
| 1767 | - GlobalConfig.logUrl=GlobalConfig.locationProtocol+GlobalConfig.logUrl; | 1785 | + GlobalConfig.logUrl = GlobalConfig.logUrl.replace("https://", ""); |
| 1786 | + GlobalConfig.logUrl = GlobalConfig.logUrl.replace("http://", ""); | ||
| 1787 | + GlobalConfig.logUrl = GlobalConfig.locationProtocol + GlobalConfig.logUrl; | ||
| 1768 | 1788 | ||
| 1769 | GlobalConfig.serverTime = _data.serverTime || new Date().getTime(); //获取服务器时间戳 | 1789 | GlobalConfig.serverTime = _data.serverTime || new Date().getTime(); //获取服务器时间戳 |
| 1770 | GlobalConfig.serverAndLoacTimeDistanc = (new Date().getTime() - GlobalConfig.serverTime) / 1000; //当前系统时间和服务器时间的差值 (秒) | 1790 | GlobalConfig.serverAndLoacTimeDistanc = (new Date().getTime() - GlobalConfig.serverTime) / 1000; //当前系统时间和服务器时间的差值 (秒) |
| @@ -1779,29 +1799,29 @@ export default class MessageEntrance extends Emiter { | @@ -1779,29 +1799,29 @@ export default class MessageEntrance extends Emiter { | ||
| 1779 | GlobalConfig.setMediaShareList(_data.sharedMediaList); //提前上传的媒体共享文件列表 | 1799 | GlobalConfig.setMediaShareList(_data.sharedMediaList); //提前上传的媒体共享文件列表 |
| 1780 | 1800 | ||
| 1781 | //设置白板文档,固定ID | 1801 | //设置白板文档,固定ID |
| 1782 | - let whiteBoradData={ | ||
| 1783 | - itemIdx:GlobalConfig.whiteboardId,//指定的白板文档ID | 1802 | + let whiteBoradData = { |
| 1803 | + itemIdx: GlobalConfig.whiteboardId,//指定的白板文档ID | ||
| 1784 | name: "白板.pdf", | 1804 | name: "白板.pdf", |
| 1785 | creatUserId: 0, | 1805 | creatUserId: 0, |
| 1786 | - md5:"b153313f6f390328a30db5389b6cee53", | 1806 | + md5: "b153313f6f390328a30db5389b6cee53", |
| 1787 | pageNum: 30, | 1807 | pageNum: 30, |
| 1788 | docId: "b153313f6f390328a30db5389b6cee53", | 1808 | docId: "b153313f6f390328a30db5389b6cee53", |
| 1789 | - url:"http://pclive.xuedianyun.com/DocSharing/data/whiteboard/default/whiteboard.pdf", | 1809 | + url: "http://pclive.xuedianyun.com/DocSharing/data/whiteboard/default/whiteboard.pdf", |
| 1790 | dynamicTransferStatic: "0", | 1810 | dynamicTransferStatic: "0", |
| 1791 | relativeUrl: "/DocSharing/data/whiteboard/default/whiteboard.pdf", | 1811 | relativeUrl: "/DocSharing/data/whiteboard/default/whiteboard.pdf", |
| 1792 | fileType: "pdf" | 1812 | fileType: "pdf" |
| 1793 | } | 1813 | } |
| 1794 | GlobalConfig.docListPrepare.push(whiteBoradData); | 1814 | GlobalConfig.docListPrepare.push(whiteBoradData); |
| 1795 | 1815 | ||
| 1796 | - let appConfigStr=_data.appConfig; | ||
| 1797 | - appConfigStr=_base64.decode(appConfigStr); | ||
| 1798 | - let appConfig={}; | ||
| 1799 | - try{ | ||
| 1800 | - appConfig=JSON.parse(appConfigStr); | 1816 | + let appConfigStr = _data.appConfig; |
| 1817 | + appConfigStr = _base64.decode(appConfigStr); | ||
| 1818 | + let appConfig = {}; | ||
| 1819 | + try { | ||
| 1820 | + appConfig = JSON.parse(appConfigStr); | ||
| 1801 | //储存app相关信息 | 1821 | //储存app相关信息 |
| 1802 | this._setAppConfig(appConfig); | 1822 | this._setAppConfig(appConfig); |
| 1803 | - }catch (err){ | ||
| 1804 | - loger.warn("appConfig->解析失败",appConfigStr); | 1823 | + } catch (err) { |
| 1824 | + loger.warn("appConfig->解析失败", appConfigStr); | ||
| 1805 | } | 1825 | } |
| 1806 | 1826 | ||
| 1807 | 1827 | ||
| @@ -1812,9 +1832,9 @@ export default class MessageEntrance extends Emiter { | @@ -1812,9 +1832,9 @@ export default class MessageEntrance extends Emiter { | ||
| 1812 | GlobalConfig.DOCServerIP = GlobalConfig.docList[index].ip || ""; | 1832 | GlobalConfig.DOCServerIP = GlobalConfig.docList[index].ip || ""; |
| 1813 | GlobalConfig.DOCServerPort = GlobalConfig.docList[index].port || ""; | 1833 | GlobalConfig.DOCServerPort = GlobalConfig.docList[index].port || ""; |
| 1814 | 1834 | ||
| 1815 | - if(GlobalConfig.isHttps){ | 1835 | + if (GlobalConfig.isHttps) { |
| 1816 | //https的时候替换所有80端口 | 1836 | //https的时候替换所有80端口 |
| 1817 | - GlobalConfig.DOCServerPort= GlobalConfig.replacePort(GlobalConfig.DOCServerPort,"80",""); | 1837 | + GlobalConfig.DOCServerPort = GlobalConfig.replacePort(GlobalConfig.DOCServerPort, "80", ""); |
| 1818 | } | 1838 | } |
| 1819 | 1839 | ||
| 1820 | } | 1840 | } |
| @@ -1824,9 +1844,9 @@ export default class MessageEntrance extends Emiter { | @@ -1824,9 +1844,9 @@ export default class MessageEntrance extends Emiter { | ||
| 1824 | GlobalConfig.RecordServerIP = GlobalConfig.recordList[index].ip || ""; | 1844 | GlobalConfig.RecordServerIP = GlobalConfig.recordList[index].ip || ""; |
| 1825 | GlobalConfig.RecordServerPort = GlobalConfig.recordList[index].port || ""; | 1845 | GlobalConfig.RecordServerPort = GlobalConfig.recordList[index].port || ""; |
| 1826 | 1846 | ||
| 1827 | - if(GlobalConfig.isHttps){ | 1847 | + if (GlobalConfig.isHttps) { |
| 1828 | //https的时候替换所有80端口 | 1848 | //https的时候替换所有80端口 |
| 1829 | - GlobalConfig.RecordServerPort= GlobalConfig.replacePort(GlobalConfig.RecordServerPort,"80",""); | 1849 | + GlobalConfig.RecordServerPort = GlobalConfig.replacePort(GlobalConfig.RecordServerPort, "80", ""); |
| 1830 | } | 1850 | } |
| 1831 | } | 1851 | } |
| 1832 | loger.warn('默认->文档服务器地址->.', GlobalConfig.DOCServerIP, GlobalConfig.DOCServerPort); | 1852 | loger.warn('默认->文档服务器地址->.', GlobalConfig.DOCServerIP, GlobalConfig.DOCServerPort); |
| @@ -1842,26 +1862,69 @@ export default class MessageEntrance extends Emiter { | @@ -1842,26 +1862,69 @@ export default class MessageEntrance extends Emiter { | ||
| 1842 | } | 1862 | } |
| 1843 | } | 1863 | } |
| 1844 | 1864 | ||
| 1845 | - //课堂获取Sass数据完成 | ||
| 1846 | - this._emit(MessageTypes.CLASS_GET_INFO_SUCCESS, GlobalConfig.getClassInfo()); | ||
| 1847 | - | ||
| 1848 | //存储Sass数据到本地 | 1865 | //存储Sass数据到本地 |
| 1849 | if (_data.currentInfo) { | 1866 | if (_data.currentInfo) { |
| 1850 | //根据从Sass获取的数据信息,同步最后一次保存的课堂状态信息 | 1867 | //根据从Sass获取的数据信息,同步最后一次保存的课堂状态信息 |
| 1851 | - loger.log("从Saas返回的课堂状态信息数据",_data.currentInfo); | 1868 | + loger.log("从Saas返回的课堂状态信息数据", _data.currentInfo); |
| 1852 | try { | 1869 | try { |
| 1853 | - let dataObj=JSON.parse(_data.currentInfo); | ||
| 1854 | - dataObj.recordStatus=false; | 1870 | + let dataObj = JSON.parse(_data.currentInfo); |
| 1871 | + dataObj.recordStatus = false; | ||
| 1855 | GlobalConfig.setClassStatusInfo(dataObj); | 1872 | GlobalConfig.setClassStatusInfo(dataObj); |
| 1856 | } catch (err) { | 1873 | } catch (err) { |
| 1857 | loger.warn("从Sass获取的课堂数据JSON转换失败->"); | 1874 | loger.warn("从Sass获取的课堂数据JSON转换失败->"); |
| 1858 | GlobalConfig.setClassStatusInfo(_data.currentInfo); | 1875 | GlobalConfig.setClassStatusInfo(_data.currentInfo); |
| 1859 | } | 1876 | } |
| 1860 | loger.log(GlobalConfig.classStatusInfo); | 1877 | loger.log(GlobalConfig.classStatusInfo); |
| 1878 | + //课堂获取Sass数据完成 | ||
| 1879 | + this._emit(MessageTypes.CLASS_GET_INFO_SUCCESS, GlobalConfig.getClassInfo()); | ||
| 1880 | + | ||
| 1881 | + //课堂数据获取完成->进入课堂或进入录制回放 | ||
| 1882 | + //录制回放不需要获取ip信息和选点 | ||
| 1883 | + if (GlobalConfig.isRecordPlayBack) { | ||
| 1884 | + if (_recordPlayback) { | ||
| 1885 | + //开启录制回放流程 | ||
| 1886 | + loger.warn("开启录制回放流程"); | ||
| 1887 | + //根据用户的userIp信息从sever.json和Sass中选择最终mcu和推流拉流数据列表 | ||
| 1888 | + ServerConfig.serverList = ServerConfig.sassServerJson; | ||
| 1889 | + this._choiceMcuAndMsListFromSass(); | ||
| 1890 | + //获取MCU和MS 推流拉流、录制回放的默认地址 | ||
| 1891 | + this.getMcuAndMsDefaultServerIp(); | ||
| 1892 | + _recordPlayback.readyLoadRecordPlayData(); | ||
| 1861 | } else { | 1893 | } else { |
| 1862 | - loger.log("还没有保存过课堂状信息"); | 1894 | + loger.warn("开启录制回放流程失败->还未创建模块"); |
| 1863 | } | 1895 | } |
| 1864 | - | 1896 | + } else { |
| 1897 | + //初始化音视频通话sdk | ||
| 1898 | + if (GlobalConfig.appId && !GlobalConfig.openFlash) { | ||
| 1899 | + loger.log("使用webRtc通话模式"); | ||
| 1900 | + //加入webRtc | ||
| 1901 | + this._initWebRtcSdk({ | ||
| 1902 | + appId: GlobalConfig.appId | ||
| 1903 | + }, ()=> { | ||
| 1904 | + //音视频通话SDK初始化完成之后,根据用户的userIp获取信息,获取服务列表选点,选点测速完成后才加入MCU | ||
| 1905 | + this.loadServerJsonAndgetUserIpInfo(); | ||
| 1906 | + }); | ||
| 1907 | + } else { | ||
| 1908 | + //加入flash | ||
| 1909 | + loger.log("使用flash通话模式"); | ||
| 1910 | + this.loadServerJsonAndgetUserIpInfo(); | ||
| 1911 | + } | ||
| 1912 | + } | ||
| 1913 | + } else { | ||
| 1914 | + loger.warn("从Sass获取的课堂数据currentInfo无效->再次获取"); | ||
| 1915 | + //如果获取的数据中没有课堂保存的状态数据,需要单独的接口获取一次 | ||
| 1916 | + _sass.getClassRecordInfo((_currentInfo)=> { | ||
| 1917 | + if(_currentInfo){ | ||
| 1918 | + try { | ||
| 1919 | + let dataObj = JSON.parse(_currentInfo); | ||
| 1920 | + dataObj.recordStatus = false; | ||
| 1921 | + GlobalConfig.setClassStatusInfo(dataObj); | ||
| 1922 | + } catch (err) { | ||
| 1923 | + loger.warn("getClassRecordInfo获取的课堂数据JSON转换失败->"); | ||
| 1924 | + } | ||
| 1925 | + } | ||
| 1926 | + //课堂获取Sass数据完成 | ||
| 1927 | + this._emit(MessageTypes.CLASS_GET_INFO_SUCCESS, GlobalConfig.getClassInfo()); | ||
| 1865 | //课堂数据获取完成->进入课堂或进入录制回放 | 1928 | //课堂数据获取完成->进入课堂或进入录制回放 |
| 1866 | //录制回放不需要获取ip信息和选点 | 1929 | //录制回放不需要获取ip信息和选点 |
| 1867 | if (GlobalConfig.isRecordPlayBack) { | 1930 | if (GlobalConfig.isRecordPlayBack) { |
| @@ -1879,26 +1942,59 @@ export default class MessageEntrance extends Emiter { | @@ -1879,26 +1942,59 @@ export default class MessageEntrance extends Emiter { | ||
| 1879 | } | 1942 | } |
| 1880 | } else { | 1943 | } else { |
| 1881 | //初始化音视频通话sdk | 1944 | //初始化音视频通话sdk |
| 1882 | - if(GlobalConfig.appId&&!GlobalConfig.openFlash){ | 1945 | + if (GlobalConfig.appId && !GlobalConfig.openFlash) { |
| 1883 | loger.log("使用webRtc通话模式"); | 1946 | loger.log("使用webRtc通话模式"); |
| 1884 | //加入webRtc | 1947 | //加入webRtc |
| 1885 | this._initWebRtcSdk({ | 1948 | this._initWebRtcSdk({ |
| 1886 | - appId:GlobalConfig.appId | ||
| 1887 | - },()=>{ | 1949 | + appId: GlobalConfig.appId |
| 1950 | + }, ()=> { | ||
| 1888 | //音视频通话SDK初始化完成之后,根据用户的userIp获取信息,获取服务列表选点,选点测速完成后才加入MCU | 1951 | //音视频通话SDK初始化完成之后,根据用户的userIp获取信息,获取服务列表选点,选点测速完成后才加入MCU |
| 1889 | this.loadServerJsonAndgetUserIpInfo(); | 1952 | this.loadServerJsonAndgetUserIpInfo(); |
| 1890 | }); | 1953 | }); |
| 1891 | - }else { | 1954 | + } else { |
| 1892 | //加入flash | 1955 | //加入flash |
| 1893 | loger.log("使用flash通话模式"); | 1956 | loger.log("使用flash通话模式"); |
| 1894 | this.loadServerJsonAndgetUserIpInfo(); | 1957 | this.loadServerJsonAndgetUserIpInfo(); |
| 1895 | } | 1958 | } |
| 1959 | + } | ||
| 1960 | + }) | ||
| 1961 | + } | ||
| 1896 | 1962 | ||
| 1897 | - /* | ||
| 1898 | - //根据用户的userIp获取信息,获取服务列表选点,选点测速完成后才加入MCU | 1963 | + /* //课堂获取Sass数据完成 |
| 1964 | + this._emit(MessageTypes.CLASS_GET_INFO_SUCCESS, GlobalConfig.getClassInfo()); | ||
| 1965 | + | ||
| 1966 | + //课堂数据获取完成->进入课堂或进入录制回放 | ||
| 1967 | + //录制回放不需要获取ip信息和选点 | ||
| 1968 | + if (GlobalConfig.isRecordPlayBack) { | ||
| 1969 | + if (_recordPlayback) { | ||
| 1970 | + //开启录制回放流程 | ||
| 1971 | + loger.warn("开启录制回放流程"); | ||
| 1972 | + //根据用户的userIp信息从sever.json和Sass中选择最终mcu和推流拉流数据列表 | ||
| 1973 | + ServerConfig.serverList = ServerConfig.sassServerJson; | ||
| 1974 | + this._choiceMcuAndMsListFromSass(); | ||
| 1975 | + //获取MCU和MS 推流拉流、录制回放的默认地址 | ||
| 1976 | + this.getMcuAndMsDefaultServerIp(); | ||
| 1977 | + _recordPlayback.readyLoadRecordPlayData(); | ||
| 1978 | + } else { | ||
| 1979 | + loger.warn("开启录制回放流程失败->还未创建模块"); | ||
| 1980 | + } | ||
| 1981 | + } else { | ||
| 1982 | + //初始化音视频通话sdk | ||
| 1983 | + if (GlobalConfig.appId && !GlobalConfig.openFlash) { | ||
| 1984 | + loger.log("使用webRtc通话模式"); | ||
| 1985 | + //加入webRtc | ||
| 1986 | + this._initWebRtcSdk({ | ||
| 1987 | + appId: GlobalConfig.appId | ||
| 1988 | + }, ()=> { | ||
| 1989 | + //音视频通话SDK初始化完成之后,根据用户的userIp获取信息,获取服务列表选点,选点测速完成后才加入MCU | ||
| 1990 | + this.loadServerJsonAndgetUserIpInfo(); | ||
| 1991 | + }); | ||
| 1992 | + } else { | ||
| 1993 | + //加入flash | ||
| 1994 | + loger.log("使用flash通话模式"); | ||
| 1899 | this.loadServerJsonAndgetUserIpInfo(); | 1995 | this.loadServerJsonAndgetUserIpInfo(); |
| 1900 | - */ | ||
| 1901 | } | 1996 | } |
| 1997 | + }*/ | ||
| 1902 | } | 1998 | } |
| 1903 | 1999 | ||
| 1904 | //获取各个服务的默认ip,之后会进行测速选择更快的ip | 2000 | //获取各个服务的默认ip,之后会进行测速选择更快的ip |
| @@ -1907,8 +2003,8 @@ export default class MessageEntrance extends Emiter { | @@ -1907,8 +2003,8 @@ export default class MessageEntrance extends Emiter { | ||
| 1907 | if (GlobalConfig.mcuListFinal && GlobalConfig.mcuListFinal.length > 0) { | 2003 | if (GlobalConfig.mcuListFinal && GlobalConfig.mcuListFinal.length > 0) { |
| 1908 | //还未开始选点之前随机选择一个 | 2004 | //还未开始选点之前随机选择一个 |
| 1909 | let index = parseInt(Math.random() * GlobalConfig.mcuListFinal.length); | 2005 | let index = parseInt(Math.random() * GlobalConfig.mcuListFinal.length); |
| 1910 | - if(!GlobalConfig.MCUServerIP){ | ||
| 1911 | - index=0; | 2006 | + if (!GlobalConfig.MCUServerIP) { |
| 2007 | + index = 0; | ||
| 1912 | } | 2008 | } |
| 1913 | GlobalConfig.MCUServerIP = GlobalConfig.mcuListFinal[index].ip || ""; | 2009 | GlobalConfig.MCUServerIP = GlobalConfig.mcuListFinal[index].ip || ""; |
| 1914 | GlobalConfig.MCUServerPort = GlobalConfig.mcuListFinal[index].port || ""; | 2010 | GlobalConfig.MCUServerPort = GlobalConfig.mcuListFinal[index].port || ""; |
| @@ -1918,8 +2014,8 @@ export default class MessageEntrance extends Emiter { | @@ -1918,8 +2014,8 @@ export default class MessageEntrance extends Emiter { | ||
| 1918 | if (GlobalConfig.rsPullListFinal && GlobalConfig.rsPullListFinal.length > 0) { | 2014 | if (GlobalConfig.rsPullListFinal && GlobalConfig.rsPullListFinal.length > 0) { |
| 1919 | //还未开始选点之前随机选择一个 | 2015 | //还未开始选点之前随机选择一个 |
| 1920 | let index = parseInt(Math.random() * GlobalConfig.rsPullListFinal.length); | 2016 | let index = parseInt(Math.random() * GlobalConfig.rsPullListFinal.length); |
| 1921 | - if(!GlobalConfig.RS_RECORD_PLAY_IP){ | ||
| 1922 | - index=0; | 2017 | + if (!GlobalConfig.RS_RECORD_PLAY_IP) { |
| 2018 | + index = 0; | ||
| 1923 | } | 2019 | } |
| 1924 | GlobalConfig.RS_RECORD_PLAY_IP = GlobalConfig.rsPullListFinal[index].ip || ""; | 2020 | GlobalConfig.RS_RECORD_PLAY_IP = GlobalConfig.rsPullListFinal[index].ip || ""; |
| 1925 | GlobalConfig.RS_RECORD_PLAY_PORT = GlobalConfig.rsPullListFinal[index].port || ""; | 2021 | GlobalConfig.RS_RECORD_PLAY_PORT = GlobalConfig.rsPullListFinal[index].port || ""; |
| @@ -1929,8 +2025,8 @@ export default class MessageEntrance extends Emiter { | @@ -1929,8 +2025,8 @@ export default class MessageEntrance extends Emiter { | ||
| 1929 | if (GlobalConfig.msListFinal && GlobalConfig.msListFinal.length > 0) { | 2025 | if (GlobalConfig.msListFinal && GlobalConfig.msListFinal.length > 0) { |
| 1930 | //还未开始选点之前随机选择一个 | 2026 | //还未开始选点之前随机选择一个 |
| 1931 | let index = parseInt(Math.random() * GlobalConfig.msListFinal.length); | 2027 | let index = parseInt(Math.random() * GlobalConfig.msListFinal.length); |
| 1932 | - if(!GlobalConfig.MS_PUBLISH_IP){ | ||
| 1933 | - index=0; | 2028 | + if (!GlobalConfig.MS_PUBLISH_IP) { |
| 2029 | + index = 0; | ||
| 1934 | } | 2030 | } |
| 1935 | GlobalConfig.MS_PUBLISH_IP = GlobalConfig.msListFinal[index].ip || ""; | 2031 | GlobalConfig.MS_PUBLISH_IP = GlobalConfig.msListFinal[index].ip || ""; |
| 1936 | GlobalConfig.MS_PUBLISH_PORT = GlobalConfig.msListFinal[index].port || ""; | 2032 | GlobalConfig.MS_PUBLISH_PORT = GlobalConfig.msListFinal[index].port || ""; |
| @@ -1940,8 +2036,8 @@ export default class MessageEntrance extends Emiter { | @@ -1940,8 +2036,8 @@ export default class MessageEntrance extends Emiter { | ||
| 1940 | if (GlobalConfig.rtmpPullListFinal && GlobalConfig.rtmpPullListFinal.length > 0) { | 2036 | if (GlobalConfig.rtmpPullListFinal && GlobalConfig.rtmpPullListFinal.length > 0) { |
| 1941 | // //还未开始选点之前随机选择一个 | 2037 | // //还未开始选点之前随机选择一个 |
| 1942 | let index = parseInt(Math.random() * GlobalConfig.rtmpPullListFinal.length); | 2038 | let index = parseInt(Math.random() * GlobalConfig.rtmpPullListFinal.length); |
| 1943 | - if(!GlobalConfig.MS_PLAY_RTMP_IP){ | ||
| 1944 | - index=0; | 2039 | + if (!GlobalConfig.MS_PLAY_RTMP_IP) { |
| 2040 | + index = 0; | ||
| 1945 | } | 2041 | } |
| 1946 | GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.rtmpPullListFinal[index].ip || ""; | 2042 | GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.rtmpPullListFinal[index].ip || ""; |
| 1947 | GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.rtmpPullListFinal[index].port || ""; | 2043 | GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.rtmpPullListFinal[index].port || ""; |
| @@ -1955,8 +2051,8 @@ export default class MessageEntrance extends Emiter { | @@ -1955,8 +2051,8 @@ export default class MessageEntrance extends Emiter { | ||
| 1955 | if (GlobalConfig.hlsPullListFinal && GlobalConfig.hlsPullListFinal.length > 0) { | 2051 | if (GlobalConfig.hlsPullListFinal && GlobalConfig.hlsPullListFinal.length > 0) { |
| 1956 | //有单独的hls拉流地址 | 2052 | //有单独的hls拉流地址 |
| 1957 | let index = parseInt(Math.random() * GlobalConfig.hlsPullListFinal.length); | 2053 | let index = parseInt(Math.random() * GlobalConfig.hlsPullListFinal.length); |
| 1958 | - if(!GlobalConfig.MS_PLAY_HLS_IP){ | ||
| 1959 | - index=0; | 2054 | + if (!GlobalConfig.MS_PLAY_HLS_IP) { |
| 2055 | + index = 0; | ||
| 1960 | } | 2056 | } |
| 1961 | GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.hlsPullListFinal[index].ip || ""; | 2057 | GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.hlsPullListFinal[index].ip || ""; |
| 1962 | GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.hlsPullListFinal[index].port || ""; | 2058 | GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.hlsPullListFinal[index].port || ""; |
| @@ -2007,25 +2103,27 @@ export default class MessageEntrance extends Emiter { | @@ -2007,25 +2103,27 @@ export default class MessageEntrance extends Emiter { | ||
| 2007 | _confer_ape.updaterUserDeviecStatusChange(_data); | 2103 | _confer_ape.updaterUserDeviecStatusChange(_data); |
| 2008 | } | 2104 | } |
| 2009 | } | 2105 | } |
| 2106 | + | ||
| 2010 | //webRtc推流状态发生改变 | 2107 | //webRtc推流状态发生改变 |
| 2011 | - mediaPublishStatusChange(_data){ | 2108 | + mediaPublishStatusChange(_data) { |
| 2012 | if (!_mcu.connected) { | 2109 | if (!_mcu.connected) { |
| 2013 | loger.warn(GlobalConfig.getCurrentStatus()); | 2110 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 2014 | return {"code": ApeConsts.RETURN_FAILED, "data": ""}; | 2111 | return {"code": ApeConsts.RETURN_FAILED, "data": ""}; |
| 2015 | } | 2112 | } |
| 2016 | if (_video_ape) { | 2113 | if (_video_ape) { |
| 2017 | //if(_data.status==WebRtcApe.RECORD_STATUS_1&&!_data.publishUrl){ | 2114 | //if(_data.status==WebRtcApe.RECORD_STATUS_1&&!_data.publishUrl){ |
| 2018 | - loger.log("webRtc推流状态发生改变->发送同步消息",_data); | ||
| 2019 | - if(_data.status==WebRtcApe.RECORD_STATUS_1){ | ||
| 2020 | - let publishData=this._getVideoPublishPath(); | ||
| 2021 | - let publishUrl=""; | ||
| 2022 | - if(publishData&&publishData.code==0){ | ||
| 2023 | - _data.publishUrl=publishData.publishUrl||""; | 2115 | + loger.log("webRtc推流状态发生改变->发送同步消息", _data); |
| 2116 | + if (_data.status == WebRtcApe.RECORD_STATUS_1) { | ||
| 2117 | + let publishData = this._getVideoPublishPath(); | ||
| 2118 | + let publishUrl = ""; | ||
| 2119 | + if (publishData && publishData.code == 0) { | ||
| 2120 | + _data.publishUrl = publishData.publishUrl || ""; | ||
| 2024 | } | 2121 | } |
| 2025 | } | 2122 | } |
| 2026 | _video_ape.mediaPublishStatusChange(_data); | 2123 | _video_ape.mediaPublishStatusChange(_data); |
| 2027 | } | 2124 | } |
| 2028 | } | 2125 | } |
| 2126 | + | ||
| 2029 | //屏幕共享 | 2127 | //屏幕共享 |
| 2030 | //开始屏幕共享 | 2128 | //开始屏幕共享 |
| 2031 | _publishScreenShare(_param) { | 2129 | _publishScreenShare(_param) { |
| @@ -2041,6 +2139,54 @@ export default class MessageEntrance extends Emiter { | @@ -2041,6 +2139,54 @@ export default class MessageEntrance extends Emiter { | ||
| 2041 | } | 2139 | } |
| 2042 | } | 2140 | } |
| 2043 | 2141 | ||
| 2142 | + //添加外部流 | ||
| 2143 | + _addMediaExternalLink(_params){ | ||
| 2144 | + if(!_params||!_params.rtmpUrl){ | ||
| 2145 | + return; | ||
| 2146 | + } | ||
| 2147 | + let fileInfo = {}; | ||
| 2148 | + fileInfo.pageNum =1;// 文档的总页数 | ||
| 2149 | + fileInfo.fileName = _params.fileName||"视频"+EngineUtils.creatTimestamp()+".video";//文档名字 | ||
| 2150 | + fileInfo.fileType ="video"; | ||
| 2151 | + fileInfo.relativeUrl =""; //文档相对地址 | ||
| 2152 | + fileInfo.url = _params.rtmpUrl||"unkown"; //文档绝对地址 默认值: null | ||
| 2153 | + fileInfo.docId =""+EngineUtils.creatTimestamp(); //文档在数据库中的唯一id标识 默认值: null | ||
| 2154 | + fileInfo.visible = false; // 是否显示 默认值: false | ||
| 2155 | + fileInfo.publishUrl = _params.rtmpUrl||""; | ||
| 2156 | + fileInfo.rtmpUrl = _params.rtmpUrl||""; | ||
| 2157 | + fileInfo.m3u8Url = _params.m3u8Url||""; | ||
| 2158 | + fileInfo.replay = _params.replay||""; | ||
| 2159 | + loger.log("添加外部流", fileInfo); | ||
| 2160 | + this._sendDocumentUpload(fileInfo); | ||
| 2161 | + } | ||
| 2162 | + //删除外部流 | ||
| 2163 | + _deleteMediaExternalLink(_param){ | ||
| 2164 | + this._sendDocumentDelete(_param); | ||
| 2165 | + } | ||
| 2166 | + //推送外部流地址 | ||
| 2167 | + _publishExternalLink(_param) { | ||
| 2168 | + if (!_mcu.connected) { | ||
| 2169 | + loger.warn("推送外部流地址失败,mcu连接已经断开"); | ||
| 2170 | + return {"code": ApeConsts.RETURN_FAILED, "data": ""}; | ||
| 2171 | + } | ||
| 2172 | + loger.log("推送外部流地址", _param); | ||
| 2173 | + if (_video_ape) { | ||
| 2174 | + _video_ape.publishExternalLink(_param); | ||
| 2175 | + } | ||
| 2176 | + } | ||
| 2177 | + | ||
| 2178 | + //停止推送外部流地址 | ||
| 2179 | + _stopPublishExternalLink(_param) { | ||
| 2180 | + if (!_mcu.connected) { | ||
| 2181 | + loger.warn("停止推送外部流地址失败,mcu连接已经断开"); | ||
| 2182 | + return {"code": ApeConsts.RETURN_FAILED, "data": ""}; | ||
| 2183 | + } | ||
| 2184 | + loger.log("停止推送外部流地址", _param); | ||
| 2185 | + if (_video_ape) { | ||
| 2186 | + _video_ape.stopPublishExternalLink(_param); | ||
| 2187 | + } | ||
| 2188 | + } | ||
| 2189 | + | ||
| 2044 | //VidoeApe | 2190 | //VidoeApe |
| 2045 | videoUpdate(_data) { | 2191 | videoUpdate(_data) { |
| 2046 | //视频同步的消息发送改变,需要通知ferApe模块中的用户更新状态 | 2192 | //视频同步的消息发送改变,需要通知ferApe模块中的用户更新状态 |
| @@ -2257,22 +2403,24 @@ export default class MessageEntrance extends Emiter { | @@ -2257,22 +2403,24 @@ export default class MessageEntrance extends Emiter { | ||
| 2257 | _doc_ape.documentSwitchDoc(_param); | 2403 | _doc_ape.documentSwitchDoc(_param); |
| 2258 | } | 2404 | } |
| 2259 | } | 2405 | } |
| 2406 | + | ||
| 2260 | //切换到白板文档 | 2407 | //切换到白板文档 |
| 2261 | - _switchToWhiteboard(_param){ | 2408 | + _switchToWhiteboard(_param) { |
| 2262 | if (!_mcu.connected) { | 2409 | if (!_mcu.connected) { |
| 2263 | loger.warn("连接已经断开->不能切换到白板文档"); | 2410 | loger.warn("连接已经断开->不能切换到白板文档"); |
| 2264 | return; | 2411 | return; |
| 2265 | } | 2412 | } |
| 2266 | //白板文档的数据 | 2413 | //白板文档的数据 |
| 2267 | - let data={ | ||
| 2268 | - itemIdx:GlobalConfig.whiteboardId, | ||
| 2269 | - visible:true | 2414 | + let data = { |
| 2415 | + itemIdx: GlobalConfig.whiteboardId, | ||
| 2416 | + visible: true | ||
| 2270 | } | 2417 | } |
| 2271 | if (_doc_ape) { | 2418 | if (_doc_ape) { |
| 2272 | loger.log("切换到白板文档"); | 2419 | loger.log("切换到白板文档"); |
| 2273 | _doc_ape.documentSwitchDoc(data); | 2420 | _doc_ape.documentSwitchDoc(data); |
| 2274 | } | 2421 | } |
| 2275 | } | 2422 | } |
| 2423 | + | ||
| 2276 | //操作文档(翻页) | 2424 | //操作文档(翻页) |
| 2277 | _sendDocumentSwitchPage(_param) { | 2425 | _sendDocumentSwitchPage(_param) { |
| 2278 | if (!_mcu.connected) { | 2426 | if (!_mcu.connected) { |
| @@ -2349,11 +2497,12 @@ export default class MessageEntrance extends Emiter { | @@ -2349,11 +2497,12 @@ export default class MessageEntrance extends Emiter { | ||
| 2349 | } | 2497 | } |
| 2350 | 2498 | ||
| 2351 | //隐藏当前显示的文档 | 2499 | //隐藏当前显示的文档 |
| 2352 | - _hideCurrentDocument(_params){ | 2500 | + _hideCurrentDocument(_params) { |
| 2353 | if (_doc_ape) { | 2501 | if (_doc_ape) { |
| 2354 | _doc_ape.hideCurrentDocument(_params); | 2502 | _doc_ape.hideCurrentDocument(_params); |
| 2355 | } | 2503 | } |
| 2356 | } | 2504 | } |
| 2505 | + | ||
| 2357 | //文档加入频道成功,同步到MCU服务器上的数据 | 2506 | //文档加入频道成功,同步到MCU服务器上的数据 |
| 2358 | docJoinChannelSuccess() { | 2507 | docJoinChannelSuccess() { |
| 2359 | loger.log("文档加入频道成功->isHost=", GlobalConfig.isHost, "当前总人数:", GlobalConfig.rosterNumber, "sassDoclength=", GlobalConfig.docListPrepare.length); | 2508 | loger.log("文档加入频道成功->isHost=", GlobalConfig.isHost, "当前总人数:", GlobalConfig.rosterNumber, "sassDoclength=", GlobalConfig.docListPrepare.length); |
| @@ -2366,16 +2515,16 @@ export default class MessageEntrance extends Emiter { | @@ -2366,16 +2515,16 @@ export default class MessageEntrance extends Emiter { | ||
| 2366 | if (value) { | 2515 | if (value) { |
| 2367 | //loger.log("判断是否需要把提前上传的文档上传到mcu", value); | 2516 | //loger.log("判断是否需要把提前上传的文档上传到mcu", value); |
| 2368 | let paramInfo = { | 2517 | let paramInfo = { |
| 2369 | - "pageNum": value.pdfSize||value.pageNum, | 2518 | + "pageNum": value.pdfSize || value.pageNum, |
| 2370 | "fileName": value.name, | 2519 | "fileName": value.name, |
| 2371 | "fileType": value.type, | 2520 | "fileType": value.type, |
| 2372 | - "relativeUrl": value.relativeLocation||value.relativeUrl, | ||
| 2373 | - "url": value.absoluteLocation||value.url, | ||
| 2374 | - "creatUserId": value.createUserID||0, | ||
| 2375 | - "docId": value.id||value.docId, | ||
| 2376 | - "md5": value.MD5||"", | 2521 | + "relativeUrl": value.relativeLocation || value.relativeUrl, |
| 2522 | + "url": value.absoluteLocation || value.url, | ||
| 2523 | + "creatUserId": value.createUserID || 0, | ||
| 2524 | + "docId": value.id || value.docId, | ||
| 2525 | + "md5": value.MD5 || "", | ||
| 2377 | "visible": false, | 2526 | "visible": false, |
| 2378 | - "itemIdx":value.itemIdx||0 | 2527 | + "itemIdx": value.itemIdx || 0 |
| 2379 | }; | 2528 | }; |
| 2380 | this._sendDocumentUpload(paramInfo); | 2529 | this._sendDocumentUpload(paramInfo); |
| 2381 | } | 2530 | } |
| @@ -2621,10 +2770,10 @@ export default class MessageEntrance extends Emiter { | @@ -2621,10 +2770,10 @@ export default class MessageEntrance extends Emiter { | ||
| 2621 | //保存参数 | 2770 | //保存参数 |
| 2622 | GlobalConfig.isRecordPlayBack = true; //设置为录制回放状态 | 2771 | GlobalConfig.isRecordPlayBack = true; //设置为录制回放状态 |
| 2623 | GlobalConfig.classId = parseInt(_param.classId); | 2772 | GlobalConfig.classId = parseInt(_param.classId); |
| 2624 | - GlobalConfig.portal = _param.portal||""; | ||
| 2625 | - if(GlobalConfig.isHttps==true){ | 2773 | + GlobalConfig.portal = _param.portal || ""; |
| 2774 | + if (GlobalConfig.isHttps == true) { | ||
| 2626 | //https的时候替换所有80端口 | 2775 | //https的时候替换所有80端口 |
| 2627 | - GlobalConfig.portal= GlobalConfig.replacePort(GlobalConfig.portal,":80",""); | 2776 | + GlobalConfig.portal = GlobalConfig.replacePort(GlobalConfig.portal, ":80", ""); |
| 2628 | } | 2777 | } |
| 2629 | 2778 | ||
| 2630 | GlobalConfig.userRole = ApeConsts.normal; //*************很重要,录制回放的时候,身份模式是普通人******** | 2779 | GlobalConfig.userRole = ApeConsts.normal; //*************很重要,录制回放的时候,身份模式是普通人******** |
| @@ -2688,7 +2837,7 @@ export default class MessageEntrance extends Emiter { | @@ -2688,7 +2837,7 @@ export default class MessageEntrance extends Emiter { | ||
| 2688 | //录制回放加入 课堂成功 | 2837 | //录制回放加入 课堂成功 |
| 2689 | _joinRecordPlaybackSuccessHandler(_data) { | 2838 | _joinRecordPlaybackSuccessHandler(_data) { |
| 2690 | loger.log('加入录制回放成功.'); | 2839 | loger.log('加入录制回放成功.'); |
| 2691 | - LogManager.IS_OPEN_SEND_LOG=false;//录制回放不需要上报日志 | 2840 | + LogManager.IS_OPEN_SEND_LOG = false;//录制回放不需要上报日志 |
| 2692 | GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_2); | 2841 | GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_2); |
| 2693 | 2842 | ||
| 2694 | //返回给客户端初始化成功的数据 | 2843 | //返回给客户端初始化成功的数据 |
| @@ -2813,78 +2962,86 @@ export default class MessageEntrance extends Emiter { | @@ -2813,78 +2962,86 @@ export default class MessageEntrance extends Emiter { | ||
| 2813 | /* | 2962 | /* |
| 2814 | * 初始化webRtc | 2963 | * 初始化webRtc |
| 2815 | * */ | 2964 | * */ |
| 2816 | - _initWebRtcSdk(_params,_callback){ | ||
| 2817 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 2965 | + _initWebRtcSdk(_params, _callback) { |
| 2966 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { | ||
| 2818 | loger.warn("移动端不需要处理初始化webRtc"); | 2967 | loger.warn("移动端不需要处理初始化webRtc"); |
| 2819 | - if(_callback){ | 2968 | + if (_callback) { |
| 2820 | _callback(); | 2969 | _callback(); |
| 2821 | } | 2970 | } |
| 2822 | - return ; | 2971 | + return; |
| 2823 | } | 2972 | } |
| 2824 | - if(_webRtc){ | ||
| 2825 | - _webRtc.initApp(_params,(_callbackData)=>{ | 2973 | + if (_webRtc) { |
| 2974 | + _webRtc.initApp(_params, (_callbackData)=> { | ||
| 2826 | //_callback({isSuccess:false,error:err}); | 2975 | //_callback({isSuccess:false,error:err}); |
| 2827 | - if(_callbackData&&_callbackData.isSuccess==true){ | ||
| 2828 | - this._emit(MessageTypes.WEB_RTC_INIT_SUCCESS,_callbackData); | ||
| 2829 | - }else { | ||
| 2830 | - this._emit(MessageTypes.WEB_RTC_INIT_FAILED,_callbackData); | 2976 | + if (_callbackData && _callbackData.isSuccess == true) { |
| 2977 | + this._emit(MessageTypes.WEB_RTC_INIT_SUCCESS, _callbackData); | ||
| 2978 | + } else { | ||
| 2979 | + this._emit(MessageTypes.WEB_RTC_INIT_FAILED, _callbackData); | ||
| 2831 | } | 2980 | } |
| 2832 | - if(_callback){ | 2981 | + if (_callback) { |
| 2833 | _callback(); | 2982 | _callback(); |
| 2834 | } | 2983 | } |
| 2835 | }); | 2984 | }); |
| 2836 | } | 2985 | } |
| 2837 | } | 2986 | } |
| 2987 | + | ||
| 2838 | /* | 2988 | /* |
| 2839 | * 重新加入频道 | 2989 | * 重新加入频道 |
| 2840 | * */ | 2990 | * */ |
| 2841 | - _reJoinChannel(_params){ | ||
| 2842 | - if(GlobalConfig.appId&&!GlobalConfig.openFlash){ | 2991 | + _reJoinChannel(_params) { |
| 2992 | + if (GlobalConfig.appId && !GlobalConfig.openFlash) { | ||
| 2843 | //先离开频道 | 2993 | //先离开频道 |
| 2844 | this._leaveChannel(); | 2994 | this._leaveChannel(); |
| 2845 | //主讲人和老师可以设置旁录 | 2995 | //主讲人和老师可以设置旁录 |
| 2846 | 2996 | ||
| 2847 | //加入之前先设置旁录地址,只有直播支持旁路(1路流) | 2997 | //加入之前先设置旁录地址,只有直播支持旁路(1路流) |
| 2848 | - if(_webRtc&&GlobalConfig.isTeachOrAssistant&&GlobalConfig.maxMediaChannels==1){ | 2998 | + if (_webRtc && GlobalConfig.isTeachOrAssistant && GlobalConfig.maxMediaChannels == 1) { |
| 2849 | let curTimestamp = new Date().getTime(); | 2999 | let curTimestamp = new Date().getTime(); |
| 2850 | - let streamId=GlobalConfig.siteId+"_"+GlobalConfig.classId+"_"+GlobalConfig.userId+"_"+curTimestamp; | 3000 | + let streamId = GlobalConfig.siteId + "_" + GlobalConfig.classId + "_" + GlobalConfig.userId + "_" + curTimestamp; |
| 2851 | //传入固定的流Id | 3001 | //传入固定的流Id |
| 2852 | - let publishData=this._getVideoPublishPath({streamId:streamId}); | ||
| 2853 | - loger.log("加入之前先设置旁录地址",publishData); | ||
| 2854 | - if(publishData&&publishData.code==0){ | 3002 | + let publishData = this._getVideoPublishPath({streamId: streamId}); |
| 3003 | + loger.log("加入之前先设置旁录地址", publishData); | ||
| 3004 | + if (publishData && publishData.code == 0) { | ||
| 2855 | _webRtc.setConfigPublisherUrl(publishData.publishUrl); | 3005 | _webRtc.setConfigPublisherUrl(publishData.publishUrl); |
| 2856 | - let m3u8Stream = _video_ape.getPlayVideoPath({"type": "m3u8", "streamId":streamId}); | ||
| 2857 | - let rtmpStream = _video_ape.getPlayVideoPath({"type": "rtmp", "streamId":streamId}); | ||
| 2858 | - _webRtc.setRtmpM3u8Path({m3u8Url:m3u8Stream.playUrl,rtmpUrl:rtmpStream.playUrl}); | 3006 | + let m3u8Stream = _video_ape.getPlayVideoPath({"type": "m3u8", "streamId": streamId}); |
| 3007 | + let rtmpStream = _video_ape.getPlayVideoPath({"type": "rtmp", "streamId": streamId}); | ||
| 3008 | + _webRtc.setRtmpM3u8Path({m3u8Url: m3u8Stream.playUrl, rtmpUrl: rtmpStream.playUrl}); | ||
| 2859 | } | 3009 | } |
| 2860 | } | 3010 | } |
| 2861 | clearTimeout(this.joinChannelTimer); | 3011 | clearTimeout(this.joinChannelTimer); |
| 2862 | - this.joinChannelTimer=setTimeout(()=>{ | 3012 | + this.joinChannelTimer = setTimeout(()=> { |
| 2863 | //加入音视频通话模块,延迟一秒处理,因为视频需要根据用户列表信息来判断放的位置,太早的话用户列表没有数据 | 3013 | //加入音视频通话模块,延迟一秒处理,因为视频需要根据用户列表信息来判断放的位置,太早的话用户列表没有数据 |
| 2864 | - this._joinChannel({channelId:GlobalConfig.channelId,channelKey:GlobalConfig.channelKey ,uid:GlobalConfig.userUid,info:""+GlobalConfig.userRole}); | ||
| 2865 | - },1600); | 3014 | + this._joinChannel({ |
| 3015 | + channelId: GlobalConfig.channelId, | ||
| 3016 | + channelKey: GlobalConfig.channelKey, | ||
| 3017 | + uid: GlobalConfig.userUid, | ||
| 3018 | + info: "" + GlobalConfig.userRole | ||
| 3019 | + }); | ||
| 3020 | + }, 1600); | ||
| 2866 | } | 3021 | } |
| 2867 | } | 3022 | } |
| 3023 | + | ||
| 2868 | /* | 3024 | /* |
| 2869 | * 加入视频通话 | 3025 | * 加入视频通话 |
| 2870 | * */ | 3026 | * */ |
| 2871 | - _joinChannel(_params){ | ||
| 2872 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 3027 | + _joinChannel(_params) { |
| 3028 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { | ||
| 2873 | loger.warn("移动端不需要处理加入视频房间"); | 3029 | loger.warn("移动端不需要处理加入视频房间"); |
| 2874 | - return ; | 3030 | + return; |
| 2875 | } | 3031 | } |
| 2876 | - if(_webRtc){ | 3032 | + if (_webRtc) { |
| 2877 | _webRtc.joinChannel(_params); | 3033 | _webRtc.joinChannel(_params); |
| 2878 | } | 3034 | } |
| 2879 | } | 3035 | } |
| 3036 | + | ||
| 2880 | /* | 3037 | /* |
| 2881 | * 离开视频通话频道 | 3038 | * 离开视频通话频道 |
| 2882 | * */ | 3039 | * */ |
| 2883 | - _leaveChannel(_params){ | ||
| 2884 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | ||
| 2885 | - return ; | 3040 | + _leaveChannel(_params) { |
| 3041 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { | ||
| 3042 | + return; | ||
| 2886 | } | 3043 | } |
| 2887 | - if(_webRtc){ | 3044 | + if (_webRtc) { |
| 2888 | _webRtc.leaveChannel(_params); | 3045 | _webRtc.leaveChannel(_params); |
| 2889 | } | 3046 | } |
| 2890 | } | 3047 | } |
| @@ -2892,18 +3049,18 @@ export default class MessageEntrance extends Emiter { | @@ -2892,18 +3049,18 @@ export default class MessageEntrance extends Emiter { | ||
| 2892 | /* | 3049 | /* |
| 2893 | * 发布流 | 3050 | * 发布流 |
| 2894 | * */ | 3051 | * */ |
| 2895 | - _publishMedia(_params){ | 3052 | + _publishMedia(_params) { |
| 2896 | //判断是否能推流,当前课堂推流人数是有限制的 | 3053 | //判断是否能推流,当前课堂推流人数是有限制的 |
| 2897 | - let premission=GlobalConfig.getPublishPermission(); | ||
| 2898 | - loger.log("判断是否能推流->",premission); | ||
| 2899 | - if(!premission&&GlobalConfig.userRole!=ApeConsts.invisible){ | 3054 | + let premission = GlobalConfig.getPublishPermission(); |
| 3055 | + loger.log("判断是否能推流->", premission); | ||
| 3056 | + if (!premission && GlobalConfig.userRole != ApeConsts.invisible) { | ||
| 2900 | loger.warn("不能再打开更多设备"); | 3057 | loger.warn("不能再打开更多设备"); |
| 2901 | - console.log("当前用户列表",GlobalConfig.rosters); | 3058 | + console.log("当前用户列表", GlobalConfig.rosters); |
| 2902 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_WEBRTC_PUBLISH_FULL); | 3059 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_WEBRTC_PUBLISH_FULL); |
| 2903 | - return ; | 3060 | + return; |
| 2904 | } | 3061 | } |
| 2905 | //ios和安卓的只需要更新数据即可 | 3062 | //ios和安卓的只需要更新数据即可 |
| 2906 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 3063 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { |
| 2907 | loger.log("调用webRtc推流"); | 3064 | loger.log("调用webRtc推流"); |
| 2908 | GlobalConfig.openCamera = EngineUtils.creatTimestamp(); | 3065 | GlobalConfig.openCamera = EngineUtils.creatTimestamp(); |
| 2909 | GlobalConfig.openMicrophones = GlobalConfig.openCamera; | 3066 | GlobalConfig.openMicrophones = GlobalConfig.openCamera; |
| @@ -2916,12 +3073,12 @@ export default class MessageEntrance extends Emiter { | @@ -2916,12 +3073,12 @@ export default class MessageEntrance extends Emiter { | ||
| 2916 | openCamera: GlobalConfig.openCamera, | 3073 | openCamera: GlobalConfig.openCamera, |
| 2917 | openMicrophones: GlobalConfig.openMicrophones | 3074 | openMicrophones: GlobalConfig.openMicrophones |
| 2918 | }); | 3075 | }); |
| 2919 | - this._mediaRecordControl({"status":WebRtcApe.RECORD_STATUS_1}); | ||
| 2920 | - return ; | 3076 | + this._mediaRecordControl({"status": WebRtcApe.RECORD_STATUS_1}); |
| 3077 | + return; | ||
| 2921 | } | 3078 | } |
| 2922 | 3079 | ||
| 2923 | //PC端的先推流再同步数据 | 3080 | //PC端的先推流再同步数据 |
| 2924 | - if(_webRtc){ | 3081 | + if (_webRtc) { |
| 2925 | _webRtc.publish(_params); | 3082 | _webRtc.publish(_params); |
| 2926 | } | 3083 | } |
| 2927 | } | 3084 | } |
| @@ -2929,12 +3086,12 @@ export default class MessageEntrance extends Emiter { | @@ -2929,12 +3086,12 @@ export default class MessageEntrance extends Emiter { | ||
| 2929 | /* | 3086 | /* |
| 2930 | * 停止发布流 | 3087 | * 停止发布流 |
| 2931 | * */ | 3088 | * */ |
| 2932 | - _unpublishMedia(_params){ | 3089 | + _unpublishMedia(_params) { |
| 2933 | //ios和安卓的只需要更新数据即可 | 3090 | //ios和安卓的只需要更新数据即可 |
| 2934 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 3091 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { |
| 2935 | loger.log("调用webRtc停止推流"); | 3092 | loger.log("调用webRtc停止推流"); |
| 2936 | - GlobalConfig.openCamera =0; | ||
| 2937 | - GlobalConfig.openMicrophones =0; | 3093 | + GlobalConfig.openCamera = 0; |
| 3094 | + GlobalConfig.openMicrophones = 0; | ||
| 2938 | this.userDeviecStatusChange({ | 3095 | this.userDeviecStatusChange({ |
| 2939 | nodeId: GlobalConfig.nodeId, | 3096 | nodeId: GlobalConfig.nodeId, |
| 2940 | userRole: GlobalConfig.userRole, | 3097 | userRole: GlobalConfig.userRole, |
| @@ -2943,12 +3100,12 @@ export default class MessageEntrance extends Emiter { | @@ -2943,12 +3100,12 @@ export default class MessageEntrance extends Emiter { | ||
| 2943 | openCamera: GlobalConfig.openCamera, | 3100 | openCamera: GlobalConfig.openCamera, |
| 2944 | openMicrophones: GlobalConfig.openMicrophones | 3101 | openMicrophones: GlobalConfig.openMicrophones |
| 2945 | }); | 3102 | }); |
| 2946 | - this._mediaRecordControl({"status":WebRtcApe.RECORD_STATUS_0}); | ||
| 2947 | - return ; | 3103 | + this._mediaRecordControl({"status": WebRtcApe.RECORD_STATUS_0}); |
| 3104 | + return; | ||
| 2948 | } | 3105 | } |
| 2949 | 3106 | ||
| 2950 | - if(_webRtc){ | ||
| 2951 | - this._mediaRecordControl({"status":WebRtcApe.RECORD_STATUS_0}); | 3107 | + if (_webRtc) { |
| 3108 | + this._mediaRecordControl({"status": WebRtcApe.RECORD_STATUS_0}); | ||
| 2952 | _webRtc.unpublish(_params); | 3109 | _webRtc.unpublish(_params); |
| 2953 | } | 3110 | } |
| 2954 | } | 3111 | } |
| @@ -2956,22 +3113,23 @@ export default class MessageEntrance extends Emiter { | @@ -2956,22 +3113,23 @@ export default class MessageEntrance extends Emiter { | ||
| 2956 | /* | 3113 | /* |
| 2957 | * 切换摄像头和麦克风设备 | 3114 | * 切换摄像头和麦克风设备 |
| 2958 | * */ | 3115 | * */ |
| 2959 | - _changeDevices(_params){ | ||
| 2960 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 3116 | + _changeDevices(_params) { |
| 3117 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { | ||
| 2961 | return; | 3118 | return; |
| 2962 | } | 3119 | } |
| 2963 | - if(_webRtc){ | 3120 | + if (_webRtc) { |
| 2964 | _webRtc.changeDevices(_params); | 3121 | _webRtc.changeDevices(_params); |
| 2965 | } | 3122 | } |
| 2966 | } | 3123 | } |
| 3124 | + | ||
| 2967 | /* | 3125 | /* |
| 2968 | * 设置旁路推流 | 3126 | * 设置旁路推流 |
| 2969 | * */ | 3127 | * */ |
| 2970 | - _setConfigPublisher(_params){ | ||
| 2971 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 3128 | + _setConfigPublisher(_params) { |
| 3129 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { | ||
| 2972 | return; | 3130 | return; |
| 2973 | } | 3131 | } |
| 2974 | - if(_webRtc){ | 3132 | + if (_webRtc) { |
| 2975 | _webRtc.setConfigPublisher(_params); | 3133 | _webRtc.setConfigPublisher(_params); |
| 2976 | } | 3134 | } |
| 2977 | } | 3135 | } |
| @@ -2979,22 +3137,23 @@ export default class MessageEntrance extends Emiter { | @@ -2979,22 +3137,23 @@ export default class MessageEntrance extends Emiter { | ||
| 2979 | /* | 3137 | /* |
| 2980 | * 设置本地video视图 | 3138 | * 设置本地video视图 |
| 2981 | * */ | 3139 | * */ |
| 2982 | - _setLocalMediaView(_params){ | ||
| 2983 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 3140 | + _setLocalMediaView(_params) { |
| 3141 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { | ||
| 2984 | return; | 3142 | return; |
| 2985 | } | 3143 | } |
| 2986 | - if(_webRtc){ | 3144 | + if (_webRtc) { |
| 2987 | _webRtc.setLoaclView(_params); | 3145 | _webRtc.setLoaclView(_params); |
| 2988 | } | 3146 | } |
| 2989 | } | 3147 | } |
| 3148 | + | ||
| 2990 | /* | 3149 | /* |
| 2991 | * 设置房间内老师身份的视图 | 3150 | * 设置房间内老师身份的视图 |
| 2992 | * */ | 3151 | * */ |
| 2993 | - _setHostRemoteMediaView(_params){ | ||
| 2994 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 3152 | + _setHostRemoteMediaView(_params) { |
| 3153 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { | ||
| 2995 | return; | 3154 | return; |
| 2996 | } | 3155 | } |
| 2997 | - if(_webRtc){ | 3156 | + if (_webRtc) { |
| 2998 | _webRtc.setHostRemoteMediaView(_params); | 3157 | _webRtc.setHostRemoteMediaView(_params); |
| 2999 | } | 3158 | } |
| 3000 | } | 3159 | } |
| @@ -3002,11 +3161,11 @@ export default class MessageEntrance extends Emiter { | @@ -3002,11 +3161,11 @@ export default class MessageEntrance extends Emiter { | ||
| 3002 | /* | 3161 | /* |
| 3003 | * 设置房间内普通身份的视图 | 3162 | * 设置房间内普通身份的视图 |
| 3004 | * */ | 3163 | * */ |
| 3005 | - _setNormalRemoteMediaView(_params){ | ||
| 3006 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 3164 | + _setNormalRemoteMediaView(_params) { |
| 3165 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { | ||
| 3007 | return; | 3166 | return; |
| 3008 | } | 3167 | } |
| 3009 | - if(_webRtc){ | 3168 | + if (_webRtc) { |
| 3010 | _webRtc.setNormalRemoteMediaView(_params); | 3169 | _webRtc.setNormalRemoteMediaView(_params); |
| 3011 | } | 3170 | } |
| 3012 | } | 3171 | } |
| @@ -3014,28 +3173,28 @@ export default class MessageEntrance extends Emiter { | @@ -3014,28 +3173,28 @@ export default class MessageEntrance extends Emiter { | ||
| 3014 | /* | 3173 | /* |
| 3015 | * 设置RTC视频属性 | 3174 | * 设置RTC视频属性 |
| 3016 | * */ | 3175 | * */ |
| 3017 | - _changeRtcVideoConfig(_params){ | ||
| 3018 | - loger.log("设置RTC视频属性",_params); | ||
| 3019 | - if(!_params){ | 3176 | + _changeRtcVideoConfig(_params) { |
| 3177 | + loger.log("设置RTC视频属性", _params); | ||
| 3178 | + if (!_params) { | ||
| 3020 | return; | 3179 | return; |
| 3021 | } | 3180 | } |
| 3022 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 3181 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { |
| 3023 | return; | 3182 | return; |
| 3024 | } | 3183 | } |
| 3025 | - if(_webRtc){ | 3184 | + if (_webRtc) { |
| 3026 | _webRtc.changeRtcVideoConfig(_params); | 3185 | _webRtc.changeRtcVideoConfig(_params); |
| 3027 | 3186 | ||
| 3028 | //如果是老师和主讲人操作,需要同步给所有人 | 3187 | //如果是老师和主讲人操作,需要同步给所有人 |
| 3029 | - if(GlobalConfig.isTeachOrAssistant){ | ||
| 3030 | - if(_confer_ape){ | ||
| 3031 | - let newVideoScale=_params.videoScale||1; | ||
| 3032 | - if(GlobalConfig.videoScale==newVideoScale){ | ||
| 3033 | - loger.log("不需要设置视频视图大小,没有发生改变",newVideoScale); | 3188 | + if (GlobalConfig.isTeachOrAssistant) { |
| 3189 | + if (_confer_ape) { | ||
| 3190 | + let newVideoScale = _params.videoScale || 1; | ||
| 3191 | + if (GlobalConfig.videoScale == newVideoScale) { | ||
| 3192 | + loger.log("不需要设置视频视图大小,没有发生改变", newVideoScale); | ||
| 3034 | return; | 3193 | return; |
| 3035 | } | 3194 | } |
| 3036 | - loger.log("设置视频视图大小->",newVideoScale); | ||
| 3037 | - GlobalConfig.videoScale=newVideoScale; | ||
| 3038 | - _confer_ape.sendUpdaterClassStatusInfo({videoScale:_params.videoScale}); | 3195 | + loger.log("设置视频视图大小->", newVideoScale); |
| 3196 | + GlobalConfig.videoScale = newVideoScale; | ||
| 3197 | + _confer_ape.sendUpdaterClassStatusInfo({videoScale: _params.videoScale}); | ||
| 3039 | } | 3198 | } |
| 3040 | } | 3199 | } |
| 3041 | } | 3200 | } |
| @@ -3044,75 +3203,77 @@ export default class MessageEntrance extends Emiter { | @@ -3044,75 +3203,77 @@ export default class MessageEntrance extends Emiter { | ||
| 3044 | /* | 3203 | /* |
| 3045 | * 设置监课和需要隐藏显示的用户视图 | 3204 | * 设置监课和需要隐藏显示的用户视图 |
| 3046 | * */ | 3205 | * */ |
| 3047 | - _setInvisibleMediaView(_params){ | ||
| 3048 | - if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 3206 | + _setInvisibleMediaView(_params) { |
| 3207 | + if (GlobalConfig.deviceType == 1 || GlobalConfig.deviceType == 2) { | ||
| 3049 | return; | 3208 | return; |
| 3050 | } | 3209 | } |
| 3051 | - if(_webRtc){ | 3210 | + if (_webRtc) { |
| 3052 | _webRtc.setInvisibleMediaView(_params); | 3211 | _webRtc.setInvisibleMediaView(_params); |
| 3053 | } | 3212 | } |
| 3054 | } | 3213 | } |
| 3214 | + | ||
| 3055 | //设置app相关数据 | 3215 | //设置app相关数据 |
| 3056 | - _setAppConfig(_params){ | ||
| 3057 | - if(!_params){ | 3216 | + _setAppConfig(_params) { |
| 3217 | + if (!_params) { | ||
| 3058 | return; | 3218 | return; |
| 3059 | } | 3219 | } |
| 3060 | - loger.log("设置appConfig",_params); | ||
| 3061 | - if(GlobalConfig.appId){ | 3220 | + loger.log("设置appConfig", _params); |
| 3221 | + if (GlobalConfig.appId) { | ||
| 3062 | loger.log("本地已经设置appConfig,不需要再设置"); | 3222 | loger.log("本地已经设置appConfig,不需要再设置"); |
| 3063 | return; | 3223 | return; |
| 3064 | } | 3224 | } |
| 3065 | - GlobalConfig.appId=_params.appId||""; | ||
| 3066 | - GlobalConfig.appCertificate=_params.appCertificate||""; | ||
| 3067 | - GlobalConfig.appRecordingKey=_params.appRecordingKey||""; | ||
| 3068 | - GlobalConfig.recordInterfaces=_params.recordInterfaces||""; | ||
| 3069 | - GlobalConfig.getChannelToken=_params.getChannelToken||"" | ||
| 3070 | - GlobalConfig.getRecordInfoInterfaces=_params.getRecordInfoInterfaces||""; | ||
| 3071 | - GlobalConfig.stopRecordingInterfaces=_params.stopRecordingInterfaces||""; | ||
| 3072 | - GlobalConfig.getTxRecordInfoInterfaces=_params.getTxRecordInfoInterfaces||""; | ||
| 3073 | - GlobalConfig.getRecordFileURLAgoInterfaces=_params.getRecordFileURLAgoInterfaces||""; | 3225 | + GlobalConfig.appId = _params.appId || ""; |
| 3226 | + GlobalConfig.appCertificate = _params.appCertificate || ""; | ||
| 3227 | + GlobalConfig.appRecordingKey = _params.appRecordingKey || ""; | ||
| 3228 | + GlobalConfig.recordInterfaces = _params.recordInterfaces || ""; | ||
| 3229 | + GlobalConfig.getChannelToken = _params.getChannelToken || "" | ||
| 3230 | + GlobalConfig.getRecordInfoInterfaces = _params.getRecordInfoInterfaces || ""; | ||
| 3231 | + GlobalConfig.stopRecordingInterfaces = _params.stopRecordingInterfaces || ""; | ||
| 3232 | + GlobalConfig.getTxRecordInfoInterfaces = _params.getTxRecordInfoInterfaces || ""; | ||
| 3233 | + GlobalConfig.getRecordFileURLAgoInterfaces = _params.getRecordFileURLAgoInterfaces || ""; | ||
| 3074 | 3234 | ||
| 3075 | //去掉协议头 | 3235 | //去掉协议头 |
| 3076 | - try{ | ||
| 3077 | - if(GlobalConfig.recordInterfaces){ | ||
| 3078 | - GlobalConfig.recordInterfaces=GlobalConfig.recordInterfaces.replace('http://',""); | ||
| 3079 | - GlobalConfig.recordInterfaces=GlobalConfig.recordInterfaces.replace('https://',""); | 3236 | + try { |
| 3237 | + if (GlobalConfig.recordInterfaces) { | ||
| 3238 | + GlobalConfig.recordInterfaces = GlobalConfig.recordInterfaces.replace('http://', ""); | ||
| 3239 | + GlobalConfig.recordInterfaces = GlobalConfig.recordInterfaces.replace('https://', ""); | ||
| 3080 | } | 3240 | } |
| 3081 | - if(GlobalConfig.getRecordInfoInterfaces){ | ||
| 3082 | - GlobalConfig.getRecordInfoInterfaces=GlobalConfig.getRecordInfoInterfaces.replace('http://',""); | ||
| 3083 | - GlobalConfig.getRecordInfoInterfaces=GlobalConfig.getRecordInfoInterfaces.replace('https://',""); | 3241 | + if (GlobalConfig.getRecordInfoInterfaces) { |
| 3242 | + GlobalConfig.getRecordInfoInterfaces = GlobalConfig.getRecordInfoInterfaces.replace('http://', ""); | ||
| 3243 | + GlobalConfig.getRecordInfoInterfaces = GlobalConfig.getRecordInfoInterfaces.replace('https://', ""); | ||
| 3084 | } | 3244 | } |
| 3085 | - if(GlobalConfig.getTxRecordInfoInterfaces){ | ||
| 3086 | - GlobalConfig.getTxRecordInfoInterfaces=GlobalConfig.getTxRecordInfoInterfaces.replace('http://',""); | ||
| 3087 | - GlobalConfig.getTxRecordInfoInterfaces=GlobalConfig.getTxRecordInfoInterfaces.replace('https://',""); | 3245 | + if (GlobalConfig.getTxRecordInfoInterfaces) { |
| 3246 | + GlobalConfig.getTxRecordInfoInterfaces = GlobalConfig.getTxRecordInfoInterfaces.replace('http://', ""); | ||
| 3247 | + GlobalConfig.getTxRecordInfoInterfaces = GlobalConfig.getTxRecordInfoInterfaces.replace('https://', ""); | ||
| 3088 | } | 3248 | } |
| 3089 | - if(GlobalConfig.getRecordFileURLAgoInterfaces){ | ||
| 3090 | - GlobalConfig.getRecordFileURLAgoInterfaces=GlobalConfig.getRecordFileURLAgoInterfaces.replace('http://',""); | ||
| 3091 | - GlobalConfig.getRecordFileURLAgoInterfaces=GlobalConfig.getRecordFileURLAgoInterfaces.replace('https://',""); | 3249 | + if (GlobalConfig.getRecordFileURLAgoInterfaces) { |
| 3250 | + GlobalConfig.getRecordFileURLAgoInterfaces = GlobalConfig.getRecordFileURLAgoInterfaces.replace('http://', ""); | ||
| 3251 | + GlobalConfig.getRecordFileURLAgoInterfaces = GlobalConfig.getRecordFileURLAgoInterfaces.replace('https://', ""); | ||
| 3092 | } | 3252 | } |
| 3093 | 3253 | ||
| 3094 | - if(GlobalConfig.stopRecordingInterfaces){ | ||
| 3095 | - GlobalConfig.stopRecordingInterfaces=GlobalConfig.stopRecordingInterfaces.replace('http://',""); | ||
| 3096 | - GlobalConfig.stopRecordingInterfaces=GlobalConfig.stopRecordingInterfaces.replace('https://',""); | 3254 | + if (GlobalConfig.stopRecordingInterfaces) { |
| 3255 | + GlobalConfig.stopRecordingInterfaces = GlobalConfig.stopRecordingInterfaces.replace('http://', ""); | ||
| 3256 | + GlobalConfig.stopRecordingInterfaces = GlobalConfig.stopRecordingInterfaces.replace('https://', ""); | ||
| 3097 | } | 3257 | } |
| 3098 | - if(GlobalConfig.getChannelToken){ | ||
| 3099 | - GlobalConfig.getChannelToken=GlobalConfig.getChannelToken.replace('http://',""); | ||
| 3100 | - GlobalConfig.getChannelToken=GlobalConfig.getChannelToken.replace('https://',""); | 3258 | + if (GlobalConfig.getChannelToken) { |
| 3259 | + GlobalConfig.getChannelToken = GlobalConfig.getChannelToken.replace('http://', ""); | ||
| 3260 | + GlobalConfig.getChannelToken = GlobalConfig.getChannelToken.replace('https://', ""); | ||
| 3101 | } | 3261 | } |
| 3102 | - }catch (err){ | 3262 | + } catch (err) { |
| 3103 | 3263 | ||
| 3104 | } | 3264 | } |
| 3105 | 3265 | ||
| 3106 | 3266 | ||
| 3107 | } | 3267 | } |
| 3268 | + | ||
| 3108 | //录制状态控制和推流状态控制 | 3269 | //录制状态控制和推流状态控制 |
| 3109 | - _mediaRecordControl(_params){ | ||
| 3110 | - if(!GlobalConfig.recordInterfaces||!_params){ | ||
| 3111 | - loger.log("录制控制->失败->接口地址无效",_params); | ||
| 3112 | - return ; | 3270 | + _mediaRecordControl(_params) { |
| 3271 | + if (!GlobalConfig.recordInterfaces || !_params) { | ||
| 3272 | + loger.log("录制控制->失败->接口地址无效", _params); | ||
| 3273 | + return; | ||
| 3113 | } | 3274 | } |
| 3114 | - if(_webRtc){ | ||
| 3115 | - switch (_params.status){ | 3275 | + if (_webRtc) { |
| 3276 | + switch (_params.status) { | ||
| 3116 | case WebRtcApe.RECORD_STATUS_0: | 3277 | case WebRtcApe.RECORD_STATUS_0: |
| 3117 | case WebRtcApe.RECORD_STATUS_1: | 3278 | case WebRtcApe.RECORD_STATUS_1: |
| 3118 | //推流/停止推流/开启录制 统一使用一个接口 | 3279 | //推流/停止推流/开启录制 统一使用一个接口 |
| @@ -3127,14 +3288,15 @@ export default class MessageEntrance extends Emiter { | @@ -3127,14 +3288,15 @@ export default class MessageEntrance extends Emiter { | ||
| 3127 | } | 3288 | } |
| 3128 | } | 3289 | } |
| 3129 | } | 3290 | } |
| 3291 | + | ||
| 3130 | //webRtc-----------------end -------------------------------- | 3292 | //webRtc-----------------end -------------------------------- |
| 3131 | //判断是否能推流,当前课堂推流人数是有限制的 | 3293 | //判断是否能推流,当前课堂推流人数是有限制的 |
| 3132 | - _hasFreePublishChannel(){ | ||
| 3133 | - let premission=GlobalConfig.getPublishPermission(); | ||
| 3134 | - loger.log("判断是否能推流->",premission); | ||
| 3135 | - if(!premission&&GlobalConfig.userRole!=ApeConsts.invisible){ | 3294 | + _hasFreePublishChannel() { |
| 3295 | + let premission = GlobalConfig.getPublishPermission(); | ||
| 3296 | + loger.log("判断是否能推流->", premission); | ||
| 3297 | + if (!premission && GlobalConfig.userRole != ApeConsts.invisible) { | ||
| 3136 | loger.warn("不能再打开更多设备"); | 3298 | loger.warn("不能再打开更多设备"); |
| 3137 | - console.log("当前用户列表",GlobalConfig.rosters); | 3299 | + console.log("当前用户列表", GlobalConfig.rosters); |
| 3138 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_WEBRTC_PUBLISH_FULL); | 3300 | this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_WEBRTC_PUBLISH_FULL); |
| 3139 | return premission; | 3301 | return premission; |
| 3140 | } | 3302 | } |
| @@ -862,8 +862,74 @@ class Sass extends Emiter { | @@ -862,8 +862,74 @@ class Sass extends Emiter { | ||
| 862 | this._emit(Sass.SASS_GET_QUESTION_RESULT_FAILED); | 862 | this._emit(Sass.SASS_GET_QUESTION_RESULT_FAILED); |
| 863 | }); | 863 | }); |
| 864 | } | 864 | } |
| 865 | - | ||
| 866 | //点名--------------------------------------------------------- | 865 | //点名--------------------------------------------------------- |
| 866 | + | ||
| 867 | + | ||
| 868 | + //获取课堂保存的信息 | ||
| 869 | + getClassRecordInfo(_callback){ | ||
| 870 | + //http://networkschool.xuedianyun.com/server/recordInfo/getOldRecordInfo | ||
| 871 | + let path="networkschool.xuedianyun.com/server/recordInfo/getOldRecordInfo"; | ||
| 872 | + let url = `${GlobalConfig.locationProtocol+path}`; | ||
| 873 | + loger.log('获取课堂保存的状态信息', url); | ||
| 874 | + //接口中用的是GET | ||
| 875 | + fetch(encodeURI(url), { | ||
| 876 | + method: 'POST', | ||
| 877 | + headers: { | ||
| 878 | + "Content-Type": "application/x-www-form-urlencoded; charset=utf-8" | ||
| 879 | + }, | ||
| 880 | + body: `meetingNumber=${ GlobalConfig.classId}`, | ||
| 881 | + timeout: 5000 | ||
| 882 | + }) | ||
| 883 | + .then(ret => { | ||
| 884 | + if (ret.ok) { | ||
| 885 | + return ret.json(); | ||
| 886 | + } else { | ||
| 887 | + loger.error(`获取课堂保存的状态信息-网络异常.状态码:${ret}`); | ||
| 888 | + if(_callback){ | ||
| 889 | + _callback(); | ||
| 890 | + } | ||
| 891 | + throw ''; | ||
| 892 | + } | ||
| 893 | + }) | ||
| 894 | + .then(ret => { | ||
| 895 | + loger.log('获取课堂保存的状态信息-完成'); | ||
| 896 | + /* { | ||
| 897 | + "code": 200, | ||
| 898 | + "returnData": { | ||
| 899 | + "data": { | ||
| 900 | + "id": 28, | ||
| 901 | + "meeting_number": "1170105412", | ||
| 902 | + "info": "{\"siteId\":\"h5dev\",\"classId\":1170105412,\"className\":\"mcuClientSdk20170318\",\"classType\":1,\"classStatus\":2,\"classStartTime\":\"2017-3-24-20-9-56\",\"classStopTime\":\"2017-3-28-22-20-56\",\"classTimestamp\":25402,\"recordPlaybackMaxTime\":0,\"classBeginTime\":\"2017-03-18 19:00:00\",\"classEndTime\":\"2017-03-29 21:00:00\",\"recordStatus\":false,\"recordTimestamp\":0,\"recordFileName\":\"h5dev/20170318/1170105412_20170318.rec\",\"recordDownloadUrl\":\"\",\"serverTimestamp\":1490710856,\"activeDocId\":666519474,\"activeDocCurPage\":1}", | ||
| 903 | + "create_time": "2017-03-18T21:12:19.000Z" | ||
| 904 | + } | ||
| 905 | + } | ||
| 906 | + }*/ | ||
| 907 | + if(ret&&ret.code==200){ | ||
| 908 | + try{ | ||
| 909 | + if(ret.returnData&&ret.returnData.data){ | ||
| 910 | + if(_callback) { | ||
| 911 | + _callback(ret.returnData.data.info); | ||
| 912 | + } | ||
| 913 | + } | ||
| 914 | + }catch (err){ | ||
| 915 | + if(_callback){ | ||
| 916 | + _callback(); | ||
| 917 | + } | ||
| 918 | + } | ||
| 919 | + | ||
| 920 | + }else { | ||
| 921 | + if(_callback){ | ||
| 922 | + _callback(); | ||
| 923 | + } | ||
| 924 | + } | ||
| 925 | + }) | ||
| 926 | + .catch(err => { | ||
| 927 | + loger.error(`AGOR-获取媒体录制信息-异常.状态码:${err}`); | ||
| 928 | + if(_callback){ | ||
| 929 | + _callback(); | ||
| 930 | + } | ||
| 931 | + }); | ||
| 932 | + } | ||
| 867 | } | 933 | } |
| 868 | 934 | ||
| 869 | Sass.prototype.SUCCESS = Sass.SUCCESS = 'Sass_success'; | 935 | Sass.prototype.SUCCESS = Sass.SUCCESS = 'Sass_success'; |
| @@ -180,7 +180,7 @@ class SystemConfig { | @@ -180,7 +180,7 @@ class SystemConfig { | ||
| 180 | if (window.clientInformation.languages.length > 2) { | 180 | if (window.clientInformation.languages.length > 2) { |
| 181 | Sys.explorer = "chrome"; | 181 | Sys.explorer = "chrome"; |
| 182 | loger.log("chrome", Sys); | 182 | loger.log("chrome", Sys); |
| 183 | - } else if (window.clientInformation.languages.length == 2&&versionNum<60) { | 183 | + } else if (window.clientInformation.languages.length == 2&&versionNum<55) { |
| 184 | var _track = 'track' in document.createElement('track'); | 184 | var _track = 'track' in document.createElement('track'); |
| 185 | var webstoreKeysLength = window.chrome && window.chrome.webstore ? Object.keys(window.chrome.webstore).length : 0; | 185 | var webstoreKeysLength = window.chrome && window.chrome.webstore ? Object.keys(window.chrome.webstore).length : 0; |
| 186 | if (_track) { | 186 | if (_track) { |
| @@ -110,6 +110,7 @@ ApeConsts.MEDIA_TYPE_DEFAULT = 0; //没有类型 | @@ -110,6 +110,7 @@ ApeConsts.MEDIA_TYPE_DEFAULT = 0; //没有类型 | ||
| 110 | ApeConsts.MEDIA_TYPE_VIDEO = 1; //视频流(包含音频) | 110 | ApeConsts.MEDIA_TYPE_VIDEO = 1; //视频流(包含音频) |
| 111 | ApeConsts.MEDIA_TYPE_AUDIO = 2; //音频流 | 111 | ApeConsts.MEDIA_TYPE_AUDIO = 2; //音频流 |
| 112 | ApeConsts.MEDIA_TYPE_SHARE = 3; //屏幕共享 | 112 | ApeConsts.MEDIA_TYPE_SHARE = 3; //屏幕共享 |
| 113 | +ApeConsts.MEDIA_TYPE_EXTERNAL_LINK = 4; //外部推流地址 | ||
| 113 | 114 | ||
| 114 | //return返回值状态 | 115 | //return返回值状态 |
| 115 | ApeConsts.RETURN_SUCCESS = 0; //成功 | 116 | ApeConsts.RETURN_SUCCESS = 0; //成功 |
| @@ -684,7 +684,7 @@ class DocApe extends Ape { | @@ -684,7 +684,7 @@ class DocApe extends Ape { | ||
| 684 | let tempDocItemIdx;//临时记录文档数据,用于显示默认文档 | 684 | let tempDocItemIdx;//临时记录文档数据,用于显示默认文档 |
| 685 | for (let key in this.docList) { | 685 | for (let key in this.docList) { |
| 686 | tempDocItemIdx = this.docList[key]; | 686 | tempDocItemIdx = this.docList[key]; |
| 687 | - if (tempDocItemIdx) { | 687 | + if (tempDocItemIdx&&tempDocItemIdx.fileType!="video") { |
| 688 | loger.log("选择一个文档作为默认文档显示->", tempDocItemIdx); | 688 | loger.log("选择一个文档作为默认文档显示->", tempDocItemIdx); |
| 689 | let paramInfo = { | 689 | let paramInfo = { |
| 690 | "itemIdx": tempDocItemIdx.itemIdx, | 690 | "itemIdx": tempDocItemIdx.itemIdx, |
| @@ -763,6 +763,13 @@ class DocApe extends Ape { | @@ -763,6 +763,13 @@ class DocApe extends Ape { | ||
| 763 | docModelPdu.showType = _param.showType || 0;//文档显示模式 | 763 | docModelPdu.showType = _param.showType || 0;//文档显示模式 |
| 764 | docModelPdu.animationStep = _param.animationStep || 1;//当前页面上的动画步数(动态ppt时有这个字段) | 764 | docModelPdu.animationStep = _param.animationStep || 1;//当前页面上的动画步数(动态ppt时有这个字段) |
| 765 | //loger.log(docModelPdu); | 765 | //loger.log(docModelPdu); |
| 766 | + | ||
| 767 | + //新增的外部流数据, | ||
| 768 | + docModelPdu.publishUrl = _param.rtmpUrl||""; | ||
| 769 | + docModelPdu.rtmpUrl = _param.rtmpUrl||""; | ||
| 770 | + docModelPdu.m3u8Url = _param.m3u8Url||""; | ||
| 771 | + docModelPdu.replay = _param.replay||""; | ||
| 772 | + | ||
| 766 | return docModelPdu; | 773 | return docModelPdu; |
| 767 | } | 774 | } |
| 768 | 775 |
| @@ -138,6 +138,24 @@ class ShareApe extends Emiter { | @@ -138,6 +138,24 @@ class ShareApe extends Emiter { | ||
| 138 | this.shareScreen.startConnect(this.fullIpPort); | 138 | this.shareScreen.startConnect(this.fullIpPort); |
| 139 | } | 139 | } |
| 140 | } | 140 | } |
| 141 | + /* | ||
| 142 | + * 推送外部流地址 | ||
| 143 | + * */ | ||
| 144 | + publishExternalLink(_result) { | ||
| 145 | + /* return {"code": ApeConsts.RETURN_SUCCESS, | ||
| 146 | + "data":"", | ||
| 147 | + "mediaId":shareChannel, | ||
| 148 | + "publishUrl": publishUrl, | ||
| 149 | + "streamId":streamId, | ||
| 150 | + "port":"" | ||
| 151 | + };*/ | ||
| 152 | + clearTimeout(this.reConnectTimer); | ||
| 153 | + //if (_result) { | ||
| 154 | + // this.publishUrl = _result.publishUrl || ''; | ||
| 155 | + // this.streamId = _result.streamId || ''; | ||
| 156 | + //} | ||
| 157 | + this._emit(MessageTypes.PUBLISH_SCREEN_SHARE_SUCCESS,_result); | ||
| 158 | + } | ||
| 141 | 159 | ||
| 142 | //屏幕共享推流,如果没有连接需要先建立连接 | 160 | //屏幕共享推流,如果没有连接需要先建立连接 |
| 143 | publish(_result) { | 161 | publish(_result) { |
| @@ -254,7 +254,7 @@ class VideoApe extends Ape { | @@ -254,7 +254,7 @@ class VideoApe extends Ape { | ||
| 254 | this.stopPublishVideo(_data) | 254 | this.stopPublishVideo(_data) |
| 255 | } | 255 | } |
| 256 | } | 256 | } |
| 257 | - //==========================屏幕共享========================================================================= | 257 | + //-----------------------屏幕共享----------------------- |
| 258 | 258 | ||
| 259 | //屏幕共享连接打开 | 259 | //屏幕共享连接打开 |
| 260 | onPublishScreenShareFaile() { | 260 | onPublishScreenShareFaile() { |
| @@ -291,8 +291,8 @@ class VideoApe extends Ape { | @@ -291,8 +291,8 @@ class VideoApe extends Ape { | ||
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | //监听屏幕共享发布成功 | 293 | //监听屏幕共享发布成功 |
| 294 | - onPublishScreenShareSuccess() { | ||
| 295 | - loger.log('屏幕共享推流成功之后才能更新同步消息->'); | 294 | + onPublishScreenShareSuccess(data) { |
| 295 | + loger.log('屏幕共享推流成功之后才能更新同步消息->',data); | ||
| 296 | //屏幕共享推流成功之后才能更新同步消息 | 296 | //屏幕共享推流成功之后才能更新同步消息 |
| 297 | let channelInfo = this.shareApe.getPublishChannelInfo(); | 297 | let channelInfo = this.shareApe.getPublishChannelInfo(); |
| 298 | this.sendTableUpdateHandler(channelInfo); | 298 | this.sendTableUpdateHandler(channelInfo); |
| @@ -337,14 +337,48 @@ class VideoApe extends Ape { | @@ -337,14 +337,48 @@ class VideoApe extends Ape { | ||
| 337 | let channelInfo = this.shareApe.getDefaultChannelInfo(); | 337 | let channelInfo = this.shareApe.getDefaultChannelInfo(); |
| 338 | channelInfo.status = ApeConsts.CHANNEL_STATUS_RELEASED; | 338 | channelInfo.status = ApeConsts.CHANNEL_STATUS_RELEASED; |
| 339 | this.sendTableUpdateHandler(channelInfo); | 339 | this.sendTableUpdateHandler(channelInfo); |
| 340 | - | ||
| 341 | this.shareApe.stopPublish(); | 340 | this.shareApe.stopPublish(); |
| 342 | } | 341 | } |
| 342 | + } | ||
| 343 | + | ||
| 344 | + //-----------------------屏幕共享 end----------------------- | ||
| 343 | 345 | ||
| 346 | + //-----------------------推送和停止外部流地址---------------- | ||
| 347 | + //推送外部流地址 | ||
| 348 | + publishExternalLink(_param) { | ||
| 349 | + loger.log('推送外部流地址->',_param); | ||
| 350 | + //屏幕共享推流成功之后才能更新同步消息 | ||
| 351 | + let channelInfo = this.shareApe.getPublishChannelInfo(); | ||
| 352 | + channelInfo.mediaType = ApeConsts.MEDIA_TYPE_EXTERNAL_LINK;//外部推流地址 | ||
| 353 | + //如果 | ||
| 354 | + if(_param){ | ||
| 355 | + channelInfo.publishUrl=_param.rtmpUrl||"";//推流拉流地址一样 | ||
| 356 | + channelInfo.m3u8Url=_param.m3u8Url||""; | ||
| 357 | + channelInfo.rtmpUrl=_param.rtmpUrl||""; | ||
| 358 | + channelInfo.replay=_param.replay||""; | ||
| 359 | + } | ||
| 360 | + this.sendTableUpdateHandler(channelInfo); | ||
| 344 | } | 361 | } |
| 345 | 362 | ||
| 346 | - //=============================屏幕共享 end================================================= | 363 | + //停止推送外部流地址 |
| 364 | + stopPublishExternalLink(_param) { | ||
| 365 | + loger.log('停止推送外部流地址->', _param); | ||
| 366 | + if (!this.mcu.connected) { | ||
| 367 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 368 | + return {"code": ApeConsts.RETURN_FAILED, "data": "已经断开连接"}; | ||
| 369 | + } | ||
| 370 | + //只有老师能停止屏幕共享 | ||
| 371 | + if (GlobalConfig.isHost||GlobalConfig.isAssistant||GlobalConfig.isPresenter) { | ||
| 372 | + let channelInfo = this.shareApe.getDefaultChannelInfo(); | ||
| 373 | + channelInfo.status = ApeConsts.CHANNEL_STATUS_RELEASED; | ||
| 374 | + channelInfo.mediaType=ApeConsts.MEDIA_TYPE_EXTERNAL_LINK; | ||
| 375 | + this.sendTableUpdateHandler(channelInfo); | ||
| 376 | + //调用停止的时候自己的也要停止,同步的消息不会再发给自己 | ||
| 377 | + this._emit(MessageTypes.SCREEN_SHARE_STOP, channelInfo); | ||
| 378 | + } | ||
| 379 | + } | ||
| 347 | 380 | ||
| 381 | + //-----------------------推送和停止外部流地址END------------- | ||
| 348 | //释放nodeId占用的指定的channelId频道 | 382 | //释放nodeId占用的指定的channelId频道 |
| 349 | _releaseChannelForNodeId(nodeId, channelId) { | 383 | _releaseChannelForNodeId(nodeId, channelId) { |
| 350 | loger.log(nodeId, "停止-->channelId", channelId); | 384 | loger.log(nodeId, "停止-->channelId", channelId); |
| @@ -609,11 +643,14 @@ class VideoApe extends Ape { | @@ -609,11 +643,14 @@ class VideoApe extends Ape { | ||
| 609 | unpackChannelInfo.streamId = ""; | 643 | unpackChannelInfo.streamId = ""; |
| 610 | } | 644 | } |
| 611 | //屏幕共享的流不保存 | 645 | //屏幕共享的流不保存 |
| 612 | - if (unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_SHARE && unpackChannelInfo.channelId > 0) { | 646 | + if (unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_SHARE && |
| 647 | + unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_EXTERNAL_LINK && | ||
| 648 | + unpackChannelInfo.channelId > 0) { | ||
| 613 | this.mediaModule.mediaChannels[itemIdx] = unpackChannelInfo; | 649 | this.mediaModule.mediaChannels[itemIdx] = unpackChannelInfo; |
| 614 | } | 650 | } |
| 615 | 651 | ||
| 616 | - if (unpackChannelInfo && unpackChannelInfo.fromNodeId != GlobalConfig.nodeId) { | 652 | + //数据存在并且不是自己发送的消息,或者是外部设置的播放地址 |
| 653 | + if (unpackChannelInfo && (unpackChannelInfo.fromNodeId != GlobalConfig.nodeId||unpackChannelInfo.mediaType== ApeConsts.MEDIA_TYPE_EXTERNAL_LINK)) { | ||
| 617 | let receiveChannelInfo = {}; | 654 | let receiveChannelInfo = {}; |
| 618 | receiveChannelInfo.mediaId = unpackChannelInfo.channelId; | 655 | receiveChannelInfo.mediaId = unpackChannelInfo.channelId; |
| 619 | receiveChannelInfo.fromNodeId = unpackChannelInfo.fromNodeId; | 656 | receiveChannelInfo.fromNodeId = unpackChannelInfo.fromNodeId; |
| @@ -639,6 +676,7 @@ class VideoApe extends Ape { | @@ -639,6 +676,7 @@ class VideoApe extends Ape { | ||
| 639 | "type": "m3u8", | 676 | "type": "m3u8", |
| 640 | "streamId": unpackChannelInfo.streamId | 677 | "streamId": unpackChannelInfo.streamId |
| 641 | }); | 678 | }); |
| 679 | + | ||
| 642 | //如果接收的消息中已经有拉流地址,优先使用 | 680 | //如果接收的消息中已经有拉流地址,优先使用 |
| 643 | if(unpackChannelInfo.m3u8Url){ | 681 | if(unpackChannelInfo.m3u8Url){ |
| 644 | m3u8Stream.playUrl=unpackChannelInfo.m3u8Url; | 682 | m3u8Stream.playUrl=unpackChannelInfo.m3u8Url; |
| @@ -646,6 +684,9 @@ class VideoApe extends Ape { | @@ -646,6 +684,9 @@ class VideoApe extends Ape { | ||
| 646 | if(unpackChannelInfo.rtmpUrl){ | 684 | if(unpackChannelInfo.rtmpUrl){ |
| 647 | rtmpStream.playUrl=unpackChannelInfo.rtmpUrl; | 685 | rtmpStream.playUrl=unpackChannelInfo.rtmpUrl; |
| 648 | } | 686 | } |
| 687 | + if(unpackChannelInfo.replay){ | ||
| 688 | + replay.playUrl=unpackChannelInfo.replay; | ||
| 689 | + } | ||
| 649 | 690 | ||
| 650 | 691 | ||
| 651 | if (m3u8Stream.code == 0) { | 692 | if (m3u8Stream.code == 0) { |
| @@ -658,7 +699,9 @@ class VideoApe extends Ape { | @@ -658,7 +699,9 @@ class VideoApe extends Ape { | ||
| 658 | receiveChannelInfo.replay = replay.playUrl; | 699 | receiveChannelInfo.replay = replay.playUrl; |
| 659 | } | 700 | } |
| 660 | 701 | ||
| 661 | - if (unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_SHARE) { | 702 | + if (unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_SHARE&& |
| 703 | + unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_EXTERNAL_LINK | ||
| 704 | + ) { | ||
| 662 | //广播播放视频的消息 | 705 | //广播播放视频的消息 |
| 663 | loger.log("VIDEO_PLAY", receiveChannelInfo); | 706 | loger.log("VIDEO_PLAY", receiveChannelInfo); |
| 664 | this._emit(MessageTypes.VIDEO_PLAY, receiveChannelInfo); | 707 | this._emit(MessageTypes.VIDEO_PLAY, receiveChannelInfo); |
| @@ -669,7 +712,9 @@ class VideoApe extends Ape { | @@ -669,7 +712,9 @@ class VideoApe extends Ape { | ||
| 669 | 712 | ||
| 670 | } | 713 | } |
| 671 | } else { | 714 | } else { |
| 672 | - if (unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_SHARE) { | 715 | + if (unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_SHARE&& |
| 716 | + unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_EXTERNAL_LINK | ||
| 717 | + ) { | ||
| 673 | //停止播放视频 | 718 | //停止播放视频 |
| 674 | loger.log("VIDEO_STOP", receiveChannelInfo); | 719 | loger.log("VIDEO_STOP", receiveChannelInfo); |
| 675 | this._emit(MessageTypes.VIDEO_STOP, receiveChannelInfo); | 720 | this._emit(MessageTypes.VIDEO_STOP, receiveChannelInfo); |
| @@ -679,7 +724,6 @@ class VideoApe extends Ape { | @@ -679,7 +724,6 @@ class VideoApe extends Ape { | ||
| 679 | loger.log("SCREEN_SHARE_STOP", receiveChannelInfo); | 724 | loger.log("SCREEN_SHARE_STOP", receiveChannelInfo); |
| 680 | this._emit(MessageTypes.SCREEN_SHARE_STOP, receiveChannelInfo); | 725 | this._emit(MessageTypes.SCREEN_SHARE_STOP, receiveChannelInfo); |
| 681 | } else { | 726 | } else { |
| 682 | - | ||
| 683 | loger.log("停止播放视频->channelId=0->不合法的id", receiveChannelInfo); | 727 | loger.log("停止播放视频->channelId=0->不合法的id", receiveChannelInfo); |
| 684 | } | 728 | } |
| 685 | } | 729 | } |
| @@ -697,7 +741,9 @@ class VideoApe extends Ape { | @@ -697,7 +741,9 @@ class VideoApe extends Ape { | ||
| 697 | } | 741 | } |
| 698 | 742 | ||
| 699 | //更新用户的摄像头和麦克风状态 | 743 | //更新用户的摄像头和麦克风状态 |
| 700 | - if (unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_SHARE) { | 744 | + if (unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_SHARE&& |
| 745 | + unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_EXTERNAL_LINK | ||
| 746 | + ) { | ||
| 701 | //非屏幕共享的情况下才更新状态 | 747 | //非屏幕共享的情况下才更新状态 |
| 702 | this._emit(MessageTypes.USER_DEVICE_STATUS_CHAANGE, { | 748 | this._emit(MessageTypes.USER_DEVICE_STATUS_CHAANGE, { |
| 703 | nodeId: GlobalConfig.nodeId, | 749 | nodeId: GlobalConfig.nodeId, |
| @@ -709,7 +755,9 @@ class VideoApe extends Ape { | @@ -709,7 +755,9 @@ class VideoApe extends Ape { | ||
| 709 | }); | 755 | }); |
| 710 | } | 756 | } |
| 711 | } | 757 | } |
| 712 | - if (unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_SHARE) { | 758 | + if (unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_SHARE&& |
| 759 | + unpackChannelInfo.mediaType != ApeConsts.MEDIA_TYPE_EXTERNAL_LINK | ||
| 760 | + ) { | ||
| 713 | //非屏幕共享情况的处理 | 761 | //非屏幕共享情况的处理 |
| 714 | MediaModule.allMediaChannelsList[itemIdx] = unpackChannelInfo; | 762 | MediaModule.allMediaChannelsList[itemIdx] = unpackChannelInfo; |
| 715 | console.log('MediaModule.allMediaChannelsList', MediaModule.allMediaChannelsList); | 763 | console.log('MediaModule.allMediaChannelsList', MediaModule.allMediaChannelsList); |
| @@ -798,6 +846,7 @@ class VideoApe extends Ape { | @@ -798,6 +846,7 @@ class VideoApe extends Ape { | ||
| 798 | packPduModel.streamId = _param.streamId || ""; | 846 | packPduModel.streamId = _param.streamId || ""; |
| 799 | packPduModel.m3u8Url=_param.m3u8Url || ""; | 847 | packPduModel.m3u8Url=_param.m3u8Url || ""; |
| 800 | packPduModel.rtmpUrl=_param.rtmpUrl || ""; | 848 | packPduModel.rtmpUrl=_param.rtmpUrl || ""; |
| 849 | + packPduModel.replay=_param.replay || ""; | ||
| 801 | 850 | ||
| 802 | packPduModel.siteId = _param.siteId || GlobalConfig.siteId;//GlobalConfig.siteId; | 851 | packPduModel.siteId = _param.siteId || GlobalConfig.siteId;//GlobalConfig.siteId; |
| 803 | packPduModel.classId = parseInt(_param.classId) || parseInt(GlobalConfig.classId); | 852 | packPduModel.classId = parseInt(_param.classId) || parseInt(GlobalConfig.classId); |
| @@ -743,7 +743,10 @@ message RCDocSendDataModelPdu { | @@ -743,7 +743,10 @@ message RCDocSendDataModelPdu { | ||
| 743 | optional uint32 show_type=19;//文档显示模式 | 743 | optional uint32 show_type=19;//文档显示模式 |
| 744 | optional uint32 animation_step=20 [default =1];//当前页码的动画步数 | 744 | optional uint32 animation_step=20 [default =1];//当前页码的动画步数 |
| 745 | optional bool isFullScreen=21 ;//是否全屏显示 | 745 | optional bool isFullScreen=21 ;//是否全屏显示 |
| 746 | - | 746 | + optional string publishUrl=22; |
| 747 | + optional string rtmpUrl=23; | ||
| 748 | + optional string m3u8Url=24; | ||
| 749 | + optional string replay=25; | ||
| 747 | } | 750 | } |
| 748 | 751 | ||
| 749 | message RCMediaSharedSendDataModelPdu { | 752 | message RCMediaSharedSendDataModelPdu { |
| @@ -855,6 +858,7 @@ message RCVideoChannelInfoPdu { | @@ -855,6 +858,7 @@ message RCVideoChannelInfoPdu { | ||
| 855 | optional string optionJsonData =16;//其他参数的json对象 | 858 | optional string optionJsonData =16;//其他参数的json对象 |
| 856 | optional string m3u8Url =17;//m3u8拉流地址 | 859 | optional string m3u8Url =17;//m3u8拉流地址 |
| 857 | optional string rtmpUrl =18;//rtmp拉流地址 | 860 | optional string rtmpUrl =18;//rtmp拉流地址 |
| 861 | + optional string replay =19;//回放的拉流地址 | ||
| 858 | } | 862 | } |
| 859 | 863 | ||
| 860 | message RCVideoChannelInfoRecordPdu { | 864 | message RCVideoChannelInfoRecordPdu { |
-
请 注册 或 登录 后发表评论