正在显示
3 个修改的文件
包含
61 行增加
和
27 行删除
| @@ -62,7 +62,7 @@ export default class MessageEntrance extends Emiter { | @@ -62,7 +62,7 @@ export default class MessageEntrance extends Emiter { | ||
| 62 | constructor() { | 62 | constructor() { |
| 63 | super(); | 63 | super(); |
| 64 | //sdk 信息 | 64 | //sdk 信息 |
| 65 | - GlobalConfig.sdkVersion = "v2.16.8.20171012"; | 65 | + GlobalConfig.sdkVersion = "v2.17.11.20171014"; |
| 66 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); | 66 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); |
| 67 | 67 | ||
| 68 | //设置 | 68 | //设置 |
| @@ -1225,15 +1225,15 @@ export default class MessageEntrance extends Emiter { | @@ -1225,15 +1225,15 @@ export default class MessageEntrance extends Emiter { | ||
| 1225 | 1225 | ||
| 1226 | //主讲人和老师可以设置旁录 | 1226 | //主讲人和老师可以设置旁录 |
| 1227 | if(GlobalConfig.appId&&!GlobalConfig.openFlash){ | 1227 | if(GlobalConfig.appId&&!GlobalConfig.openFlash){ |
| 1228 | - setTimeout(()=>{ | ||
| 1229 | - /*//加入之前先设置旁录地址,只有直播支持旁路 | 1228 | + //加入之前先设置旁录地址,只有直播支持旁路 |
| 1230 | if(_webRtc&&GlobalConfig.isTeachOrAssistant){ | 1229 | if(_webRtc&&GlobalConfig.isTeachOrAssistant){ |
| 1231 | let publishData=this._getVideoPublishPath(); | 1230 | let publishData=this._getVideoPublishPath(); |
| 1232 | loger.log("加入之前先设置旁录地址",publishData); | 1231 | loger.log("加入之前先设置旁录地址",publishData); |
| 1233 | if(publishData&&publishData.code==0){ | 1232 | if(publishData&&publishData.code==0){ |
| 1234 | _webRtc.setConfigPublisherUrl(publishData.publishUrl); | 1233 | _webRtc.setConfigPublisherUrl(publishData.publishUrl); |
| 1235 | } | 1234 | } |
| 1236 | - }*/ | 1235 | + } |
| 1236 | + setTimeout(()=>{ | ||
| 1237 | //加入音视频通话模块,延迟一秒处理,因为视频需要根据用户列表信息来判断放的位置,太早的话用户列表没有数据 | 1237 | //加入音视频通话模块,延迟一秒处理,因为视频需要根据用户列表信息来判断放的位置,太早的话用户列表没有数据 |
| 1238 | this._joinChannel({channelId:GlobalConfig.channelId,channelKey:GlobalConfig.channelKey ,uid:GlobalConfig.userUid,info:""+GlobalConfig.userRole}); | 1238 | this._joinChannel({channelId:GlobalConfig.channelId,channelKey:GlobalConfig.channelKey ,uid:GlobalConfig.userUid,info:""+GlobalConfig.userRole}); |
| 1239 | },1600); | 1239 | },1600); |
| @@ -121,6 +121,7 @@ class VideoApe extends Ape { | @@ -121,6 +121,7 @@ class VideoApe extends Ape { | ||
| 121 | 121 | ||
| 122 | //根据推流的地址获取对应的频道信息 | 122 | //根据推流的地址获取对应的频道信息 |
| 123 | let needPublishChannelInfo = this.mediaModule.getNeedPublishMediaChannel(_param.publishUrl); | 123 | let needPublishChannelInfo = this.mediaModule.getNeedPublishMediaChannel(_param.publishUrl); |
| 124 | + console.log("needPublishChannelInfo",needPublishChannelInfo); | ||
| 124 | if (needPublishChannelInfo == null) { | 125 | if (needPublishChannelInfo == null) { |
| 125 | loger.warn('推流->推流数据已经无效', _param); | 126 | loger.warn('推流->推流数据已经无效', _param); |
| 126 | this._emit(MessageTypes.VIDEO_PUBLISH_RESULT, { | 127 | this._emit(MessageTypes.VIDEO_PUBLISH_RESULT, { |
| @@ -223,6 +224,18 @@ class VideoApe extends Ape { | @@ -223,6 +224,18 @@ class VideoApe extends Ape { | ||
| 223 | "toNodeId": 0, | 224 | "toNodeId": 0, |
| 224 | "data":_data|| "" | 225 | "data":_data|| "" |
| 225 | }); | 226 | }); |
| 227 | + | ||
| 228 | + //如果是老师或主讲人助教,推流需要同步 | ||
| 229 | + if(GlobalConfig.isTeachOrAssistant){ | ||
| 230 | + _data.nodeId=GlobalConfig.nodeId; | ||
| 231 | + if(_data.status==1){ | ||
| 232 | + this.publishVideo(_data); | ||
| 233 | + }else if(_data.status==0){ | ||
| 234 | + _data.nodeId=GlobalConfig.nodeId; | ||
| 235 | + this.stopPublishVideo(_data) | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | + | ||
| 226 | } | 239 | } |
| 227 | //==========================屏幕共享========================================================================= | 240 | //==========================屏幕共享========================================================================= |
| 228 | 241 | ||
| @@ -482,6 +495,7 @@ class VideoApe extends Ape { | @@ -482,6 +495,7 @@ class VideoApe extends Ape { | ||
| 482 | dataObj = videoReceivePdu.data; | 495 | dataObj = videoReceivePdu.data; |
| 483 | } | 496 | } |
| 484 | videoReceivePdu.data = dataObj; | 497 | videoReceivePdu.data = dataObj; |
| 498 | + //录制回放和H5需要处理 | ||
| 485 | if(GlobalConfig.isRecordPlayBack){ | 499 | if(GlobalConfig.isRecordPlayBack){ |
| 486 | //录制回放的处理 | 500 | //录制回放的处理 |
| 487 | if (videoReceivePdu.toNodeId!=0){ | 501 | if (videoReceivePdu.toNodeId!=0){ |
| @@ -502,7 +516,7 @@ class VideoApe extends Ape { | @@ -502,7 +516,7 @@ class VideoApe extends Ape { | ||
| 502 | "timestamp": 1505886364100, | 516 | "timestamp": 1505886364100, |
| 503 | "recordTimestamp": 27 | 517 | "recordTimestamp": 27 |
| 504 | }*/ | 518 | }*/ |
| 505 | - switch (videoReceivePdu.actionType){ | 519 | + /* switch (videoReceivePdu.actionType){ |
| 506 | case ApeConsts.MEDIA_ACTION_PUBLISH_STATUS: | 520 | case ApeConsts.MEDIA_ACTION_PUBLISH_STATUS: |
| 507 | //webRtc的推流和停止推流的消息 | 521 | //webRtc的推流和停止推流的消息 |
| 508 | let videoInfo={}; | 522 | let videoInfo={}; |
| @@ -520,7 +534,7 @@ class VideoApe extends Ape { | @@ -520,7 +534,7 @@ class VideoApe extends Ape { | ||
| 520 | break; | 534 | break; |
| 521 | default: | 535 | default: |
| 522 | break | 536 | break |
| 523 | - } | 537 | + }*/ |
| 524 | 538 | ||
| 525 | }else { | 539 | }else { |
| 526 | //判断接收者的id,如果不是0,并且也不是自己的nodeId,那么消息不做处理 | 540 | //判断接收者的id,如果不是0,并且也不是自己的nodeId,那么消息不做处理 |
| @@ -529,6 +543,35 @@ class VideoApe extends Ape { | @@ -529,6 +543,35 @@ class VideoApe extends Ape { | ||
| 529 | } else { | 543 | } else { |
| 530 | loger.log('视频控制消息处理 .', videoReceivePdu); | 544 | loger.log('视频控制消息处理 .', videoReceivePdu); |
| 531 | this._emit(MessageTypes.VIDEO_BROADCAST, videoReceivePdu); | 545 | this._emit(MessageTypes.VIDEO_BROADCAST, videoReceivePdu); |
| 546 | + | ||
| 547 | + let data=videoReceivePdu.data; | ||
| 548 | + if(data){ | ||
| 549 | + switch (videoReceivePdu.actionType){ | ||
| 550 | + case ApeConsts.MEDIA_ACTION_PUBLISH_STATUS: | ||
| 551 | + //webRtc的推流和停止推流的消息 | ||
| 552 | + let videoInfo={}; | ||
| 553 | + let videoData=data; | ||
| 554 | + /* videoData.streamId=data.channel+"_"+data.userId+"_"+data.uid+"_"+(parseInt(parseInt(data.timestamp)/1000)); | ||
| 555 | + if(data.status==1){ | ||
| 556 | + loger.log("播放文件->", "userName",data.userName,"uid",data.uid,"时间:"+new Date(1505886364100).toString()); | ||
| 557 | + videoInfo=this.packVideoInfoAndSendToClient(videoData,seek); | ||
| 558 | + this._emit(MessageTypes.VIDEO_PLAY, videoInfo); | ||
| 559 | + }else if(data.status==0){ | ||
| 560 | + loger.log("停止播放文件->", "userName",data.userName,"uid",data.uid,"时间:"+new Date(1505886364100).toString()); | ||
| 561 | + videoInfo=this.packVideoInfoAndSendToClient(videoData,seek); | ||
| 562 | + this._emit(MessageTypes.VIDEO_STOP, videoInfo); | ||
| 563 | + }*/ | ||
| 564 | + /* if(data.status==1){ | ||
| 565 | + this.publishVideo(data); | ||
| 566 | + }else if(data.status==0){ | ||
| 567 | + data.nodeId=videoReceivePdu.toNodeId; | ||
| 568 | + this.stopPublishVideo(data) | ||
| 569 | + }*/ | ||
| 570 | + break; | ||
| 571 | + default: | ||
| 572 | + break | ||
| 573 | + } | ||
| 574 | + } | ||
| 532 | } | 575 | } |
| 533 | } | 576 | } |
| 534 | 577 |
| @@ -45,8 +45,8 @@ class WebRtcApe extends Emiter { | @@ -45,8 +45,8 @@ class WebRtcApe extends Emiter { | ||
| 45 | this.pFrameRate=30; | 45 | this.pFrameRate=30; |
| 46 | this.pBitrate=500; | 46 | this.pBitrate=500; |
| 47 | 47 | ||
| 48 | - //this.videoResolution = "360P_8";//480x360 30 490 | ||
| 49 | - this.videoResolution = "240P";// | 48 | + this.videoResolution = "360P_8";//480x360 30 490 |
| 49 | + //this.videoResolution = "240P";// | ||
| 50 | this.isOpenVideo = true; | 50 | this.isOpenVideo = true; |
| 51 | 51 | ||
| 52 | this.isPublish = false;//当前是否正在推流 | 52 | this.isPublish = false;//当前是否正在推流 |
| @@ -251,7 +251,7 @@ class WebRtcApe extends Emiter { | @@ -251,7 +251,7 @@ class WebRtcApe extends Emiter { | ||
| 251 | for (let i=normalList.length-1;i>=0;i--){ | 251 | for (let i=normalList.length-1;i>=0;i--){ |
| 252 | divItem=normalList[i]; | 252 | divItem=normalList[i]; |
| 253 | if(divItem&&divItem.children.length<2){ | 253 | if(divItem&&divItem.children.length<2){ |
| 254 | - console.log("删除无效的视图",divItem); | 254 | + console.log("删除无效的学生视图"); |
| 255 | divItem.remove(); | 255 | divItem.remove(); |
| 256 | } | 256 | } |
| 257 | } | 257 | } |
| @@ -261,7 +261,7 @@ class WebRtcApe extends Emiter { | @@ -261,7 +261,7 @@ class WebRtcApe extends Emiter { | ||
| 261 | for (let i=hostList.length-1;i>=0;i--){ | 261 | for (let i=hostList.length-1;i>=0;i--){ |
| 262 | divItem=hostList[i]; | 262 | divItem=hostList[i]; |
| 263 | if(divItem&&divItem.children.length<2){ | 263 | if(divItem&&divItem.children.length<2){ |
| 264 | - console.log("删除无效的视图",divItem); | 264 | + console.log("删除无效的老师视图"); |
| 265 | divItem.remove(); | 265 | divItem.remove(); |
| 266 | } | 266 | } |
| 267 | } | 267 | } |
| @@ -271,7 +271,7 @@ class WebRtcApe extends Emiter { | @@ -271,7 +271,7 @@ class WebRtcApe extends Emiter { | ||
| 271 | for (let i=localList.length-1;i>=0;i--){ | 271 | for (let i=localList.length-1;i>=0;i--){ |
| 272 | divItem=localList[i]; | 272 | divItem=localList[i]; |
| 273 | if(divItem&&divItem.children.length<2){ | 273 | if(divItem&&divItem.children.length<2){ |
| 274 | - console.log("删除无效的视图",divItem); | 274 | + console.log("删除无效的本地视图"); |
| 275 | divItem.remove(); | 275 | divItem.remove(); |
| 276 | } | 276 | } |
| 277 | } | 277 | } |
| @@ -423,12 +423,13 @@ class WebRtcApe extends Emiter { | @@ -423,12 +423,13 @@ class WebRtcApe extends Emiter { | ||
| 423 | * 设置旁录地址 | 423 | * 设置旁录地址 |
| 424 | * */ | 424 | * */ |
| 425 | setConfigPublisherUrl(_publishUrl){ | 425 | setConfigPublisherUrl(_publishUrl){ |
| 426 | - loger.warn("设置旁路地址->",_publishUrl); | ||
| 427 | this.configPublisherUrl=_publishUrl; | 426 | this.configPublisherUrl=_publishUrl; |
| 428 | if(this.client&& this.configPublisherUrl){ | 427 | if(this.client&& this.configPublisherUrl){ |
| 429 | - this.client.configPublisher( | ||
| 430 | - {width: this.pWidth, height: this.pHeight, framerate: this.pFrameRate, bitrate: this.pBitrate, publishUrl: this.configPublisherUrl} | ||
| 431 | - ); | 428 | + let configObj={width: parseInt(this.pWidth), height: parseInt(this.pHeight), framerate: parseInt(this.pFrameRate), bitrate: parseInt(this.pBitrate), publishUrl:""+this.configPublisherUrl}; |
| 429 | + //let configObj={width: 480, height:360, framerate:30, bitrate:500, publishUrl:_publishUrl}; | ||
| 430 | + //let configObj={width: 480, height:360, framerate:30, bitrate:500, publishUrl:'rtmp://txlivepush.xuedianyun.com/live/markettest_395312484_T8440_983041_1507888360?bizid=11220&txSecret=15cc50d93f86f9e1a2a76a10db2b09a8&txTime=59e135a8&record=hls|flv&record_interval=5400'}; | ||
| 431 | + loger.warn("设置旁路地址->",configObj); | ||
| 432 | + this.client.configPublisher(configObj); | ||
| 432 | }else { | 433 | }else { |
| 433 | loger.warn("设置旁路地址->失败->为初始化或旁路地址无效",_publishUrl); | 434 | loger.warn("设置旁路地址->失败->为初始化或旁路地址无效",_publishUrl); |
| 434 | } | 435 | } |
| @@ -556,9 +557,6 @@ class WebRtcApe extends Emiter { | @@ -556,9 +557,6 @@ class WebRtcApe extends Emiter { | ||
| 556 | $("."+this.normalWebRtcVideoClass).css("width",this.normalRemoteVideoWidth*this.videoScale); | 557 | $("."+this.normalWebRtcVideoClass).css("width",this.normalRemoteVideoWidth*this.videoScale); |
| 557 | $("."+this.normalWebRtcVideoClass).css("height",this.normalRemoteVideoHeight*this.videoScale); | 558 | $("."+this.normalWebRtcVideoClass).css("height",this.normalRemoteVideoHeight*this.videoScale); |
| 558 | 559 | ||
| 559 | - //监课的不需要设置 | ||
| 560 | - //$("."+this.invisibleWebRtcVideoClass).css("width",this.localVideoWidth); | ||
| 561 | - //$("."+this.invisibleWebRtcVideoClass).css("height",this.localVideoHeight); | ||
| 562 | } | 560 | } |
| 563 | 561 | ||
| 564 | /* | 562 | /* |
| @@ -575,14 +573,6 @@ class WebRtcApe extends Emiter { | @@ -575,14 +573,6 @@ class WebRtcApe extends Emiter { | ||
| 575 | } | 573 | } |
| 576 | this.videoScale=scale; | 574 | this.videoScale=scale; |
| 577 | loger.log("更新视频视图大小->videoScale:"+this.videoScale); | 575 | loger.log("更新视频视图大小->videoScale:"+this.videoScale); |
| 578 | - /* this.localVideoWidth=this.localVideoWidth*this.videoScale; | ||
| 579 | - this.localVideoHeight=this.localVideoHeight*this.videoScale; | ||
| 580 | - | ||
| 581 | - this.hostRemoteVideoWidth=this.hostRemoteVideoWidth*this.videoScale; | ||
| 582 | - this.hostRemoteVideoHeight=this.hostRemoteVideoHeight*this.videoScale; | ||
| 583 | - | ||
| 584 | - this.normalRemoteVideoWidth=this.normalRemoteVideoWidth*this.videoScale; | ||
| 585 | - this.normalRemoteVideoHeight=this.normalRemoteVideoHeight*this.videoScale;*/ | ||
| 586 | this.updateAllVideoSize(); | 576 | this.updateAllVideoSize(); |
| 587 | 577 | ||
| 588 | } | 578 | } |
| @@ -751,7 +741,8 @@ class WebRtcApe extends Emiter { | @@ -751,7 +741,8 @@ class WebRtcApe extends Emiter { | ||
| 751 | userName: GlobalConfig.userName, | 741 | userName: GlobalConfig.userName, |
| 752 | userRole: GlobalConfig.userRole, | 742 | userRole: GlobalConfig.userRole, |
| 753 | timestamp: curTimestamp, | 743 | timestamp: curTimestamp, |
| 754 | - recordTimestamp: GlobalConfig.recordTimestamp | 744 | + recordTimestamp: GlobalConfig.recordTimestamp, |
| 745 | + publishUrl:this.configPublisherUrl | ||
| 755 | }); | 746 | }); |
| 756 | return data; | 747 | return data; |
| 757 | } | 748 | } |
-
请 注册 或 登录 后发表评论