李勇

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.0.20170907"; 65 + GlobalConfig.sdkVersion = "v2.4.2.20170908";
66 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); 66 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion);
67 67
68 //设置 68 //设置
@@ -325,21 +325,21 @@ export default class MessageEntrance extends Emiter { @@ -325,21 +325,21 @@ export default class MessageEntrance extends Emiter {
325 //上传log日志 325 //上传log日志
326 _addLog(_data) { 326 _addLog(_data) {
327 if (_data) { 327 if (_data) {
328 - LogManager.addLog(LogManager.LOG, _data); 328 + LogManager.addLog(LogManager.LOG, _data.msg||"");
329 } 329 }
330 } 330 }
331 331
332 //上传warn日志 332 //上传warn日志
333 _addWarn(_data) { 333 _addWarn(_data) {
334 if (_data) { 334 if (_data) {
335 - LogManager.addLog(LogManager.WARN, _data); 335 + LogManager.addLog(LogManager.WARN, _data.msg||"");
336 } 336 }
337 } 337 }
338 338
339 //上传error日志 339 //上传error日志
340 _addError(_data) { 340 _addError(_data) {
341 if (_data) { 341 if (_data) {
342 - LogManager.addLog(LogManager.ERROR, _data); 342 + LogManager.addLog(LogManager.ERROR, _data.msg||"");
343 } 343 }
344 } 344 }
345 345
@@ -108,7 +108,7 @@ class WebRtcApe extends Emiter { @@ -108,7 +108,7 @@ class WebRtcApe extends Emiter {
108 108
109 this.client.on('stream-added', (evt)=> { 109 this.client.on('stream-added', (evt)=> {
110 let stream = evt.stream; 110 let stream = evt.stream;
111 - loger.log("添加一个远程视频流: " + stream.getId()); 111 + loger.log("添加一个远程视频流: " + stream.getId(),new Date().getTime());
112 this.client.subscribe(stream, (err)=> { 112 this.client.subscribe(stream, (err)=> {
113 loger.log("添加一个远程视频流->failed", err); 113 loger.log("添加一个远程视频流->failed", err);
114 }); 114 });
@@ -117,7 +117,7 @@ class WebRtcApe extends Emiter { @@ -117,7 +117,7 @@ class WebRtcApe extends Emiter {
117 this.client.on('stream-subscribed', (evt)=> { 117 this.client.on('stream-subscribed', (evt)=> {
118 let stream = evt.stream; 118 let stream = evt.stream;
119 if(stream){ 119 if(stream){
120 - loger.log("获取远程视频流成功: " + stream.getId()); 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>`; 121 let viewDiv=`<div id="${this.xdyRemote + stream.getId()}" style="width:${this.remoteVideoWidth}px;height:${this.remoteVideoHeight}px;"></div>`;
122 if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.invisible){ 122 if(GlobalConfig.getUserRoleFromeNodeId(stream.getId())==ApeConsts.invisible){
123 //显示隐藏用户 123 //显示隐藏用户
@@ -235,7 +235,7 @@ class WebRtcApe extends Emiter { @@ -235,7 +235,7 @@ class WebRtcApe extends Emiter {
235 } 235 }
236 this.localStream.init(()=> { 236 this.localStream.init(()=> {
237 let viewName = this.localViewId.replace("#", ""); 237 let viewName = this.localViewId.replace("#", "");
238 - loger.log("webRtc->推流->",viewName); 238 + loger.log("webRtc->推流->",viewName,new Date().getTime());
239 this.localStream.play(viewName); 239 this.localStream.play(viewName);
240 this.client.publish(this.localStream, (err)=> { 240 this.client.publish(this.localStream, (err)=> {
241 loger.log("webRtc->推流失败: " + err); 241 loger.log("webRtc->推流失败: " + err);
@@ -243,28 +243,31 @@ class WebRtcApe extends Emiter { @@ -243,28 +243,31 @@ class WebRtcApe extends Emiter {
243 GlobalConfig.openMicrophones =0; 243 GlobalConfig.openMicrophones =0;
244 this.isPublish=false; 244 this.isPublish=false;
245 }); 245 });
246 - this.isPublish=true;  
247 - GlobalConfig.openCamera = EngineUtils.creatTimestamp();  
248 - GlobalConfig.openMicrophones = GlobalConfig.openCamera;  
249 -  
250 - this._emit(MessageTypes.USER_DEVICE_STATUS_CHAANGE, {  
251 - nodeId: GlobalConfig.nodeId,  
252 - userRole: GlobalConfig.userRole,  
253 - userName: GlobalConfig.userName,  
254 - userId: GlobalConfig.userId,  
255 - openCamera: GlobalConfig.openCamera,  
256 - openMicrophones: GlobalConfig.openMicrophones 246 + this.client.on('stream-published', (evt)=> {
  247 + loger.log("webRtc->推流成功->",new Date().getTime());
  248 + this.isPublish=true;
  249 + GlobalConfig.openCamera = EngineUtils.creatTimestamp();
  250 + GlobalConfig.openMicrophones = GlobalConfig.openCamera;
  251 + this._emit(MessageTypes.USER_DEVICE_STATUS_CHAANGE, {
  252 + nodeId: GlobalConfig.nodeId,
  253 + userRole: GlobalConfig.userRole,
  254 + userName: GlobalConfig.userName,
  255 + userId: GlobalConfig.userId,
  256 + openCamera: GlobalConfig.openCamera,
  257 + openMicrophones: GlobalConfig.openMicrophones
  258 + });
257 }); 259 });
258 260
259 }, (err)=> { 261 }, (err)=> {
260 loger.warn("webRtc->推流->本地流开启失败", err); 262 loger.warn("webRtc->推流->本地流开启失败", err);
  263 + this.isPublish=false;
261 this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED,err); 264 this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED,err);
262 }); 265 });
263 } 266 }
264 267
265 unpublish() { 268 unpublish() {
266 clearTimeout(this.rePublishDelay); 269 clearTimeout(this.rePublishDelay);
267 - loger.log("webRtc->停止推流 "); 270 + loger.log("webRtc->停止推流 ",new Date().getTime());
268 if (!this.client||!this.localStream) { 271 if (!this.client||!this.localStream) {
269 return; 272 return;
270 } 273 }