正在显示
2 个修改的文件
包含
74 行增加
和
28 行删除
| @@ -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.4.2.20170908"; | 65 | + GlobalConfig.sdkVersion = "v2.4.4.20170908"; |
| 66 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); | 66 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); |
| 67 | 67 | ||
| 68 | //设置 | 68 | //设置 |
| @@ -285,9 +285,11 @@ export default class MessageEntrance extends Emiter { | @@ -285,9 +285,11 @@ export default class MessageEntrance extends Emiter { | ||
| 285 | this.publishMedia=this._publishMedia.bind(this); | 285 | this.publishMedia=this._publishMedia.bind(this); |
| 286 | this.unpublishMedia=this._unpublishMedia.bind(this); | 286 | this.unpublishMedia=this._unpublishMedia.bind(this); |
| 287 | this.changeDevices=this._changeDevices.bind(this); | 287 | this.changeDevices=this._changeDevices.bind(this); |
| 288 | - this.setLocalMediaView=this._setLocalMediaView.bind(this); | ||
| 289 | - this.setRemoteMediaView=this._setRemoteMediaView.bind(this); | ||
| 290 | - this.setInvisibleMediaView=this._setInvisibleMediaView.bind(this); | 288 | + this.setLocalMediaView=this._setLocalMediaView.bind(this);//设置自己的视图 |
| 289 | + this.setHostRemoteMediaView=this._setHostRemoteMediaView.bind(this);//设置远程老师的视图 | ||
| 290 | + this.setNormalRemoteMediaView=this._setNormalRemoteMediaView.bind(this);//设置远程学生的视图 | ||
| 291 | + this.setInvisibleMediaView=this._setInvisibleMediaView.bind(this);//设置监课身份的视图 | ||
| 292 | + | ||
| 291 | this.setAppConfig=this._setAppConfig.bind(this); | 293 | this.setAppConfig=this._setAppConfig.bind(this); |
| 292 | this.recordControl=this._recordControl.bind(this); | 294 | this.recordControl=this._recordControl.bind(this); |
| 293 | 295 | ||
| @@ -2867,16 +2869,29 @@ export default class MessageEntrance extends Emiter { | @@ -2867,16 +2869,29 @@ export default class MessageEntrance extends Emiter { | ||
| 2867 | } | 2869 | } |
| 2868 | } | 2870 | } |
| 2869 | /* | 2871 | /* |
| 2870 | - * 设置房间内其他人的视图 | 2872 | + * 设置房间内老师身份的视图 |
| 2871 | * */ | 2873 | * */ |
| 2872 | - _setRemoteMediaView(_params){ | 2874 | + _setHostRemoteMediaView(_params){ |
| 2873 | if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | 2875 | if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ |
| 2874 | return; | 2876 | return; |
| 2875 | } | 2877 | } |
| 2876 | if(_webRtc){ | 2878 | if(_webRtc){ |
| 2877 | - _webRtc.setRemoteView(_params); | 2879 | + _webRtc.setHostRemoteMediaView(_params); |
| 2878 | } | 2880 | } |
| 2879 | } | 2881 | } |
| 2882 | + | ||
| 2883 | + /* | ||
| 2884 | + * 设置房间内普通身份的视图 | ||
| 2885 | + * */ | ||
| 2886 | + _setNormalRemoteMediaView(_params){ | ||
| 2887 | + if(GlobalConfig.deviceType==1||GlobalConfig.deviceType==2){ | ||
| 2888 | + return; | ||
| 2889 | + } | ||
| 2890 | + if(_webRtc){ | ||
| 2891 | + _webRtc.setNormalRemoteMediaView(_params); | ||
| 2892 | + } | ||
| 2893 | + } | ||
| 2894 | + | ||
| 2880 | /* | 2895 | /* |
| 2881 | * 设置监课和需要隐藏显示的用户视图 | 2896 | * 设置监课和需要隐藏显示的用户视图 |
| 2882 | * */ | 2897 | * */ |
| @@ -36,21 +36,25 @@ class WebRtcApe extends Emiter { | @@ -36,21 +36,25 @@ class WebRtcApe extends Emiter { | ||
| 36 | 36 | ||
| 37 | this.isPublish=false;//当前是否正在推流 | 37 | this.isPublish=false;//当前是否正在推流 |
| 38 | 38 | ||
| 39 | - this.localVideoWidth=320; | ||
| 40 | - this.localVideoHeight=240; | ||
| 41 | - | ||
| 42 | - this.remoteVideoWidth=320; | ||
| 43 | - this.remoteVideoHeight=240; | 39 | + this.normalRemoteViewId =""; |
| 40 | + this.normalRemoteStyle =""; | ||
| 41 | + this.normalRemoteVideoWidth=320; | ||
| 42 | + this.normalRemoteVideoHeight=240; | ||
| 44 | 43 | ||
| 45 | this.localViewId = ""; | 44 | this.localViewId = ""; |
| 46 | this.localStyle = ""; | 45 | this.localStyle = ""; |
| 46 | + this.localVideoWidth=320; | ||
| 47 | + this.localVideoHeight=240; | ||
| 47 | 48 | ||
| 48 | - this.remoteViewId = ""; | ||
| 49 | - this.remoteStyle = ""; | 49 | + this.hostRemoteViewId = ""; |
| 50 | + this.hostRemoteStyle = ""; | ||
| 51 | + this.hostRemoteVideoWidth=320; | ||
| 52 | + this.hostRemoteVideoHeight=240; | ||
| 50 | 53 | ||
| 51 | this.invisibleViewId =""; | 54 | this.invisibleViewId =""; |
| 52 | this.invisibleStyle =""; | 55 | this.invisibleStyle =""; |
| 53 | - | 56 | + this.invisibleVideoWidth=320; |
| 57 | + this.invisibleVideoHeight=240; | ||
| 54 | this.xdyRemote = "xdy_remote"; | 58 | this.xdyRemote = "xdy_remote"; |
| 55 | //webRtc sdk | 59 | //webRtc sdk |
| 56 | this.client = AgoraRTC.createClient({mode: this.mode}); | 60 | this.client = AgoraRTC.createClient({mode: this.mode}); |
| @@ -117,15 +121,29 @@ class WebRtcApe extends Emiter { | @@ -117,15 +121,29 @@ class WebRtcApe extends Emiter { | ||
| 117 | this.client.on('stream-subscribed', (evt)=> { | 121 | this.client.on('stream-subscribed', (evt)=> { |
| 118 | let stream = evt.stream; | 122 | let stream = evt.stream; |
| 119 | if(stream){ | 123 | if(stream){ |
| 120 | - loger.log("获取远程视频流成功: " + stream.getId(),new Date().getTime()); | ||
| 121 | - let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.remoteVideoWidth}px;height:${this.remoteVideoHeight}px;"></div>`; | 124 | + //let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.hostRemoteVideoWidth}px;height:${this.hostRemoteVideoHeight}px;"></div>`; |
| 122 | if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.invisible){ | 125 | if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.invisible){ |
| 123 | - //显示隐藏用户 | 126 | + //把远程视频添加到监课列表 |
| 127 | + loger.log("获取远程视频流成功->监课:" + stream.getId(),new Date().getTime()); | ||
| 128 | + let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.invisibleVideoWidth}px;height:${this.invisibleVideoHeight}px;"></div>`; | ||
| 124 | $(this.invisibleViewId).append(viewDiv); | 129 | $(this.invisibleViewId).append(viewDiv); |
| 130 | + }else if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.host){ | ||
| 131 | + //把远程视图添加到老师列表 | ||
| 132 | + loger.log("获取远程视频流成功->老师:" + stream.getId(),new Date().getTime()); | ||
| 133 | + let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.hostRemoteVideoWidth}px;height:${this.hostRemoteVideoHeight}px;"></div>`; | ||
| 134 | + $(this.hostRemoteViewId).append(viewDiv); | ||
| 125 | }else { | 135 | }else { |
| 126 | - $(this.remoteViewId).append(viewDiv); | 136 | + //把视图添加到学生列表 |
| 137 | + loger.log("获取远程视频流成功->学生:" + stream.getId(),new Date().getTime()); | ||
| 138 | + let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.normalRemoteVideoWidth}px;height:${this.normalRemoteVideoHeight}px;"></div>`; | ||
| 139 | + $(this.normalRemoteViewId).append(viewDiv); | ||
| 140 | + } | ||
| 141 | + //播放视频 | ||
| 142 | + try{ | ||
| 143 | + stream.play(this.xdyRemote + stream.getId()); | ||
| 144 | + }catch (err){ | ||
| 145 | + | ||
| 127 | } | 146 | } |
| 128 | - stream.play(this.xdyRemote + stream.getId()); | ||
| 129 | } | 147 | } |
| 130 | 148 | ||
| 131 | }); | 149 | }); |
| @@ -293,7 +311,7 @@ class WebRtcApe extends Emiter { | @@ -293,7 +311,7 @@ class WebRtcApe extends Emiter { | ||
| 293 | * 设置本地回显视图 | 311 | * 设置本地回显视图 |
| 294 | * */ | 312 | * */ |
| 295 | setLoaclView(_params) { | 313 | setLoaclView(_params) { |
| 296 | - loger.log("设置本地回显视图"); | 314 | + loger.log("设置自己本地回显视图"); |
| 297 | this.localViewId = _params.divId||""; | 315 | this.localViewId = _params.divId||""; |
| 298 | this.localStyle = _params.styleStr||""; | 316 | this.localStyle = _params.styleStr||""; |
| 299 | this.localVideoWidth=parseInt(_params.width)||320; | 317 | this.localVideoWidth=parseInt(_params.width)||320; |
| @@ -303,21 +321,34 @@ class WebRtcApe extends Emiter { | @@ -303,21 +321,34 @@ class WebRtcApe extends Emiter { | ||
| 303 | /* | 321 | /* |
| 304 | * 设置其他人的video视图容器 | 322 | * 设置其他人的video视图容器 |
| 305 | * */ | 323 | * */ |
| 306 | - setRemoteView(_params) { | ||
| 307 | - loger.log("设置其他人的video视图容器"); | ||
| 308 | - this.remoteViewId = _params.divId||""; | ||
| 309 | - this.remoteStyle = _params.styleStr||""; | ||
| 310 | - this.remoteVideoWidth=parseInt(_params.width)||320; | ||
| 311 | - this.remoteVideoHeight=parseInt(_params.height)||240; | 324 | + setHostRemoteMediaView(_params) { |
| 325 | + loger.log("设置老师视图容器"); | ||
| 326 | + this.hostRemoteViewId = _params.divId||""; | ||
| 327 | + this.hostRemoteStyle = _params.styleStr||""; | ||
| 328 | + this.hostRemoteVideoWidth=parseInt(_params.width)||320; | ||
| 329 | + this.hostRemoteVideoHeight=parseInt(_params.height)||240; | ||
| 330 | + } | ||
| 331 | + | ||
| 332 | + /* | ||
| 333 | + * 设置其他人的video视图容器 | ||
| 334 | + * */ | ||
| 335 | + setNormalRemoteMediaView(_params) { | ||
| 336 | + loger.log("设置学生视图容器"); | ||
| 337 | + this.normalRemoteViewId = _params.divId||""; | ||
| 338 | + this.normalRemoteStyle = _params.styleStr||""; | ||
| 339 | + this.normalRemoteVideoWidth=parseInt(_params.width)||320; | ||
| 340 | + this.normalRemoteVideoHeight=parseInt(_params.height)||240; | ||
| 312 | } | 341 | } |
| 313 | 342 | ||
| 314 | /* | 343 | /* |
| 315 | * 设置隐藏用户的video视图容器 | 344 | * 设置隐藏用户的video视图容器 |
| 316 | * */ | 345 | * */ |
| 317 | setInvisibleMediaView(_params) { | 346 | setInvisibleMediaView(_params) { |
| 318 | - loger.log("设置隐藏用户的video视图容器"); | 347 | + loger.log("设置监课视图容器"); |
| 319 | this.invisibleViewId = _params.divId||""; | 348 | this.invisibleViewId = _params.divId||""; |
| 320 | this.invisibleStyle = _params.styleStr||""; | 349 | this.invisibleStyle = _params.styleStr||""; |
| 350 | + this.invisibleVideoWidth=parseInt(_params.width)||320; | ||
| 351 | + this.invisibleVideoHeight=parseInt(_params.height)||240; | ||
| 321 | } | 352 | } |
| 322 | /* | 353 | /* |
| 323 | * 切换当前使用的设备 | 354 | * 切换当前使用的设备 |
-
请 注册 或 登录 后发表评论