李勇

1.设webRtc自己视图和远程视图的布局和样式设置;2.处理本地视图被翻转的问题;

@@ -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.4.20170908"; 65 + GlobalConfig.sdkVersion = "v2.5.5.20170914";
66 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); 66 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion);
67 67
68 //设置 68 //设置
@@ -125,21 +125,22 @@ class WebRtcApe extends Emiter { @@ -125,21 +125,22 @@ class WebRtcApe extends Emiter {
125 if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.invisible){ 125 if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.invisible){
126 //把远程视频添加到监课列表 126 //把远程视频添加到监课列表
127 loger.log("获取远程视频流成功->监课:" + stream.getId(),new Date().getTime()); 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>`; 128 + let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.invisibleVideoWidth}px;height:${this.invisibleVideoHeight}px;float: left;margin-right: 1px;"></div>`;
129 $(this.invisibleViewId).append(viewDiv); 129 $(this.invisibleViewId).append(viewDiv);
130 }else if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.host){ 130 }else if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.host){
131 //把远程视图添加到老师列表 131 //把远程视图添加到老师列表
132 loger.log("获取远程视频流成功->老师:" + stream.getId(),new Date().getTime()); 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>`; 133 + let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.hostRemoteVideoWidth}px;height:${this.hostRemoteVideoHeight}px;float: left;margin-right: 1px;"></div>`;
134 $(this.hostRemoteViewId).append(viewDiv); 134 $(this.hostRemoteViewId).append(viewDiv);
135 }else { 135 }else {
136 //把视图添加到学生列表 136 //把视图添加到学生列表
137 loger.log("获取远程视频流成功->学生:" + stream.getId(),new Date().getTime()); 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>`; 138 + let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.normalRemoteVideoWidth}px;height:${this.normalRemoteVideoHeight}px;float: left;margin-right: 1px;"></div>`;
139 $(this.normalRemoteViewId).append(viewDiv); 139 $(this.normalRemoteViewId).append(viewDiv);
140 } 140 }
141 //播放视频 141 //播放视频
142 try{ 142 try{
  143 + $("bar_"+stream.getId()).hide();
143 stream.play(this.xdyRemote + stream.getId()); 144 stream.play(this.xdyRemote + stream.getId());
144 }catch (err){ 145 }catch (err){
145 146
@@ -252,7 +253,19 @@ class WebRtcApe extends Emiter { @@ -252,7 +253,19 @@ class WebRtcApe extends Emiter {
252 return; 253 return;
253 } 254 }
254 this.localStream.init(()=> { 255 this.localStream.init(()=> {
255 - let viewName = this.localViewId.replace("#", ""); 256 + //let viewName = this.localViewId.replace("#", "");
  257 + let viewName='localVideoBox_'+this.uid;
  258 + let videoBox=document.createElement("div");
  259 + videoBox.id=viewName;
  260 + videoBox.style.width=this.localVideoWidth+'px';
  261 + videoBox.style.height=this.localVideoHeight+'px';
  262 + videoBox.style.float='left';
  263 + videoBox.style.marginRight="1px";
  264 +
  265 + $(this.localViewId).prepend(videoBox);//自己的视图往前添加
  266 + $("#"+viewName).css("transform", 'rotateY(180deg)');
  267 +
  268 +
256 loger.log("webRtc->推流->",viewName,new Date().getTime()); 269 loger.log("webRtc->推流->",viewName,new Date().getTime());
257 this.localStream.play(viewName); 270 this.localStream.play(viewName);
258 this.client.publish(this.localStream, (err)=> { 271 this.client.publish(this.localStream, (err)=> {
@@ -293,7 +306,9 @@ class WebRtcApe extends Emiter { @@ -293,7 +306,9 @@ class WebRtcApe extends Emiter {
293 loger.log("webRtc->停止推流->失败" + err); 306 loger.log("webRtc->停止推流->失败" + err);
294 }); 307 });
295 this.localStream.close(); 308 this.localStream.close();
296 - $(this.localViewId).html(""); 309 + //$(this.localViewId).html("");
  310 + $('#localVideoBox_' + this.uid).remove();
  311 +
297 this.isPublish=false; 312 this.isPublish=false;
298 GlobalConfig.openCamera =0; 313 GlobalConfig.openCamera =0;
299 GlobalConfig.openMicrophones =0; 314 GlobalConfig.openMicrophones =0;