李勇

修改webRtc推流失败和拉流失败\设备切换的处理

... ... @@ -62,7 +62,7 @@ export default class MessageEntrance extends Emiter {
constructor() {
super();
//sdk 信息
GlobalConfig.sdkVersion = "v2.8.7.20170916";
GlobalConfig.sdkVersion = "v2.8.8.20170917";
loger.warn("sdkVersion:" + GlobalConfig.sdkVersion);
//设置
... ...
... ... @@ -195,15 +195,20 @@ class WebRtcApe extends Emiter {
loger.log("添加一个远程视频流: " + _stream.getId(),new Date().getTime());
this.client.subscribe(_stream, (err)=> {
loger.warn("添加一个远程视频流->失败", err);
clearTimeout(this.reAddRemoteStreamDelay);
//clearTimeout(this.reAddRemoteStreamDelay);
if(err=="INVALID_REMOTE_STREAM"){
//流已经无效,不需要再重连
loger.warn("流已经无效->不需要再重连", err);
return;
}
this.reAddRemoteStreamDelay=setTimeout(()=>{
loger.warn("连接远程的流失败->尝试重新连接");
this.reAddRemoteStream(_stream);
},1400);
if(err=="PEERCONNECTION_FAILED"){
//this.reAddRemoteStreamDelay=setTimeout(()=>{
setTimeout(()=>{
loger.warn("连接远程的流失败->尝试重新连接");
this.reAddRemoteStream(_stream);
},1400);
}
});
}
... ... @@ -234,7 +239,7 @@ class WebRtcApe extends Emiter {
this.rePublishDelay=setTimeout(()=>{
this.publish();
},1200);
this.publish();
//this.publish();
}else {
this.openLoaclStream();
}
... ... @@ -318,7 +323,7 @@ class WebRtcApe extends Emiter {
GlobalConfig.openCamera =0;
GlobalConfig.openMicrophones =0;
this.isPublish=false;
this.clearLocalView();
this.unpublish();
});
this.client.on('stream-published', (evt)=> {
loger.log("webRtc->推流成功->",new Date().getTime());
... ... @@ -354,8 +359,6 @@ class WebRtcApe extends Emiter {
loger.log("webRtc->停止推流->失败" + err);
});
this.localStream.close();
//$('#localVideoBox_' + this.uid).remove();
//$("#videoOwnerName_"+this.uid).remove();
this.clearLocalView();
this.isPublish=false;
GlobalConfig.openCamera =0;
... ...