李勇

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

... ... @@ -62,7 +62,7 @@ export default class MessageEntrance extends Emiter {
constructor() {
super();
//sdk 信息
GlobalConfig.sdkVersion = "v2.4.4.20170908";
GlobalConfig.sdkVersion = "v2.5.5.20170914";
loger.warn("sdkVersion:" + GlobalConfig.sdkVersion);
//设置
... ...
... ... @@ -125,21 +125,22 @@ class WebRtcApe extends Emiter {
if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.invisible){
//把远程视频添加到监课列表
loger.log("获取远程视频流成功->监课:" + stream.getId(),new Date().getTime());
let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.invisibleVideoWidth}px;height:${this.invisibleVideoHeight}px;"></div>`;
let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.invisibleVideoWidth}px;height:${this.invisibleVideoHeight}px;float: left;margin-right: 1px;"></div>`;
$(this.invisibleViewId).append(viewDiv);
}else if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.host){
//把远程视图添加到老师列表
loger.log("获取远程视频流成功->老师:" + stream.getId(),new Date().getTime());
let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.hostRemoteVideoWidth}px;height:${this.hostRemoteVideoHeight}px;"></div>`;
let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.hostRemoteVideoWidth}px;height:${this.hostRemoteVideoHeight}px;float: left;margin-right: 1px;"></div>`;
$(this.hostRemoteViewId).append(viewDiv);
}else {
//把视图添加到学生列表
loger.log("获取远程视频流成功->学生:" + stream.getId(),new Date().getTime());
let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.normalRemoteVideoWidth}px;height:${this.normalRemoteVideoHeight}px;"></div>`;
let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.normalRemoteVideoWidth}px;height:${this.normalRemoteVideoHeight}px;float: left;margin-right: 1px;"></div>`;
$(this.normalRemoteViewId).append(viewDiv);
}
//播放视频
try{
$("bar_"+stream.getId()).hide();
stream.play(this.xdyRemote + stream.getId());
}catch (err){
... ... @@ -252,7 +253,19 @@ class WebRtcApe extends Emiter {
return;
}
this.localStream.init(()=> {
let viewName = this.localViewId.replace("#", "");
//let viewName = this.localViewId.replace("#", "");
let viewName='localVideoBox_'+this.uid;
let videoBox=document.createElement("div");
videoBox.id=viewName;
videoBox.style.width=this.localVideoWidth+'px';
videoBox.style.height=this.localVideoHeight+'px';
videoBox.style.float='left';
videoBox.style.marginRight="1px";
$(this.localViewId).prepend(videoBox);//自己的视图往前添加
$("#"+viewName).css("transform", 'rotateY(180deg)');
loger.log("webRtc->推流->",viewName,new Date().getTime());
this.localStream.play(viewName);
this.client.publish(this.localStream, (err)=> {
... ... @@ -293,7 +306,9 @@ class WebRtcApe extends Emiter {
loger.log("webRtc->停止推流->失败" + err);
});
this.localStream.close();
$(this.localViewId).html("");
//$(this.localViewId).html("");
$('#localVideoBox_' + this.uid).remove();
this.isPublish=false;
GlobalConfig.openCamera =0;
GlobalConfig.openMicrophones =0;
... ...