正在显示
5 个修改的文件
包含
145 行增加
和
67 行删除
| @@ -250,8 +250,8 @@ class ServerCheck extends Emiter { | @@ -250,8 +250,8 @@ class ServerCheck extends Emiter { | ||
| 250 | } else { | 250 | } else { |
| 251 | GlobalConfig.MCUServerIP = tempMcuIp; | 251 | GlobalConfig.MCUServerIP = tempMcuIp; |
| 252 | GlobalConfig.MCUServerPort = tempMcuPort; | 252 | GlobalConfig.MCUServerPort = tempMcuPort; |
| 253 | - GlobalConfig.MSServerIP = tempMsIp; | ||
| 254 | - GlobalConfig.MSServerPort = tempMsPort; | 253 | + GlobalConfig.MS_PUBLISH_IP = tempMsIp; |
| 254 | + GlobalConfig.MS_PUBLISH_PORT = tempMsPort; | ||
| 255 | // loger.log("Server选点完成", "mcu-->",GlobalConfig.MCUServerIP,GlobalConfig.MCUServerPort,"ms---->",GlobalConfig.MSServerIP,GlobalConfig.MSServerPort); | 255 | // loger.log("Server选点完成", "mcu-->",GlobalConfig.MCUServerIP,GlobalConfig.MCUServerPort,"ms---->",GlobalConfig.MSServerIP,GlobalConfig.MSServerPort); |
| 256 | this._emit(ServerCheck.SEVER_CHECK_BEST_IP_SUCCESS); | 256 | this._emit(ServerCheck.SEVER_CHECK_BEST_IP_SUCCESS); |
| 257 | } | 257 | } |
| @@ -262,10 +262,10 @@ class ServerCheck extends Emiter { | @@ -262,10 +262,10 @@ class ServerCheck extends Emiter { | ||
| 262 | GlobalConfig.MCUServerPort = tempMcuPort; | 262 | GlobalConfig.MCUServerPort = tempMcuPort; |
| 263 | } | 263 | } |
| 264 | if (tempMsIp) { | 264 | if (tempMsIp) { |
| 265 | - GlobalConfig.MSServerIP = tempMsIp; | ||
| 266 | - GlobalConfig.MSServerPort = tempMsPort; | 265 | + GlobalConfig.MS_PUBLISH_IP = tempMsIp; |
| 266 | + GlobalConfig.MS_PUBLISH_PORT = tempMsPort; | ||
| 267 | } | 267 | } |
| 268 | - loger.log("Sass选点完成", "mcu-->", GlobalConfig.MCUServerIP, GlobalConfig.MCUServerPort, "ms---->", GlobalConfig.MSServerIP, GlobalConfig.MSServerPort); | 268 | + loger.log("Sass选点完成", "mcu-->", GlobalConfig.MCUServerIP, GlobalConfig.MCUServerPort, "ms---->", GlobalConfig.MS_PUBLISH_IP, GlobalConfig.MS_PUBLISH_PORT); |
| 269 | this._emit(ServerCheck.SEVER_CHECK_BEST_IP_SUCCESS); | 269 | this._emit(ServerCheck.SEVER_CHECK_BEST_IP_SUCCESS); |
| 270 | } | 270 | } |
| 271 | } else { | 271 | } else { |
此 diff 太大无法显示。
| @@ -27,7 +27,7 @@ import Server from "config/Server"; | @@ -27,7 +27,7 @@ import Server from "config/Server"; | ||
| 27 | import UTF8 from 'utf-8'; | 27 | import UTF8 from 'utf-8'; |
| 28 | 28 | ||
| 29 | let loger = Loger.getLoger('McuClient'); | 29 | let loger = Loger.getLoger('McuClient'); |
| 30 | -let _sdkInfo = {"version": "v1.9.20.20170426", "author": "www.3mang.com"}; | 30 | +let _sdkInfo = {"version": "v1.10.0.20170427", "author": "www.3mang.com"}; |
| 31 | 31 | ||
| 32 | //APE | 32 | //APE |
| 33 | let _sass; | 33 | let _sass; |
| @@ -442,17 +442,15 @@ export default class MessageEntrance extends Emiter { | @@ -442,17 +442,15 @@ export default class MessageEntrance extends Emiter { | ||
| 442 | GlobalConfig.setDocListPrepare(_data.docListPrepare); //提前上传的文档列表 | 442 | GlobalConfig.setDocListPrepare(_data.docListPrepare); //提前上传的文档列表 |
| 443 | GlobalConfig.setRecordList(_data.recordList);//录制回放地址 | 443 | GlobalConfig.setRecordList(_data.recordList);//录制回放地址 |
| 444 | GlobalConfig.setDocList(_data.docList);//文档地址 | 444 | GlobalConfig.setDocList(_data.docList);//文档地址 |
| 445 | - GlobalConfig.setMsList(_data.msList);//推流播流服务器地址 | ||
| 446 | - GlobalConfig.setRsList(_data.rsList);//播放m3u8格式的地址 | 445 | + GlobalConfig.setMsList(_data.msList);//推流播流服务器地址(需要对列表中的地址进行分类,里面包含了推流和拉流的地址,目前主要是乐视的需要区分开) |
| 446 | + GlobalConfig.setRsList(_data.rsList);//播放m3u8格式的地址(录制回放时使用) | ||
| 447 | GlobalConfig.setMcuList(_data.mcuList);//mcu | 447 | GlobalConfig.setMcuList(_data.mcuList);//mcu |
| 448 | GlobalConfig.setMusicList(_data.musicList);// | 448 | GlobalConfig.setMusicList(_data.musicList);// |
| 449 | GlobalConfig.setMusicListPrepare(_data.musicListPrepare);//提前上传的声音文件列表 | 449 | GlobalConfig.setMusicListPrepare(_data.musicListPrepare);//提前上传的声音文件列表 |
| 450 | 450 | ||
| 451 | 451 | ||
| 452 | + //MCU地址 | ||
| 452 | if (_data.mcuList && _data.mcuList.length > 0) { | 453 | if (_data.mcuList && _data.mcuList.length > 0) { |
| 453 | - /* //MCU地址默认使用第一个 | ||
| 454 | - GlobalConfig.MCUServerIP = _data.mcuList[0].ip || ""; | ||
| 455 | - GlobalConfig.MCUServerPort = _data.mcuList[0].port || "";*/ | ||
| 456 | //随机选择一个 | 454 | //随机选择一个 |
| 457 | let index = parseInt(Math.random() * _data.mcuList.length); | 455 | let index = parseInt(Math.random() * _data.mcuList.length); |
| 458 | GlobalConfig.MCUServerIP = _data.mcuList[index].ip || ""; | 456 | GlobalConfig.MCUServerIP = _data.mcuList[index].ip || ""; |
| @@ -460,29 +458,48 @@ export default class MessageEntrance extends Emiter { | @@ -460,29 +458,48 @@ export default class MessageEntrance extends Emiter { | ||
| 460 | loger.log('初始->MCU->.', GlobalConfig.MCUServerIP, GlobalConfig.MCUServerPort); | 458 | loger.log('初始->MCU->.', GlobalConfig.MCUServerIP, GlobalConfig.MCUServerPort); |
| 461 | } | 459 | } |
| 462 | 460 | ||
| 463 | - //上课中视频推流播流地址 | ||
| 464 | - if (_data.msList && _data.msList.length > 0) { | ||
| 465 | - //MS地址默认使用第一个 | ||
| 466 | - /* GlobalConfig.MSServerIP = _data.msList[0].ip || ""; | ||
| 467 | - GlobalConfig.MSServerPort = _data.msList[0].port || "";*/ | ||
| 468 | - | ||
| 469 | - let index = parseInt(Math.random() * _data.msList.length); | ||
| 470 | - GlobalConfig.MSServerIP = _data.msList[index].ip || ""; | ||
| 471 | - GlobalConfig.MSServerPort = _data.msList[index].port || ""; | ||
| 472 | - loger.log('初始->MS->.', GlobalConfig.MSServerIP, GlobalConfig.MSServerPort); | ||
| 473 | - } | ||
| 474 | - | ||
| 475 | //录制回放时m3u8播流地址 | 461 | //录制回放时m3u8播流地址 |
| 476 | if (_data.rsList && _data.rsList.length > 0) { | 462 | if (_data.rsList && _data.rsList.length > 0) { |
| 477 | - //RS地址默认使用第一个 | ||
| 478 | - //GlobalConfig.RSServerIP = _data.rsList[0].ip || ""; | ||
| 479 | - //GlobalConfig.RSServerPort = _data.rsList[0].port || ""; | ||
| 480 | - | ||
| 481 | let index = parseInt(Math.random() * _data.rsList.length); | 463 | let index = parseInt(Math.random() * _data.rsList.length); |
| 482 | - GlobalConfig.RSServerIP = _data.rsList[index].ip || ""; | ||
| 483 | - GlobalConfig.RSServerPort = _data.rsList[index].port || ""; | ||
| 484 | - loger.log('初始->RS->.', GlobalConfig.RSServerIP, GlobalConfig.RSServerPort); | 464 | + GlobalConfig.RS_RECORD_PLAY_IP = _data.rsList[index].ip || ""; |
| 465 | + GlobalConfig.RS_RECORD_PLAY_PORT = _data.rsList[index].port || ""; | ||
| 466 | + loger.log('初始->RS->.', GlobalConfig.RS_RECORD_PLAY_IP, GlobalConfig.RS_RECORD_PLAY_PORT); | ||
| 467 | + } | ||
| 468 | + | ||
| 469 | + //上课中音视频推流地址 | ||
| 470 | + if (GlobalConfig.msList && GlobalConfig.msList.length > 0) { | ||
| 471 | + let index = parseInt(Math.random() * GlobalConfig.msList.length); | ||
| 472 | + GlobalConfig.MS_PUBLISH_IP = GlobalConfig.msList[index].ip || ""; | ||
| 473 | + GlobalConfig.MS_PUBLISH_PORT = GlobalConfig.msList[index].port || ""; | ||
| 485 | } | 474 | } |
| 475 | + loger.log('初始->MS->.', GlobalConfig.MS_PUBLISH_IP, GlobalConfig.MS_PUBLISH_PORT); | ||
| 476 | + | ||
| 477 | + //播流的地址和推流地址需要分开的时候,单独设置拉流的地址 rtmp(目前乐视使用) | ||
| 478 | + if (GlobalConfig.pullRtmpList &&GlobalConfig.pullRtmpList.length > 0) { | ||
| 479 | + //有单独的rtmp拉流地址 | ||
| 480 | + let index = parseInt(Math.random() *GlobalConfig.pullRtmpList.length); | ||
| 481 | + GlobalConfig.MS_PLAY_RTMP_IP =GlobalConfig.pullRtmpList[index].ip || ""; | ||
| 482 | + GlobalConfig.MS_PLAY_RTMP_PORT =GlobalConfig.pullRtmpList[index].port || ""; | ||
| 483 | + }else { | ||
| 484 | + //如果没有单独的rtmp拉流地址,和推流地址一样即可 | ||
| 485 | + GlobalConfig.MS_PLAY_RTMP_IP= GlobalConfig.MS_PUBLISH_IP; | ||
| 486 | + GlobalConfig.MS_PLAY_RTMP_PORT =GlobalConfig.MS_PUBLISH_PORT; | ||
| 487 | + } | ||
| 488 | + loger.log('初始->MSPull->.', GlobalConfig.MS_PLAY_RTMP_IP, GlobalConfig.MS_PLAY_RTMP_PORT); | ||
| 489 | + | ||
| 490 | + //播流的地址和推流地址需要分开的时候,单独设置拉流的地址 hls(目前乐视使用) | ||
| 491 | + if (GlobalConfig.hlsList &&GlobalConfig.hlsList.length > 0) { | ||
| 492 | + //有单独的hls拉流地址 | ||
| 493 | + let index = parseInt(Math.random() *GlobalConfig.hlsList.length); | ||
| 494 | + GlobalConfig.MS_PLAY_HLS_IP =GlobalConfig.hlsList[index].ip || ""; | ||
| 495 | + GlobalConfig.MS_PLAY_HLS_PORT =GlobalConfig.hlsList[index].port || ""; | ||
| 496 | + }else { | ||
| 497 | + //没有单独的hls拉流地址,和录制回放地址一样即可 | ||
| 498 | + GlobalConfig.MS_PLAY_HLS_IP =GlobalConfig.RS_RECORD_PLAY_IP; | ||
| 499 | + GlobalConfig.MS_PLAY_HLS_PORT =GlobalConfig.RS_RECORD_PLAY_PORT ; | ||
| 500 | + } | ||
| 501 | + loger.log('初始->MSHls->.', GlobalConfig.MS_PLAY_HLS_IP, GlobalConfig.MS_PLAY_HLS_PORT); | ||
| 502 | + | ||
| 486 | 503 | ||
| 487 | //文档地址 | 504 | //文档地址 |
| 488 | if (_data.docList && _data.docList.length > 0) { | 505 | if (_data.docList && _data.docList.length > 0) { |
| @@ -496,10 +513,6 @@ export default class MessageEntrance extends Emiter { | @@ -496,10 +513,6 @@ export default class MessageEntrance extends Emiter { | ||
| 496 | 513 | ||
| 497 | //record | 514 | //record |
| 498 | if (_data.recordList && _data.recordList.length > 0) { | 515 | if (_data.recordList && _data.recordList.length > 0) { |
| 499 | - //地址默认使用第一个 | ||
| 500 | - //GlobalConfig.RecordServerIP = _data.recordList[0].ip || ""; | ||
| 501 | - //GlobalConfig.RecordServerPort = _data.recordList[0].port || ""; | ||
| 502 | - | ||
| 503 | let index = parseInt(Math.random() * _data.recordList.length); | 516 | let index = parseInt(Math.random() * _data.recordList.length); |
| 504 | GlobalConfig.RecordServerIP = _data.recordList[index].ip || ""; | 517 | GlobalConfig.RecordServerIP = _data.recordList[index].ip || ""; |
| 505 | GlobalConfig.RecordServerPort = _data.recordList[index].port || ""; | 518 | GlobalConfig.RecordServerPort = _data.recordList[index].port || ""; |
| @@ -563,16 +576,26 @@ export default class MessageEntrance extends Emiter { | @@ -563,16 +576,26 @@ export default class MessageEntrance extends Emiter { | ||
| 563 | 576 | ||
| 564 | //开始选点 | 577 | //开始选点 |
| 565 | let _this = this; | 578 | let _this = this; |
| 566 | - this._getFastestMsServer(function (_data) { | ||
| 567 | - loger.log("MS选点结束->", _data); | ||
| 568 | - if (_data && _data.ip) { | ||
| 569 | - GlobalConfig.MSServerIP = _data.ip || ""; | ||
| 570 | - GlobalConfig.MSServerPort = _data.port || ""; | ||
| 571 | - } | ||
| 572 | - loger.log("当前使用的MS->", GlobalConfig.MSServerIP, GlobalConfig.MSServerPort); | 579 | + |
| 580 | + //有一些站点不需要进行MS选点,需要先检查一下 | ||
| 581 | + if(GlobalConfig.siteId_letv==GlobalConfig.siteId){ | ||
| 582 | + //MS不需要选点 | ||
| 583 | + loger.log("MS不需要选点->siteId->", GlobalConfig.siteId); | ||
| 573 | _this.isGetFastestMcuCallback = true; | 584 | _this.isGetFastestMcuCallback = true; |
| 574 | _this._startConnectMCU(); | 585 | _this._startConnectMCU(); |
| 575 | - }); | 586 | + }else { |
| 587 | + this._getFastestMsServer(function (_data) { | ||
| 588 | + loger.log("MS选点结束->", _data); | ||
| 589 | + if (_data && _data.ip) { | ||
| 590 | + GlobalConfig.MS_PUBLISH_IP = _data.ip || ""; | ||
| 591 | + GlobalConfig.MS_PUBLISH_PORT = _data.port || ""; | ||
| 592 | + } | ||
| 593 | + loger.log("当前使用的MS->", GlobalConfig.MS_PUBLISH_IP, GlobalConfig.MS_PUBLISH_PORT); | ||
| 594 | + _this.isGetFastestMcuCallback = true; | ||
| 595 | + _this._startConnectMCU(); | ||
| 596 | + }); | ||
| 597 | + } | ||
| 598 | + | ||
| 576 | this._getFastestMcuServer(function (_data) { | 599 | this._getFastestMcuServer(function (_data) { |
| 577 | loger.log("MCU选点结束->", _data); | 600 | loger.log("MCU选点结束->", _data); |
| 578 | if (_data && _data.ip) { | 601 | if (_data && _data.ip) { |
| @@ -610,7 +633,6 @@ export default class MessageEntrance extends Emiter { | @@ -610,7 +633,6 @@ export default class MessageEntrance extends Emiter { | ||
| 610 | Server.serverList); | 633 | Server.serverList); |
| 611 | } | 634 | } |
| 612 | 635 | ||
| 613 | - | ||
| 614 | //console.log(" GlobalConfig.mcuListFromServer", GlobalConfig.mcuListFromServer) | 636 | //console.log(" GlobalConfig.mcuListFromServer", GlobalConfig.mcuListFromServer) |
| 615 | //console.log(" GlobalConfig.msListFromServer", GlobalConfig.msListFromServer) | 637 | //console.log(" GlobalConfig.msListFromServer", GlobalConfig.msListFromServer) |
| 616 | //合并所有MCU、MS 列表 | 638 | //合并所有MCU、MS 列表 |
| @@ -812,28 +834,28 @@ export default class MessageEntrance extends Emiter { | @@ -812,28 +834,28 @@ export default class MessageEntrance extends Emiter { | ||
| 812 | let oldIp= GlobalConfig.MCUServerIP; | 834 | let oldIp= GlobalConfig.MCUServerIP; |
| 813 | 835 | ||
| 814 | if (_data && _data.ip) { | 836 | if (_data && _data.ip) { |
| 815 | - GlobalConfig.MSServerIP = _data.ip || ""; | ||
| 816 | - GlobalConfig.MSServerPort = _data.port || ""; | 837 | + GlobalConfig.MS_PUBLISH_IP = _data.ip || ""; |
| 838 | + GlobalConfig.MS_PUBLISH_PORT = _data.port || ""; | ||
| 817 | } else { | 839 | } else { |
| 818 | //随机选择一个 | 840 | //随机选择一个 |
| 819 | if (GlobalConfig.msList && GlobalConfig.msList.length > 0) { | 841 | if (GlobalConfig.msList && GlobalConfig.msList.length > 0) { |
| 820 | let index = parseInt(Math.random() * GlobalConfig.msList.length); | 842 | let index = parseInt(Math.random() * GlobalConfig.msList.length); |
| 821 | - GlobalConfig.MSServerIP = GlobalConfig.msList[index].ip || ""; | ||
| 822 | - GlobalConfig.MSServerPort = GlobalConfig.msList[index].port || ""; | 843 | + GlobalConfig.MS_PUBLISH_IP = GlobalConfig.msList[index].ip || ""; |
| 844 | + GlobalConfig.MS_PUBLISH_PORT = GlobalConfig.msList[index].port || ""; | ||
| 823 | } | 845 | } |
| 824 | } | 846 | } |
| 825 | 847 | ||
| 826 | 848 | ||
| 827 | - if(oldIp&&oldIp!=GlobalConfig.MSServerIP){ | 849 | + if(oldIp&&oldIp!=GlobalConfig.MS_PUBLISH_IP){ |
| 828 | /* loger.log('MS->切换地址->', GlobalConfig.MSServerIP, GlobalConfig.MSServerPort); | 850 | /* loger.log('MS->切换地址->', GlobalConfig.MSServerIP, GlobalConfig.MSServerPort); |
| 829 | //判断是否需要断开当前的连接重连新的服务器 | 851 | //判断是否需要断开当前的连接重连新的服务器 |
| 830 | if (_param && _param.reConnect == true) { | 852 | if (_param && _param.reConnect == true) { |
| 831 | loger.log('MS->最新地址->', GlobalConfig.MSServerIP, GlobalConfig.MSServerPort); | 853 | loger.log('MS->最新地址->', GlobalConfig.MSServerIP, GlobalConfig.MSServerPort); |
| 832 | }*/ | 854 | }*/ |
| 833 | - loger.log('MS->最新地址->', GlobalConfig.MSServerIP, GlobalConfig.MSServerPort); | 855 | + loger.log('MS->最新地址->', GlobalConfig.MS_PUBLISH_IP, GlobalConfig.MS_PUBLISH_PORT); |
| 834 | }else { | 856 | }else { |
| 835 | //如果选点结束后获得的ip和当前的IP相同,不需要切换 | 857 | //如果选点结束后获得的ip和当前的IP相同,不需要切换 |
| 836 | - loger.log('MS不需要切换->IP',GlobalConfig.MSServerIP); | 858 | + loger.log('MS不需要切换->IP',GlobalConfig.MS_PUBLISH_IP); |
| 837 | } | 859 | } |
| 838 | 860 | ||
| 839 | }); | 861 | }); |
| @@ -195,7 +195,31 @@ class GlobalConfig { | @@ -195,7 +195,31 @@ class GlobalConfig { | ||
| 195 | //ms列表 | 195 | //ms列表 |
| 196 | static setMsList(_data){ | 196 | static setMsList(_data){ |
| 197 | if(_data==null) return; | 197 | if(_data==null) return; |
| 198 | - this.msList=_data; | 198 | + //MSlist列表中的地址需要进行筛选,目前有的站点播流和推流需要分开 |
| 199 | + if(GlobalConfig.siteId==GlobalConfig.siteId_letv){ | ||
| 200 | + this.msList=[]; | ||
| 201 | + this.pullRtmpList=[]; | ||
| 202 | + this.hlsList=[]; | ||
| 203 | + let len=_data.length; | ||
| 204 | + for(let i=0;i<len;i++){ | ||
| 205 | + let item=_data[i]; | ||
| 206 | + if(item&&item.ip){ | ||
| 207 | + if(item.ip.indexOf('pull.')>=0){ | ||
| 208 | + this.pullRtmpList.push(item); | ||
| 209 | + }else if(item.ip.indexOf('hls.')>=0){ | ||
| 210 | + this.hlsList.push(item); | ||
| 211 | + }else { | ||
| 212 | + this.msList.push(item); | ||
| 213 | + } | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + loger.log("msListAll->",_data); | ||
| 217 | + loger.log("msList->",this.msList); | ||
| 218 | + loger.log("pullList->",this.pullRtmpList); | ||
| 219 | + loger.log("hlsList->",this.hlsList); | ||
| 220 | + }else { | ||
| 221 | + this.msList=_data; | ||
| 222 | + } | ||
| 199 | } | 223 | } |
| 200 | static getMsList(){ | 224 | static getMsList(){ |
| 201 | return this.msList; | 225 | return this.msList; |
| @@ -254,15 +278,26 @@ GlobalConfig.portal="112.126.80.182:80";//Sass IP | @@ -254,15 +278,26 @@ GlobalConfig.portal="112.126.80.182:80";//Sass IP | ||
| 254 | //GlobalConfig.ip="112.126.80.182"; | 278 | //GlobalConfig.ip="112.126.80.182"; |
| 255 | //GlobalConfig.port="80"; | 279 | //GlobalConfig.port="80"; |
| 256 | 280 | ||
| 281 | +//连接MCU的IP+端口 | ||
| 257 | GlobalConfig.MCUServerIP=""; | 282 | GlobalConfig.MCUServerIP=""; |
| 258 | GlobalConfig.MCUServerPort=''; | 283 | GlobalConfig.MCUServerPort=''; |
| 259 | 284 | ||
| 260 | -GlobalConfig.MSServerIP = "";//推流 播流的地址 | ||
| 261 | -GlobalConfig.MSServerPort =""; | 285 | +//推流地址+端口 |
| 286 | +GlobalConfig.MS_PUBLISH_IP = ""; | ||
| 287 | +GlobalConfig.MS_PUBLISH_PORT =""; | ||
| 288 | + | ||
| 289 | +//rtmp 拉流地址+端口(rtmp) | ||
| 290 | +GlobalConfig.MS_PLAY_RTMP_IP=""; | ||
| 291 | +GlobalConfig.MS_PLAY_RTMP_PORT=""; | ||
| 292 | + | ||
| 293 | +//HLS 拉流地址+端口 (m3u8) | ||
| 294 | +GlobalConfig.MS_PLAY_HLS_IP=""; | ||
| 295 | +GlobalConfig.MS_PLAY_HLS_PORT=""; | ||
| 296 | + | ||
| 262 | 297 | ||
| 263 | -//m3u8播流地址 | ||
| 264 | -GlobalConfig.RSServerIP =""; | ||
| 265 | -GlobalConfig.RSServerPort =""; | 298 | +//录制回放 m3u8播流地址() |
| 299 | +GlobalConfig.RS_RECORD_PLAY_IP =""; | ||
| 300 | +GlobalConfig.RS_RECORD_PLAY_PORT =""; | ||
| 266 | 301 | ||
| 267 | //DOC | 302 | //DOC |
| 268 | GlobalConfig.DOCServerIP =""; | 303 | GlobalConfig.DOCServerIP =""; |
| @@ -340,6 +375,10 @@ GlobalConfig.musicListPrepare=[];//提提前上传的music集合 | @@ -340,6 +375,10 @@ GlobalConfig.musicListPrepare=[];//提提前上传的music集合 | ||
| 340 | GlobalConfig.rsList=[];//录制回放中视频点播地址 | 375 | GlobalConfig.rsList=[];//录制回放中视频点播地址 |
| 341 | 376 | ||
| 342 | 377 | ||
| 378 | +//乐视的推流和播放需要分开 | ||
| 379 | +GlobalConfig.pullRtmpList=[];//rtmp播流地址集合(推流和播流地址需要区分的站点使用) | ||
| 380 | +GlobalConfig.hlsList=[];//hls播流地址集合(推流和播流地址需要区分的站点使用) | ||
| 381 | + | ||
| 343 | //根据IP从server获取 | 382 | //根据IP从server获取 |
| 344 | GlobalConfig.mcuListFromServer=[];//根据userIP从server获取的mcu列表 | 383 | GlobalConfig.mcuListFromServer=[];//根据userIP从server获取的mcu列表 |
| 345 | GlobalConfig.msListFromServer=[];//根据userIP从server获取的ms列表 | 384 | GlobalConfig.msListFromServer=[];//根据userIP从server获取的ms列表 |
| @@ -354,4 +393,8 @@ GlobalConfig.msListAll=[];//所有MS集合(sass+server) | @@ -354,4 +393,8 @@ GlobalConfig.msListAll=[];//所有MS集合(sass+server) | ||
| 354 | 393 | ||
| 355 | GlobalConfig.isRecordPlayBack=false;//是否是录制回放,默认是否 | 394 | GlobalConfig.isRecordPlayBack=false;//是否是录制回放,默认是否 |
| 356 | GlobalConfig.allowRecordMaxTime=14400;//(秒)允许录制的最长时间,默认是4小时 | 395 | GlobalConfig.allowRecordMaxTime=14400;//(秒)允许录制的最长时间,默认是4小时 |
| 396 | + | ||
| 397 | + | ||
| 398 | +GlobalConfig.siteId_letv='shchuanbao';//乐视,MS不需要动态选点的站点 | ||
| 399 | + | ||
| 357 | export default GlobalConfig; | 400 | export default GlobalConfig; |
| @@ -20,34 +20,47 @@ class MediaModule { | @@ -20,34 +20,47 @@ class MediaModule { | ||
| 20 | 20 | ||
| 21 | //获取播流地址 | 21 | //获取播流地址 |
| 22 | getMediaPlayPath(_param) { | 22 | getMediaPlayPath(_param) { |
| 23 | - loger.log('getMediaPlayPath'); | 23 | + loger.log('获取播放地址->'); |
| 24 | if (_param == null||_param.streamId == null) | 24 | if (_param == null||_param.streamId == null) |
| 25 | { | 25 | { |
| 26 | - loger.warn('getMediaPlayPath,参数错误', _param); | 26 | + loger.warn('获取播放地址->参数错误', _param); |
| 27 | //this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | 27 | //this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); |
| 28 | return {"code": ApeConsts.RETURN_FAILED, "data": ""}; | 28 | return {"code": ApeConsts.RETURN_FAILED, "data": ""}; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | let path = ""; | 31 | let path = ""; |
| 32 | let port=""; | 32 | let port=""; |
| 33 | + let fileName=''; | ||
| 33 | if (_param.type == "m3u8") { | 34 | if (_param.type == "m3u8") { |
| 34 | //M3U8 | 35 | //M3U8 |
| 35 | //http://123.56.73.119:6001/live/h5dev_2106728010_8ab3b0ed5a3a9220015a3a958f0d0003_983041_1489113860/index.m3u8 | 36 | //http://123.56.73.119:6001/live/h5dev_2106728010_8ab3b0ed5a3a9220015a3a958f0d0003_983041_1489113860/index.m3u8 |
| 36 | - port = (GlobalConfig.RSServerPort == "" || GlobalConfig.RSServerPort == null) ? "":":" + GlobalConfig.RSServerPort; | ||
| 37 | - path = "http://" + GlobalConfig.RSServerIP | 37 | + if(GlobalConfig.siteId==GlobalConfig.siteId_letv){ |
| 38 | + //乐视的hls地址规则 | ||
| 39 | + fileName='desc.m3u8'; | ||
| 40 | + }else { | ||
| 41 | + fileName='index.m3u8'; | ||
| 42 | + } | ||
| 43 | + port = (GlobalConfig.MS_PLAY_HLS_PORT == "" || GlobalConfig.MS_PLAY_HLS_PORT == null) ? "":":" + GlobalConfig.MS_PLAY_HLS_PORT; | ||
| 44 | + path = "http://" + GlobalConfig.MS_PLAY_HLS_IP | ||
| 38 | + port + "/live/" | 45 | + port + "/live/" |
| 39 | + _param.streamId | 46 | + _param.streamId |
| 40 | - + "/index.m3u8"; | 47 | + + "/"+fileName; |
| 48 | + | ||
| 49 | + | ||
| 41 | } else { | 50 | } else { |
| 42 | - port = (GlobalConfig.MSServerPort == "" || GlobalConfig.MSServerPort == null) ? "":":" + GlobalConfig.MSServerPort; | ||
| 43 | - path = "rtmp://" + GlobalConfig.MSServerIP | 51 | + //RTMP |
| 52 | + port = (GlobalConfig.MS_PLAY_RTMP_PORT == "" || GlobalConfig.MS_PLAY_RTMP_PORT == null) ? "":":" + GlobalConfig.MS_PLAY_RTMP_PORT; | ||
| 53 | + path = "rtmp://" + GlobalConfig.MS_PLAY_RTMP_IP | ||
| 44 | + port + "/live/" | 54 | + port + "/live/" |
| 45 | + _param.streamId; | 55 | + _param.streamId; |
| 46 | } | 56 | } |
| 57 | + | ||
| 58 | + | ||
| 47 | path=path.replace("::",":");//如果ip和port之间有多的:需要去掉 | 59 | path=path.replace("::",":");//如果ip和port之间有多的:需要去掉 |
| 48 | return {"code": ApeConsts.RETURN_SUCCESS, "data": "","playUrl": path}; | 60 | return {"code": ApeConsts.RETURN_SUCCESS, "data": "","playUrl": path}; |
| 49 | } | 61 | } |
| 50 | 62 | ||
| 63 | + | ||
| 51 | //获取录制回放时点播的地址,只有m3u8 | 64 | //获取录制回放时点播的地址,只有m3u8 |
| 52 | getMediaRecordPlaybackPath(_param) { | 65 | getMediaRecordPlaybackPath(_param) { |
| 53 | loger.log('getMediaRecordPlaybackPath'); | 66 | loger.log('getMediaRecordPlaybackPath'); |
| @@ -57,8 +70,8 @@ class MediaModule { | @@ -57,8 +70,8 @@ class MediaModule { | ||
| 57 | return {"code": ApeConsts.RETURN_FAILED, "data": ""}; | 70 | return {"code": ApeConsts.RETURN_FAILED, "data": ""}; |
| 58 | } | 71 | } |
| 59 | //M3U8 http://123.56.73.119:6001/live/h5dev_2106728010_8ab3b0ed5a3a9220015a3a958f0d0003_983041_1489113860/total.m3u8 | 72 | //M3U8 http://123.56.73.119:6001/live/h5dev_2106728010_8ab3b0ed5a3a9220015a3a958f0d0003_983041_1489113860/total.m3u8 |
| 60 | - let port = (GlobalConfig.RSServerPort == "" || GlobalConfig.RSServerPort == null) ? "":":" + GlobalConfig.RSServerPort; | ||
| 61 | - let path = "http://" + GlobalConfig.RSServerIP | 73 | + let port = (GlobalConfig.RS_RECORD_PLAY_PORT == "" || GlobalConfig.RS_RECORD_PLAY_PORT == null) ? "":":" + GlobalConfig.RS_RECORD_PLAY_PORT; |
| 74 | + let path = "http://" + GlobalConfig.RS_RECORD_PLAY_IP | ||
| 62 | + port + "/live/" | 75 | + port + "/live/" |
| 63 | + _param.streamId | 76 | + _param.streamId |
| 64 | + "/total.m3u8"; | 77 | + "/total.m3u8"; |
| @@ -84,7 +97,7 @@ class MediaModule { | @@ -84,7 +97,7 @@ class MediaModule { | ||
| 84 | } | 97 | } |
| 85 | 98 | ||
| 86 | //端口,有端口就显示 ":xxx",没有端口就是"" | 99 | //端口,有端口就显示 ":xxx",没有端口就是"" |
| 87 | - let port = (GlobalConfig.MSServerPort == "" || GlobalConfig.MSServerPort == null) ? "":":" + GlobalConfig.MSServerPort; | 100 | + let port = (GlobalConfig.MS_PUBLISH_PORT == "" || GlobalConfig.MS_PUBLISH_PORT == null) ? "":":" + GlobalConfig.MS_PUBLISH_PORT; |
| 88 | //时间戳 | 101 | //时间戳 |
| 89 | let timestamp = EngineUtils.creatTimestamp(); | 102 | let timestamp = EngineUtils.creatTimestamp(); |
| 90 | 103 | ||
| @@ -93,7 +106,7 @@ class MediaModule { | @@ -93,7 +106,7 @@ class MediaModule { | ||
| 93 | +"_" + freeChannel + "_" + timestamp; | 106 | +"_" + freeChannel + "_" + timestamp; |
| 94 | 107 | ||
| 95 | //生成推流地址和推流数据(同步数据的时候用) | 108 | //生成推流地址和推流数据(同步数据的时候用) |
| 96 | - let publishUrl = "rtmp://" + GlobalConfig.MSServerIP | 109 | + let publishUrl = "rtmp://" + GlobalConfig.MS_PUBLISH_IP |
| 97 | + port + "/"+pubType+"/" +streamId; | 110 | + port + "/"+pubType+"/" +streamId; |
| 98 | 111 | ||
| 99 | publishUrl=publishUrl.replace("::",":");//如果ip和port之间有多的:需要去掉 | 112 | publishUrl=publishUrl.replace("::",":");//如果ip和port之间有多的:需要去掉 |
-
请 注册 或 登录 后发表评论