正在显示
4 个修改的文件
包含
106 行增加
和
78 行删除
| @@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter { | @@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter { | ||
| 63 | super(); | 63 | super(); |
| 64 | this.lastClassActiveTime=0;//最后一次课堂激活的时间戳 | 64 | this.lastClassActiveTime=0;//最后一次课堂激活的时间戳 |
| 65 | //sdk 信息 | 65 | //sdk 信息 |
| 66 | - GlobalConfig.sdkVersion = "v2.38.6.201712013"; | 66 | + GlobalConfig.sdkVersion = "v2.38.11.20171214"; |
| 67 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); | 67 | loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); |
| 68 | console.log("sdkVersion:" + GlobalConfig.sdkVersion); | 68 | console.log("sdkVersion:" + GlobalConfig.sdkVersion); |
| 69 | //设置 | 69 | //设置 |
| @@ -849,7 +849,7 @@ class ConferApe extends Ape { | @@ -849,7 +849,7 @@ class ConferApe extends Ape { | ||
| 849 | this.changeHandUpStatus(msgObj); | 849 | this.changeHandUpStatus(msgObj); |
| 850 | } | 850 | } |
| 851 | } catch (err) { | 851 | } catch (err) { |
| 852 | - loger.warn('chatMsg->JSON数据解析失败'); | 852 | + loger.warn('CLASS_ACTION_HANDUP_STATUS_CHANGE->JSON数据解析失败'); |
| 853 | } | 853 | } |
| 854 | break; | 854 | break; |
| 855 | case ApeConsts.CLASS_ACTION_DRAW_STATUS_CHANGE: | 855 | case ApeConsts.CLASS_ACTION_DRAW_STATUS_CHANGE: |
| @@ -860,7 +860,7 @@ class ConferApe extends Ape { | @@ -860,7 +860,7 @@ class ConferApe extends Ape { | ||
| 860 | this.changeUserDrawStatus(drawMsgObj); | 860 | this.changeUserDrawStatus(drawMsgObj); |
| 861 | } | 861 | } |
| 862 | } catch (err) { | 862 | } catch (err) { |
| 863 | - loger.warn('chatMsg->JSON数据解析失败'); | 863 | + loger.warn('CLASS_ACTION_DRAW_STATUS_CHANGE->JSON数据解析失败'); |
| 864 | } | 864 | } |
| 865 | break; | 865 | break; |
| 866 | case ApeConsts.USER_ACTION_SILENCE_STATUS_CHANGE: | 866 | case ApeConsts.USER_ACTION_SILENCE_STATUS_CHANGE: |
| @@ -871,18 +871,19 @@ class ConferApe extends Ape { | @@ -871,18 +871,19 @@ class ConferApe extends Ape { | ||
| 871 | this.changeSilenceStatus(silenceMsg); | 871 | this.changeSilenceStatus(silenceMsg); |
| 872 | } | 872 | } |
| 873 | } catch (err) { | 873 | } catch (err) { |
| 874 | - loger.warn('chatMsg->JSON数据解析失败'); | 874 | + loger.warn('USER_ACTION_SILENCE_STATUS_CHANGE->JSON数据解析失败'); |
| 875 | } | 875 | } |
| 876 | break; | 876 | break; |
| 877 | case ApeConsts.MEDIA_ENABLED_CHANGE: | 877 | case ApeConsts.MEDIA_ENABLED_CHANGE: |
| 878 | let mediaMsgObj = null; | 878 | let mediaMsgObj = null; |
| 879 | try { | 879 | try { |
| 880 | mediaMsgObj = JSON.parse(chatMsg.message); | 880 | mediaMsgObj = JSON.parse(chatMsg.message); |
| 881 | + //console.log("MEDIA_ENABLED_CHANGE",mediaMsgObj,chatMsg); | ||
| 881 | if (mediaMsgObj) { | 882 | if (mediaMsgObj) { |
| 882 | this.receiveChangeUserMediaEnabledStatus(mediaMsgObj); | 883 | this.receiveChangeUserMediaEnabledStatus(mediaMsgObj); |
| 883 | } | 884 | } |
| 884 | } catch (err) { | 885 | } catch (err) { |
| 885 | - loger.warn('chatMsg->JSON数据解析失败',chatMsg.message); | 886 | + loger.warn('MEDIA_ENABLED_CHANGE->JSON数据解析失败',chatMsg.message,err.message); |
| 886 | } | 887 | } |
| 887 | break; | 888 | break; |
| 888 | default: | 889 | default: |
| @@ -755,8 +755,8 @@ class VideoApe extends Ape { | @@ -755,8 +755,8 @@ class VideoApe extends Ape { | ||
| 755 | if (unpackChannelInfo.status == ApeConsts.CHANNEL_STATUS_OPENING) { | 755 | if (unpackChannelInfo.status == ApeConsts.CHANNEL_STATUS_OPENING) { |
| 756 | GlobalConfig.openCamera = EngineUtils.creatTimestamp(); | 756 | GlobalConfig.openCamera = EngineUtils.creatTimestamp(); |
| 757 | GlobalConfig.openMicrophones = GlobalConfig.openCamera; | 757 | GlobalConfig.openMicrophones = GlobalConfig.openCamera; |
| 758 | - GlobalConfig.videoEnabled=true; | ||
| 759 | - GlobalConfig.audioEnabled=true; | 758 | + //GlobalConfig.videoEnabled=true; |
| 759 | + //GlobalConfig.audioEnabled=true; | ||
| 760 | } else { | 760 | } else { |
| 761 | GlobalConfig.openCamera = 0; | 761 | GlobalConfig.openCamera = 0; |
| 762 | GlobalConfig.openMicrophones = 0; | 762 | GlobalConfig.openMicrophones = 0; |
| @@ -48,7 +48,7 @@ class WebRtcApe extends Emiter { | @@ -48,7 +48,7 @@ class WebRtcApe extends Emiter { | ||
| 48 | this.curCameraId = ""; | 48 | this.curCameraId = ""; |
| 49 | this.curMicrophoneId = ""; | 49 | this.curMicrophoneId = ""; |
| 50 | 50 | ||
| 51 | - this.speakerList=[];//记录讲话的记录 | 51 | + this.speakerList = [];//记录讲话的记录 |
| 52 | this.remoteVideoList = {};//记录远程视频流 | 52 | this.remoteVideoList = {};//记录远程视频流 |
| 53 | 53 | ||
| 54 | this.pWidth = SIZE_480; | 54 | this.pWidth = SIZE_480; |
| @@ -63,7 +63,7 @@ class WebRtcApe extends Emiter { | @@ -63,7 +63,7 @@ class WebRtcApe extends Emiter { | ||
| 63 | this.isOpenVideo = true;//是否开启摄像头,默认为开启,如果获取不到麦克风的时候会设置为false | 63 | this.isOpenVideo = true;//是否开启摄像头,默认为开启,如果获取不到麦克风的时候会设置为false |
| 64 | 64 | ||
| 65 | this.firstPublishSuccess = false;//记录加入频道成功之后是否推流成功过,离开频道之后需要设置为false | 65 | this.firstPublishSuccess = false;//记录加入频道成功之后是否推流成功过,离开频道之后需要设置为false |
| 66 | - this.isWebSocketDisconnect=false;//记录中途是否已经断开 | 66 | + this.isWebSocketDisconnect = false;//记录中途是否已经断开 |
| 67 | this.isPublish = false;//当前是否正在推流 | 67 | this.isPublish = false;//当前是否正在推流 |
| 68 | this.videoScale = 1;//视图的缩放比例,默认为1; | 68 | this.videoScale = 1;//视图的缩放比例,默认为1; |
| 69 | 69 | ||
| @@ -149,7 +149,7 @@ class WebRtcApe extends Emiter { | @@ -149,7 +149,7 @@ class WebRtcApe extends Emiter { | ||
| 149 | this.channelKey = ""; | 149 | this.channelKey = ""; |
| 150 | this.client.on('error', (err) => { | 150 | this.client.on('error', (err) => { |
| 151 | loger.log("WebRtc异常:", err); | 151 | loger.log("WebRtc异常:", err); |
| 152 | - switch (err.reason){ | 152 | + switch (err.reason) { |
| 153 | case "DYNAMIC_KEY_TIMEOUT": | 153 | case "DYNAMIC_KEY_TIMEOUT": |
| 154 | this.client.renewChannelKey(this.channelKey, ()=> { | 154 | this.client.renewChannelKey(this.channelKey, ()=> { |
| 155 | loger.log("Renew channel key successfully"); | 155 | loger.log("Renew channel key successfully"); |
| @@ -159,12 +159,12 @@ class WebRtcApe extends Emiter { | @@ -159,12 +159,12 @@ class WebRtcApe extends Emiter { | ||
| 159 | break; | 159 | break; |
| 160 | case "SOCKET_DISCONNECTED": | 160 | case "SOCKET_DISCONNECTED": |
| 161 | //连接断开 | 161 | //连接断开 |
| 162 | - this.isWebSocketDisconnect=true; | 162 | + this.isWebSocketDisconnect = true; |
| 163 | this._emit(MessageTypes.WEB_RTC_LEAVE_CHANNEL); | 163 | this._emit(MessageTypes.WEB_RTC_LEAVE_CHANNEL); |
| 164 | break; | 164 | break; |
| 165 | case "SOCKET_ERROR": | 165 | case "SOCKET_ERROR": |
| 166 | //连接断开 | 166 | //连接断开 |
| 167 | - this.isWebSocketDisconnect=true; | 167 | + this.isWebSocketDisconnect = true; |
| 168 | this._emit(MessageTypes.WEB_RTC_LEAVE_CHANNEL); | 168 | this._emit(MessageTypes.WEB_RTC_LEAVE_CHANNEL); |
| 169 | break; | 169 | break; |
| 170 | default : | 170 | default : |
| @@ -221,17 +221,17 @@ class WebRtcApe extends Emiter { | @@ -221,17 +221,17 @@ class WebRtcApe extends Emiter { | ||
| 221 | let uid = evt.uid; | 221 | let uid = evt.uid; |
| 222 | let user = GlobalConfig.getUserInfoFromeNodeId(parseInt(uid)); | 222 | let user = GlobalConfig.getUserInfoFromeNodeId(parseInt(uid)); |
| 223 | //console.log("active-speaker",user); | 223 | //console.log("active-speaker",user); |
| 224 | - /* if (user) { | ||
| 225 | - let roleRole = GlobalConfig.getUserRoleToString(user.role); | ||
| 226 | - this.speakerList.push("当前正在讲话的 [" + roleRole + "] name:" + user.name + " uid:" + uid); | ||
| 227 | - } else { | ||
| 228 | - this.speakerList.push("当前正在讲话的uid:" + uid); | ||
| 229 | - }*/ | ||
| 230 | - /* //记录正在讲话的数据,大于50条上报一次 | ||
| 231 | - if(this.speakerList.length>20){ | ||
| 232 | - loger.log(this.speakerList); | ||
| 233 | - this.speakerList=[]; | ||
| 234 | - }*/ | 224 | + /* if (user) { |
| 225 | + let roleRole = GlobalConfig.getUserRoleToString(user.role); | ||
| 226 | + this.speakerList.push("当前正在讲话的 [" + roleRole + "] name:" + user.name + " uid:" + uid); | ||
| 227 | + } else { | ||
| 228 | + this.speakerList.push("当前正在讲话的uid:" + uid); | ||
| 229 | + }*/ | ||
| 230 | + /* //记录正在讲话的数据,大于50条上报一次 | ||
| 231 | + if(this.speakerList.length>20){ | ||
| 232 | + loger.log(this.speakerList); | ||
| 233 | + this.speakerList=[]; | ||
| 234 | + }*/ | ||
| 235 | }); | 235 | }); |
| 236 | 236 | ||
| 237 | } | 237 | } |
| @@ -251,7 +251,7 @@ class WebRtcApe extends Emiter { | @@ -251,7 +251,7 @@ class WebRtcApe extends Emiter { | ||
| 251 | if (len < 1) { | 251 | if (len < 1) { |
| 252 | loger.log("添加之前先删除之前存在的重复视图", uid); | 252 | loger.log("添加之前先删除之前存在的重复视图", uid); |
| 253 | $("#" + this.xdyRemote + uid).remove(); | 253 | $("#" + this.xdyRemote + uid).remove(); |
| 254 | - } | 254 | + } |
| 255 | 255 | ||
| 256 | let audioMutedDiv = ""; | 256 | let audioMutedDiv = ""; |
| 257 | let videoMutedDiv = ""; | 257 | let videoMutedDiv = ""; |
| @@ -314,7 +314,11 @@ class WebRtcApe extends Emiter { | @@ -314,7 +314,11 @@ class WebRtcApe extends Emiter { | ||
| 314 | $("#player_" + uid).css("pointer-events", "none"); | 314 | $("#player_" + uid).css("pointer-events", "none"); |
| 315 | //更新音视频禁用状态显示 | 315 | //更新音视频禁用状态显示 |
| 316 | if (uid != GlobalConfig.nodeId) { | 316 | if (uid != GlobalConfig.nodeId) { |
| 317 | - this.receiveWebRtcMeiaEnabledChange({nodeId: uid, video: Boolean(user.videoEnabled), audio: Boolean(user.audioEnabled)}); | 317 | + this.receiveWebRtcMeiaEnabledChange({ |
| 318 | + nodeId: uid, | ||
| 319 | + video: Boolean(user.videoEnabled), | ||
| 320 | + audio: Boolean(user.audioEnabled) | ||
| 321 | + }); | ||
| 318 | } | 322 | } |
| 319 | if (user && (user.deviceType == GlobalConfig.deviceIOS || user.deviceType == GlobalConfig.deviceAndroid)) { | 323 | if (user && (user.deviceType == GlobalConfig.deviceIOS || user.deviceType == GlobalConfig.deviceAndroid)) { |
| 320 | this.remoteVideoList[user.nodeId] = stream; | 324 | this.remoteVideoList[user.nodeId] = stream; |
| @@ -325,16 +329,17 @@ class WebRtcApe extends Emiter { | @@ -325,16 +329,17 @@ class WebRtcApe extends Emiter { | ||
| 325 | } | 329 | } |
| 326 | 330 | ||
| 327 | /* | 331 | /* |
| 328 | - * | ||
| 329 | - * 断线后重连成功 | ||
| 330 | - * */ | ||
| 331 | - reJoinChannelSuccess(){ | ||
| 332 | - if(this.isWebSocketDisconnect){ | 332 | + * |
| 333 | + * 断线后重连成功 | ||
| 334 | + * */ | ||
| 335 | + reJoinChannelSuccess() { | ||
| 336 | + if (this.isWebSocketDisconnect) { | ||
| 333 | loger.log("断线重连成功"); | 337 | loger.log("断线重连成功"); |
| 334 | this._emit(MessageTypes.WEB_RTC_REJOIN_SUCCESS); | 338 | this._emit(MessageTypes.WEB_RTC_REJOIN_SUCCESS); |
| 335 | } | 339 | } |
| 336 | - this.isWebSocketDisconnect=false; | 340 | + this.isWebSocketDisconnect = false; |
| 337 | } | 341 | } |
| 342 | + | ||
| 338 | //清除无效的视图 | 343 | //清除无效的视图 |
| 339 | clearInvalidVideoView() { | 344 | clearInvalidVideoView() { |
| 340 | let normalList = document.getElementsByClassName(this.normalWebRtcVideoClass); | 345 | let normalList = document.getElementsByClassName(this.normalWebRtcVideoClass); |
| @@ -471,7 +476,7 @@ class WebRtcApe extends Emiter { | @@ -471,7 +476,7 @@ class WebRtcApe extends Emiter { | ||
| 471 | this.client.join(this.channelKey, "" + this.channelId, this.uid, (uid)=> { | 476 | this.client.join(this.channelKey, "" + this.channelId, this.uid, (uid)=> { |
| 472 | this.uid = uid; | 477 | this.uid = uid; |
| 473 | loger.log("加入视频通话频道->成功->channelId:" + this.channelId, "uid:" + this.uid); | 478 | loger.log("加入视频通话频道->成功->channelId:" + this.channelId, "uid:" + this.uid); |
| 474 | - this.isWebSocketDisconnect=false; | 479 | + this.isWebSocketDisconnect = false; |
| 475 | this._emit(MessageTypes.WEB_RTC_JOIN_SUCCESS); | 480 | this._emit(MessageTypes.WEB_RTC_JOIN_SUCCESS); |
| 476 | this.openLoaclStream(); | 481 | this.openLoaclStream(); |
| 477 | 482 | ||
| @@ -520,12 +525,12 @@ class WebRtcApe extends Emiter { | @@ -520,12 +525,12 @@ class WebRtcApe extends Emiter { | ||
| 520 | screen: false | 525 | screen: false |
| 521 | }); | 526 | }); |
| 522 | 527 | ||
| 523 | - this.localStream.on("accessAllowed", function(){ | 528 | + this.localStream.on("accessAllowed", function () { |
| 524 | loger.warn("摄像头麦克风->已经获取权限"); | 529 | loger.warn("摄像头麦克风->已经获取权限"); |
| 525 | }) | 530 | }) |
| 526 | 531 | ||
| 527 | // The user has denied access to the camera and mic. | 532 | // The user has denied access to the camera and mic. |
| 528 | - this.localStream.on("accessDenied", function(){ | 533 | + this.localStream.on("accessDenied", function () { |
| 529 | loger.warn("摄像头和麦克风->权限获取失败"); | 534 | loger.warn("摄像头和麦克风->权限获取失败"); |
| 530 | }) | 535 | }) |
| 531 | 536 | ||
| @@ -672,7 +677,8 @@ class WebRtcApe extends Emiter { | @@ -672,7 +677,8 @@ class WebRtcApe extends Emiter { | ||
| 672 | this.localStream.play(viewName); | 677 | this.localStream.play(viewName); |
| 673 | this.client.publish(this.localStream, (err)=> { | 678 | this.client.publish(this.localStream, (err)=> { |
| 674 | loger.log("webRtc->推流失败: " + err); | 679 | loger.log("webRtc->推流失败: " + err); |
| 675 | - this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type:"error",msg:err.msg||err}); | 680 | + //this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type:"error",msg:err.msg||err}); |
| 681 | + this._publishError(err.msg || err); | ||
| 676 | this.isPublish = false; | 682 | this.isPublish = false; |
| 677 | this.unpublish(); | 683 | this.unpublish(); |
| 678 | }); | 684 | }); |
| @@ -680,41 +686,58 @@ class WebRtcApe extends Emiter { | @@ -680,41 +686,58 @@ class WebRtcApe extends Emiter { | ||
| 680 | loger.warn("webRtc->推流->本地流开启失败", err); | 686 | loger.warn("webRtc->推流->本地流开启失败", err); |
| 681 | this.isPublish = false; | 687 | this.isPublish = false; |
| 682 | this.clearLocalView(); | 688 | this.clearLocalView(); |
| 683 | - this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type:"error",msg:err.msg||err}); | ||
| 684 | - if (err) { | ||
| 685 | - switch (err.msg) { | ||
| 686 | - case "DEVICES_NOT_FOUND": | ||
| 687 | - this.curCameraId = ""; | ||
| 688 | - this.curMicrophoneId = ""; | ||
| 689 | - this.unpublish(); | ||
| 690 | - break; | ||
| 691 | - case "NOT_SUPPORTED": | ||
| 692 | - this.curCameraId = ""; | ||
| 693 | - this.curMicrophoneId = ""; | ||
| 694 | - this.unpublish(); | ||
| 695 | - break; | ||
| 696 | - case "PERMISSION_DENIED": | ||
| 697 | - this.curCameraId = ""; | ||
| 698 | - this.curMicrophoneId = ""; | ||
| 699 | - this.unpublish(); | ||
| 700 | - break; | ||
| 701 | - case "CONSTRAINT_NOT_SATISFIED": | ||
| 702 | - this.curCameraId = ""; | ||
| 703 | - this.curMicrophoneId = ""; | ||
| 704 | - this.unpublish(); | ||
| 705 | - break; | ||
| 706 | - case "STREAM_ALREADY_INITIALIZED": | ||
| 707 | - this.curCameraId = ""; | ||
| 708 | - this.curMicrophoneId = ""; | ||
| 709 | - this.unpublish(); | ||
| 710 | - break; | ||
| 711 | - default: | ||
| 712 | - break | ||
| 713 | - } | ||
| 714 | - } | 689 | + this._publishError(err.msg || err); |
| 715 | }); | 690 | }); |
| 716 | } | 691 | } |
| 717 | 692 | ||
| 693 | + /* | ||
| 694 | + * 推流失败 | ||
| 695 | + * */ | ||
| 696 | + _publishError(_msg) { | ||
| 697 | + switch (_msg) { | ||
| 698 | + case "DEVICES_NOT_FOUND": | ||
| 699 | + if (this.cameras.length < 1 && this.microphones.length < 1) { | ||
| 700 | + this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type: "error", msg: "DEVICES_NOT_FOUND"}); | ||
| 701 | + } else if (this.cameras.length < 1 && this.microphones.length >0) { | ||
| 702 | + this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type: "error", msg: "DEVICES_NOT_FOUND_CAMERA"}); | ||
| 703 | + } else if (this.cameras.length >0 && this.microphones.length < 1) { | ||
| 704 | + this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type: "error", msg: "DEVICES_NOT_FOUND_MIC"}); | ||
| 705 | + } | ||
| 706 | + | ||
| 707 | + this.curCameraId = ""; | ||
| 708 | + this.curMicrophoneId = ""; | ||
| 709 | + this.unpublish(); | ||
| 710 | + break; | ||
| 711 | + case "NOT_SUPPORTED": | ||
| 712 | + this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type: "error", msg: _msg}); | ||
| 713 | + this.curCameraId = ""; | ||
| 714 | + this.curMicrophoneId = ""; | ||
| 715 | + this.unpublish(); | ||
| 716 | + break; | ||
| 717 | + case "PERMISSION_DENIED": | ||
| 718 | + this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type: "error", msg: _msg}); | ||
| 719 | + this.curCameraId = ""; | ||
| 720 | + this.curMicrophoneId = ""; | ||
| 721 | + this.unpublish(); | ||
| 722 | + break; | ||
| 723 | + case "CONSTRAINT_NOT_SATISFIED": | ||
| 724 | + this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type: "error", msg: _msg}); | ||
| 725 | + this.curCameraId = ""; | ||
| 726 | + this.curMicrophoneId = ""; | ||
| 727 | + this.unpublish(); | ||
| 728 | + break; | ||
| 729 | + case "STREAM_ALREADY_INITIALIZED": | ||
| 730 | + this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type: "error", msg: _msg}); | ||
| 731 | + this.curCameraId = ""; | ||
| 732 | + this.curMicrophoneId = ""; | ||
| 733 | + this.unpublish(); | ||
| 734 | + break; | ||
| 735 | + default: | ||
| 736 | + this._emit(MessageTypes.WEB_RTC_PUBLISH_FAILED, {type: "error", msg: _msg}); | ||
| 737 | + break | ||
| 738 | + } | ||
| 739 | + } | ||
| 740 | + | ||
| 718 | unpublish() { | 741 | unpublish() { |
| 719 | clearTimeout(this.rePublishDelay); | 742 | clearTimeout(this.rePublishDelay); |
| 720 | if (!this.client) { | 743 | if (!this.client) { |
| @@ -924,10 +947,10 @@ class WebRtcApe extends Emiter { | @@ -924,10 +947,10 @@ class WebRtcApe extends Emiter { | ||
| 924 | if (device) { | 947 | if (device) { |
| 925 | if (device.kind == 'audioinput') { | 948 | if (device.kind == 'audioinput') { |
| 926 | this.microphones.push(device); | 949 | this.microphones.push(device); |
| 927 | - GlobalConfig.microphones.push(device.label||"microphone"+i); | 950 | + GlobalConfig.microphones.push(device.label || "microphone" + i); |
| 928 | } else if (device.kind == 'videoinput') { | 951 | } else if (device.kind == 'videoinput') { |
| 929 | this.cameras.push(device); | 952 | this.cameras.push(device); |
| 930 | - GlobalConfig.cameras.push(device.label||"camera"+i); | 953 | + GlobalConfig.cameras.push(device.label || "camera" + i); |
| 931 | } else { | 954 | } else { |
| 932 | loger.warn('其他设备: ', device); | 955 | loger.warn('其他设备: ', device); |
| 933 | } | 956 | } |
| @@ -958,17 +981,17 @@ class WebRtcApe extends Emiter { | @@ -958,17 +981,17 @@ class WebRtcApe extends Emiter { | ||
| 958 | uid = parseInt(idArr[1]); | 981 | uid = parseInt(idArr[1]); |
| 959 | } | 982 | } |
| 960 | let user = GlobalConfig.getUserInfoFromeNodeId(parseInt(uid)); | 983 | let user = GlobalConfig.getUserInfoFromeNodeId(parseInt(uid)); |
| 961 | - let userName=""; | ||
| 962 | - let roleRole=""; | 984 | + let userName = ""; |
| 985 | + let roleRole = ""; | ||
| 963 | if (user) { | 986 | if (user) { |
| 964 | roleRole = GlobalConfig.getUserRoleToString(user.role); | 987 | roleRole = GlobalConfig.getUserRoleToString(user.role); |
| 965 | userName = user.name; | 988 | userName = user.name; |
| 966 | } | 989 | } |
| 967 | if (className.indexOf("cameraOn") > 0) { | 990 | if (className.indexOf("cameraOn") > 0) { |
| 968 | - loger.log("点击禁用视频按钮->用户:["+roleRole+"] " +userName+" uid:"+uid); | 991 | + loger.log("点击禁用视频按钮->用户:[" + roleRole + "] " + userName + " uid:" + uid); |
| 969 | this.sendChangeUserMediaEnabled({nodeId: uid, video: false, audio: true}); | 992 | this.sendChangeUserMediaEnabled({nodeId: uid, video: false, audio: true}); |
| 970 | } else { | 993 | } else { |
| 971 | - loger.log("点击解除视频禁用按钮->用户:["+roleRole+"] " +userName+" uid:"+uid); | 994 | + loger.log("点击解除视频禁用按钮->用户:[" + roleRole + "] " + userName + " uid:" + uid); |
| 972 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: true}); | 995 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: true}); |
| 973 | } | 996 | } |
| 974 | } | 997 | } |
| @@ -984,18 +1007,18 @@ class WebRtcApe extends Emiter { | @@ -984,18 +1007,18 @@ class WebRtcApe extends Emiter { | ||
| 984 | uid = parseInt(idArr[1]); | 1007 | uid = parseInt(idArr[1]); |
| 985 | } | 1008 | } |
| 986 | let user = GlobalConfig.getUserInfoFromeNodeId(parseInt(uid)); | 1009 | let user = GlobalConfig.getUserInfoFromeNodeId(parseInt(uid)); |
| 987 | - let userName=""; | ||
| 988 | - let roleRole=""; | 1010 | + let userName = ""; |
| 1011 | + let roleRole = ""; | ||
| 989 | if (user) { | 1012 | if (user) { |
| 990 | roleRole = GlobalConfig.getUserRoleToString(user.role); | 1013 | roleRole = GlobalConfig.getUserRoleToString(user.role); |
| 991 | userName = user.name; | 1014 | userName = user.name; |
| 992 | } | 1015 | } |
| 993 | 1016 | ||
| 994 | if (className.indexOf("microphoneOn") > 0) { | 1017 | if (className.indexOf("microphoneOn") > 0) { |
| 995 | - loger.log("点击禁音按钮->用户:["+roleRole+"] " +userName+" uid:"+uid); | 1018 | + loger.log("点击禁音按钮->用户:[" + roleRole + "] " + userName + " uid:" + uid); |
| 996 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: false}); | 1019 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: false}); |
| 997 | } else { | 1020 | } else { |
| 998 | - loger.log("点击解除禁音按钮->用户:["+roleRole+"] " +userName+" uid:"+uid); | 1021 | + loger.log("点击解除禁音按钮->用户:[" + roleRole + "] " + userName + " uid:" + uid); |
| 999 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: true}); | 1022 | this.sendChangeUserMediaEnabled({nodeId: uid, video: true, audio: true}); |
| 1000 | } | 1023 | } |
| 1001 | } | 1024 | } |
| @@ -1025,6 +1048,10 @@ class WebRtcApe extends Emiter { | @@ -1025,6 +1048,10 @@ class WebRtcApe extends Emiter { | ||
| 1025 | //控制自己的音频 | 1048 | //控制自己的音频 |
| 1026 | if (this.isEnableVideo == _data.video && this.isEnableAudio == _data.audio) { | 1049 | if (this.isEnableVideo == _data.video && this.isEnableAudio == _data.audio) { |
| 1027 | loger.log("收到控制音视频禁用消息->自己当前状态一不需要设置:", _data); | 1050 | loger.log("收到控制音视频禁用消息->自己当前状态一不需要设置:", _data); |
| 1051 | + //音频 | ||
| 1052 | + this.setUidAudioEnabledStatus(_data.nodeId, Boolean(_data.audio)); | ||
| 1053 | + //视频 | ||
| 1054 | + this.setUidVideoEnabledStatus(_data.nodeId, Boolean(_data.video)); | ||
| 1028 | return; | 1055 | return; |
| 1029 | } | 1056 | } |
| 1030 | //记录自己当前的音视频禁用状态 | 1057 | //记录自己当前的音视频禁用状态 |
| @@ -1130,7 +1157,7 @@ class WebRtcApe extends Emiter { | @@ -1130,7 +1157,7 @@ class WebRtcApe extends Emiter { | ||
| 1130 | * */ | 1157 | * */ |
| 1131 | setUidVideoEnabledStatus(uid, isEnable) { | 1158 | setUidVideoEnabledStatus(uid, isEnable) { |
| 1132 | let user = GlobalConfig.getUserInfoFromeNodeId(parseInt(uid)); | 1159 | let user = GlobalConfig.getUserInfoFromeNodeId(parseInt(uid)); |
| 1133 | - if(user&&user.cameras&&user.cameras.length<1){ | 1160 | + if (user && user.cameras && user.cameras.length < 1) { |
| 1134 | //用户没有摄像头 显示音频封面 | 1161 | //用户没有摄像头 显示音频封面 |
| 1135 | $("#audioPlayIcoBox" + uid).show(); | 1162 | $("#audioPlayIcoBox" + uid).show(); |
| 1136 | $("#" + this.videoMutedIdName + uid).hide(); | 1163 | $("#" + this.videoMutedIdName + uid).hide(); |
-
请 注册 或 登录 后发表评论