Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
李勇
/
McuClient
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
李勇
7 years ago
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ed3e98bfa9df3265837b1c12a40dfaa370bce8f6
ed3e98bf
1 parent
459cb79b
webRtc-dev
...
ly20171204-1w
ly20171208-1w
ly20171211-1w
ly20171211-2w
ly20171214-1w
v2.38.13.20171216
v2.38.11.20171214
v2.38.3.201712011
v2.38.1.201712011
v2.36.11.20171204
v2.36.8.20171206
v2.36.4.20171201
修改视频通话模块的状态显示问题
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
135 行增加
和
107 行删除
src/EngineEntrance.js
src/EverSocket.js
src/RecordPlayBackParse.js
src/apes/VideoApe.js
src/apes/WebRtcApe.js
src/assets/css/mcuStyle.css
src/EngineEntrance.js
查看文件 @
ed3e98b
...
...
@@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter {
super
();
this
.
lastClassActiveTime
=
0
;
//最后一次课堂激活的时间戳
//sdk 信息
GlobalConfig
.
sdkVersion
=
"v2.3
5.11.20171130
"
;
GlobalConfig
.
sdkVersion
=
"v2.3
6.4.20171201
"
;
loger
.
warn
(
"sdkVersion:"
+
GlobalConfig
.
sdkVersion
);
console
.
log
(
"sdkVersion:"
+
GlobalConfig
.
sdkVersion
);
//设置
...
...
@@ -2206,13 +2206,6 @@ export default class MessageEntrance extends Emiter {
//监听摄像头麦克风状态
userDeviecStatusChange
(
_data
)
{
/* nodeId:GlobalConfig.nodeId,
userRole:GlobalConfig.userRole,
userName:GlobalConfig.userName,
userId:GlobalConfig.userId,
openCamera:GlobalConfig.openCamera,
openMicrophones:GlobalConfig.openMicrophones*/
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
...
...
@@ -2234,11 +2227,19 @@ export default class MessageEntrance extends Emiter {
if
(
_data
.
status
==
WebRtcApe
.
RECORD_STATUS_1
)
{
let
publishData
=
this
.
_getVideoPublishPath
();
let
publishUrl
=
""
;
//判断是否可以推流
if
(
publishData
&&
publishData
.
code
==
0
)
{
_data
.
publishUrl
=
publishData
.
publishUrl
||
""
;
_video_ape
.
mediaPublishStatusChange
(
_data
);
}
else
{
loger
.
log
(
"webRtc推流状态发生改变->推流失败"
,
publishData
);
this
.
_unpublishMedia
();
}
}
else
{
//停止推流
_video_ape
.
mediaPublishStatusChange
(
_data
);
}
_video_ape
.
mediaPublishStatusChange
(
_data
);
}
}
...
...
src/EverSocket.js
查看文件 @
ed3e98b
...
...
@@ -97,11 +97,11 @@ class EverSocket extends Emiter {
* type 类型
* */
send2mcu
(
len
,
type
){
this
.
sendToMcuList
.
push
(
""
+
len
+
":"
+
type
);
/*
this.sendToMcuList.push(""+len+":"+type);
if(this.sendToMcuList.length>=200){
loger.log("发送到MCU数据统计->",this.sendToMcuList);
this.sendToMcuList=[];
}
}
*/
}
//统计收到MCU的数据
...
...
@@ -110,11 +110,11 @@ class EverSocket extends Emiter {
* type 类型
* */
mcu2client
(
len
,
type
){
this
.
receiveFromMcuList
.
push
(
""
+
len
+
":"
+
type
);
/*
this.receiveFromMcuList.push(""+len+":"+type);
if(this.receiveFromMcuList.length>200){
loger.log("收到MCU数据统计->",this.receiveFromMcuList);
this.receiveFromMcuList=[];
}
}
*/
}
_setConnected
(
isConn
=
true
)
{
...
...
src/RecordPlayBackParse.js
查看文件 @
ed3e98b
...
...
@@ -1218,7 +1218,7 @@ class RecordPlayBackParse extends Emiter {
if
(
sessionId
==
ApeConsts
.
VIDEO_SESSION_ID
)
{
try
{
let
videoChannelInfo
=
pdu
[
'RCVideoChannelInfoPdu'
].
decode
(
tableItem
.
itemData
);
//
loger.log('RCVideoChannelInfoPdu->timestamp',timestamp,videoChannelInfo);
loger
.
log
(
'RCVideoChannelInfoPdu->timestamp'
,
timestamp
,
videoChannelInfo
);
//储存音视频模块的数据
if
(
!
this
.
mediaChannleList
[
videoChannelInfo
.
channelId
])
{
this
.
mediaChannleList
[
videoChannelInfo
.
channelId
]
=
{};
...
...
@@ -1227,7 +1227,7 @@ class RecordPlayBackParse extends Emiter {
if
(
videoChannelInfo
&&
videoChannelInfo
.
status
==
1
)
{
statusStr
=
"开"
;
this
.
allStreams
[
videoChannelInfo
.
streamId
]
=
videoChannelInfo
;
console
.
log
(
"视频流"
+
videoChannelInfo
.
streamId
);
//
console.log("视频流" + videoChannelInfo.streamId);
if
(
videoChannelInfo
){
videoChannelInfo
.
channel
=
videoChannelInfo
.
siteId
+
"_"
+
videoChannelInfo
.
classId
;
videoChannelInfo
.
uid
=
videoChannelInfo
.
fromNodeId
;
...
...
src/apes/VideoApe.js
查看文件 @
ed3e98b
...
...
@@ -82,6 +82,7 @@ class VideoApe extends Ape {
openChannel
++
;
}
}
//如果已经开启的数量大于等于最大允许开启的数量,不允许再推流
if
(
openChannel
>=
GlobalConfig
.
maxMediaChannels
)
{
loger
.
warn
(
'不能再打开设备->当前开启的设备数量->'
,
openChannel
);
...
...
src/apes/WebRtcApe.js
查看文件 @
ed3e98b
...
...
@@ -48,6 +48,7 @@ class WebRtcApe extends Emiter {
this
.
curCameraId
=
""
;
this
.
curMicrophoneId
=
""
;
this
.
speakerList
=
[];
//记录讲话的记录
this
.
remoteVideoList
=
{};
//记录远程视频流
this
.
pWidth
=
SIZE_480
;
...
...
@@ -66,8 +67,8 @@ class WebRtcApe extends Emiter {
this
.
isPublish
=
false
;
//当前是否正在推流
this
.
videoScale
=
1
;
//视图的缩放比例,默认为1;
this
.
isEnableVideo
=
true
;
this
.
isEnableAudio
=
true
;
this
.
isEnableVideo
=
true
;
this
.
isEnableAudio
=
true
;
this
.
normalRemoteViewId
=
""
;
this
.
normalRemoteStyle
=
""
;
...
...
@@ -93,10 +94,10 @@ class WebRtcApe extends Emiter {
this
.
audioMutedIdName
=
"audioMutedIdName_"
;
this
.
videoMutedIdName
=
"videoMutedIdName_"
;
this
.
closeCameraTitle
=
"close Camera"
;
this
.
openCameraTitle
=
"open Camera"
;
this
.
closeMicrophoneTitle
=
"close Microphone"
;
this
.
openMicrophoneTitle
=
"open Microphone"
;
this
.
closeCameraTitle
=
"close Camera"
;
this
.
openCameraTitle
=
"open Camera"
;
this
.
closeMicrophoneTitle
=
"close Microphone"
;
this
.
openMicrophoneTitle
=
"open Microphone"
;
this
.
localWebRtcVideoClass
=
'localWebRtcVideoClass'
;
//本地视图统一的class名称
this
.
invisibleWebRtcVideoClass
=
'invisibleWebRtcVideoClass'
;
...
...
@@ -162,6 +163,10 @@ class WebRtcApe extends Emiter {
this
.
firstPublishSuccess
=
true
;
GlobalConfig
.
openCamera
=
EngineUtils
.
creatTimestamp
();
GlobalConfig
.
openMicrophones
=
GlobalConfig
.
openCamera
;
this
.
isEnableVideo
=
true
;
this
.
isEnableAudio
=
true
;
GlobalConfig
.
videoEnabled
=
true
;
GlobalConfig
.
audioEnabled
=
true
;
this
.
_emit
(
MessageTypes
.
USER_DEVICE_STATUS_CHAANGE
,
{
nodeId
:
GlobalConfig
.
nodeId
,
userRole
:
GlobalConfig
.
userRole
,
...
...
@@ -199,13 +204,18 @@ class WebRtcApe extends Emiter {
});
this
.
client
.
on
(
"active-speaker"
,
(
evt
)
=>
{
let
uid
=
evt
.
uid
;
let
user
=
GlobalConfig
.
getUserInfoFromeNodeId
(
parseInt
(
uid
));
let
user
=
GlobalConfig
.
getUserInfoFromeNodeId
(
parseInt
(
uid
));
//console.log("active-speaker",user);
if
(
user
){
let
roleRole
=
GlobalConfig
.
getUserRoleToString
(
user
.
role
);
loger
.
log
(
"当前正在讲话的 ["
+
roleRole
+
"] name:"
+
user
.
name
+
" uid:"
+
uid
);
}
else
{
loger
.
log
(
"当前正在讲话的uid:"
+
uid
);
if
(
user
)
{
let
roleRole
=
GlobalConfig
.
getUserRoleToString
(
user
.
role
);
this
.
speakerList
.
push
(
"当前正在讲话的 ["
+
roleRole
+
"] name:"
+
user
.
name
+
" uid:"
+
uid
);
}
else
{
this
.
speakerList
.
push
(
"当前正在讲话的uid:"
+
uid
);
}
//记录正在讲话的数据,大于50条上报一次
if
(
this
.
speakerList
.
length
>
20
){
loger
.
log
(
this
.
speakerList
);
this
.
speakerList
=
[];
}
});
...
...
@@ -221,49 +231,50 @@ class WebRtcApe extends Emiter {
userName
=
user
.
name
||
"unknow"
;
userRole
=
user
.
userRole
;
}
//添加之前先删除之前存在的重复视图
//添加之前先删除之前存在的重复视图 (查找子元素)
let
len
=
$
(
"#"
+
this
.
xdyRemote
+
uid
+
" #player_"
+
uid
).
length
;
if
(
len
<
1
)
{
loger
.
log
(
"添加之前先删除之前存在的重复视图"
,
uid
);
$
(
"#"
+
this
.
xdyRemote
+
uid
).
remove
();
}
}
let
audioMutedDiv
=
""
;
let
videoMutedDiv
=
""
;
let
videoAndAudioBox
=
""
let
videoMutedDiv
=
""
;
let
videoAndAudioBox
=
""
if
(
GlobalConfig
.
isTeachOrAssistant
||
GlobalConfig
.
isInvisible
)
{
if
(
user
&&
user
.
videoEnabled
==
true
)
{
if
(
user
&&
user
.
videoEnabled
==
true
)
{
videoMutedDiv
=
`
<
div
class
=
"audioAndVideMuted cameraOn"
id
=
$
{
this
.
videoMutedIdName
+
uid
}
title
=
"${this.closeCameraTitle}"
><
/div>
`
}
else
{
}
else
{
videoMutedDiv
=
`
<
div
class
=
"audioAndVideMuted cameraOff"
id
=
$
{
this
.
videoMutedIdName
+
uid
}
title
=
"${this.closeCameraTitle}"
><
/div>
`
}
if
(
user
&&
user
.
audioEnabled
==
true
)
{
if
(
user
&&
user
.
audioEnabled
==
true
)
{
audioMutedDiv
=
`
<
div
class
=
"audioAndVideMuted microphoneOn "
id
=
$
{
this
.
audioMutedIdName
+
uid
}
title
=
"${this.closeMicrophoneTitle}"
><
/div>`
;
}
else
{
}
else
{
audioMutedDiv
=
`
<
div
class
=
"audioAndVideMuted microphoneOff "
id
=
$
{
this
.
audioMutedIdName
+
uid
}
title
=
"${this.closeMicrophoneTitle}"
><
/div>`
;
}
videoAndAudioBox
=
`
<
div
class
=
"audioAndVideBox unOpenVideo"
>
$
{
videoMutedDiv
+
audioMutedDiv
}
<
/div>`
;
videoAndAudioBox
=
`
<
div
class
=
"audioAndVideBox unOpenVideo"
>
$
{
videoMutedDiv
+
audioMutedDiv
}
<
/div>`
;
}
if
(
userRole
==
ApeConsts
.
invisible
)
{
let
nameDiv
=
`
<
div
style
=
"${this.invisibleVideoWidth}px;height:22px; position: absolute;bottom: 2px; right:4px; z-index:
1
;overflow:hidden;font-size: 14px;text-align: right; vertical-align: middle;color: #e7e7e7display:${this.nameDisplay}"
>
$
{
userName
}
<
/div>`
;
let
nameDiv
=
`
<
div
style
=
"${this.invisibleVideoWidth}px;height:22px; position: absolute;bottom: 2px; right:4px; z-index:
2
;overflow:hidden;font-size: 14px;text-align: right; vertical-align: middle;color: #e7e7e7display:${this.nameDisplay}"
>
$
{
userName
}
<
/div>`
;
//把远程视频添加到监课列表
loger
.
log
(
"获取远程视频流成功->监课:"
+
userName
+
"->"
+
uid
,
new
Date
().
getTime
());
let
viewDiv
=
`
<
div
id
=
"${this.xdyRemote + uid}"
class
=
"${this.invisibleWebRtcVideoClass}"
style
=
"width:${this.invisibleVideoWidth * this.videoScale}px;height:${this.invisibleVideoHeight * this.videoScale}px;float: left;margin-right: 1px;"
>
$
{
nameDiv
+
videoAndAudioBox
}
<
/div>`
;
$
(
this
.
invisibleViewId
).
append
(
viewDiv
);
}
else
if
(
userRole
==
ApeConsts
.
host
||
userRole
==
ApeConsts
.
assistant
||
userRole
==
ApeConsts
.
presenter
)
{
let
nameDiv
=
`
<
div
style
=
"width:${this.hostRemoteVideoWidth}px;height:22px; position: absolute;bottom: 2px;right:4px; z-index:
1
;overflow:hidden;font-size: 14px;text-align: right;vertical-align: middle;color: #e7e7e7;display:${this.nameDisplay}"
>
$
{
userName
}
<
/div>`
;
let
nameDiv
=
`
<
div
style
=
"width:${this.hostRemoteVideoWidth}px;height:22px; position: absolute;bottom: 2px;right:4px; z-index:
2
;overflow:hidden;font-size: 14px;text-align: right;vertical-align: middle;color: #e7e7e7;display:${this.nameDisplay}"
>
$
{
userName
}
<
/div>`
;
//把远程视图添加到老师列表
loger
.
log
(
"获取远程视频流成功->userRole:"
+
userRole
+
":"
+
userName
+
"->"
+
uid
,
new
Date
().
getTime
());
let
viewDiv
=
`
<
div
id
=
"${this.xdyRemote + uid}"
class
=
"${this.hostWebRtcVideoClass}"
style
=
"width:${this.hostRemoteVideoWidth * this.videoScale}px;height:${this.hostRemoteVideoHeight * this.videoScale}px;float: left;margin-right: 1px;"
>
$
{
nameDiv
+
videoAndAudioBox
}
<
/div>`
;
$
(
this
.
hostRemoteViewId
).
prepend
(
viewDiv
);
}
else
{
let
nameDiv
=
`
<
div
style
=
"width:${this.normalRemoteVideoWidth}px;height:22px; position: absolute;bottom: 2px;right:4px; z-index:
1
;overflow:hidden;font-size: 14px;text-align: right;vertical-align: middle;color: #e7e7e7;display:${this.nameDisplay}"
>
$
{
userName
}
<
/div>`
;
let
nameDiv
=
`
<
div
style
=
"width:${this.normalRemoteVideoWidth}px;height:22px; position: absolute;bottom: 2px;right:4px; z-index:
2
;overflow:hidden;font-size: 14px;text-align: right;vertical-align: middle;color: #e7e7e7;display:${this.nameDisplay}"
>
$
{
userName
}
<
/div>`
;
//把视图添加到学生列表
loger
.
log
(
"获取远程视频流成功->学生:"
+
userName
+
"->"
+
uid
,
new
Date
().
getTime
());
let
viewDiv
=
`
<
div
id
=
"${this.xdyRemote + uid}"
class
=
"${this.normalWebRtcVideoClass}"
style
=
"width:${this.normalRemoteVideoWidth * this.videoScale}px;height:${this.normalRemoteVideoHeight * this.videoScale}px;float: left;margin-right: 1px;"
>
$
{
nameDiv
+
videoAndAudioBox
}
<
/div>`
;
$
(
this
.
normalRemoteViewId
).
append
(
viewDiv
);
}
let
audioPlayIcoBox
=
`
<
div
class
=
"audioPlayIcoBox "
id
=
$
{
"audioPlayIcoBox"
+
uid
}
><
/div>`
;
let
audioPlayIcoBox
=
`
<
div
class
=
"audioPlayIcoBox "
id
=
$
{
"audioPlayIcoBox"
+
uid
}
><
/div>`
;
$
(
"#"
+
this
.
xdyRemote
+
uid
).
append
(
audioPlayIcoBox
);
$
(
"#"
+
this
.
videoMutedIdName
+
uid
).
off
(
"click"
,
this
.
_clickVideoMuted
.
bind
(
this
));
...
...
@@ -284,7 +295,12 @@ class WebRtcApe extends Emiter {
$
(
"#"
+
this
.
xdyRemote
+
uid
).
remove
();
}
}
$
(
"#player_"
+
uid
).
css
(
"pointer-events"
,
"none"
);
//设置视图画面不可点
$
(
"#player_"
+
uid
).
css
(
"pointer-events"
,
"none"
);
//更新音视频禁用状态显示
if
(
uid
!=
GlobalConfig
.
nodeId
)
{
this
.
receiveWebRtcMeiaEnabledChange
({
nodeId
:
uid
,
video
:
Boolean
(
user
.
videoEnabled
),
audio
:
Boolean
(
user
.
audioEnabled
)});
}
if
(
user
&&
(
user
.
deviceType
==
GlobalConfig
.
deviceIOS
||
user
.
deviceType
==
GlobalConfig
.
deviceAndroid
))
{
this
.
remoteVideoList
[
user
.
nodeId
]
=
stream
;
}
...
...
@@ -401,10 +417,10 @@ class WebRtcApe extends Emiter {
//一般只有在刷新重进频道的时候会用到
this
.
immediatePublish
=
_params
.
immediatePublish
||
false
;
this
.
isEnableVideo
=
true
;
this
.
isEnableAudio
=
true
;
GlobalConfig
.
videoEnabled
=
true
;
GlobalConfig
.
audioEnabled
=
true
;
this
.
isEnableVideo
=
true
;
this
.
isEnableAudio
=
true
;
GlobalConfig
.
videoEnabled
=
true
;
GlobalConfig
.
audioEnabled
=
true
;
//根据不同身份设置不同的分辨率
if
(
GlobalConfig
.
isTeachOrAssistant
)
{
if
(
GlobalConfig
.
maxMediaChannels
==
1
)
{
...
...
@@ -478,10 +494,10 @@ class WebRtcApe extends Emiter {
});
if
(
this
.
isOpenVideo
)
{
loger
.
log
(
"摄像头已经获取->设置本地视频分辨率:"
+
this
.
videoResolution
);
loger
.
log
(
"摄像头已经获取->设置本地视频分辨率:"
+
this
.
videoResolution
);
//设置视频分辨率
this
.
localStream
.
setVideoProfile
(
this
.
videoResolution
);
}
else
{
}
else
{
//没有视频,设置为最低
loger
.
log
(
"摄像头没有获取到->设置本地流分辨率:120P"
);
this
.
localStream
.
setVideoProfile
(
"120P"
);
...
...
@@ -586,7 +602,7 @@ class WebRtcApe extends Emiter {
//自己的视图往前添加
$
(
this
.
localViewId
).
prepend
(
videoBox
);
$
(
"#"
+
viewName
).
css
(
"transform"
,
'rotateY(180deg)'
);
let
audioPlayIcoBox
=
`
<
div
class
=
"audioPlayIcoBox "
id
=
$
{
"audioPlayIcoBox"
+
this
.
uid
}
><
/div>`
;
let
audioPlayIcoBox
=
`
<
div
class
=
"audioPlayIcoBox "
id
=
$
{
"audioPlayIcoBox"
+
this
.
uid
}
><
/div>`
;
$
(
"#"
+
viewName
).
append
(
audioPlayIcoBox
);
//显示自己的名字
...
...
@@ -595,21 +611,16 @@ class WebRtcApe extends Emiter {
if
(
user
)
{
userName
=
user
.
name
||
""
;
}
/* let audioMutedDiv = "";
if (GlobalConfig.isTeachOrAssistant) {
audioMutedDiv = `<div class="audioAndVideMuted microphoneOn openVideo" id=${this.audioMutedIdName + this.uid}></div>`;
}
*/
let
audioMutedDiv
=
""
;
let
videoMutedDiv
=
""
;
let
videoAndAudioBox
=
""
let
videoMutedDiv
=
""
;
let
videoAndAudioBox
=
""
if
(
GlobalConfig
.
isTeachOrAssistant
)
{
videoMutedDiv
=
`
<
div
class
=
"audioAndVideMuted cameraOn "
id
=
$
{
this
.
videoMutedIdName
+
this
.
uid
}
title
=
"${this.closeCameraTitle}"
><
/div>`
;
audioMutedDiv
=
`
<
div
class
=
"audioAndVideMuted microphoneOn "
id
=
$
{
this
.
audioMutedIdName
+
this
.
uid
}
title
=
"${this.closeMicrophoneTitle}"
><
/div>`
;
videoAndAudioBox
=
`
<
div
class
=
"audioAndVideBox openVideo"
>
$
{
videoMutedDiv
+
audioMutedDiv
}
<
/div>`
;
videoMutedDiv
=
`
<
div
class
=
"audioAndVideMuted cameraOn "
id
=
$
{
this
.
videoMutedIdName
+
this
.
uid
}
title
=
"${this.closeCameraTitle}"
><
/div>`
;
audioMutedDiv
=
`
<
div
class
=
"audioAndVideMuted microphoneOn "
id
=
$
{
this
.
audioMutedIdName
+
this
.
uid
}
title
=
"${this.closeMicrophoneTitle}"
><
/div>`
;
videoAndAudioBox
=
`
<
div
class
=
"audioAndVideBox openVideo"
>
$
{
videoMutedDiv
+
audioMutedDiv
}
<
/div>`
;
}
let
nameDiv
=
`
<
div
id
=
"${"
videoOwnerName_
" + this.uid}"
class
=
"localVideoOwnerName"
style
=
"width:${this.localVideoWidth}px;height:26px; position: absolute;bottom: 2px; z-index: 1;overflow:hidden;font-size: 14px;text-align: right; vertical-align:bottom;color: #e7e7e7;display:${this.nameDisplay}"
>
$
{
userName
+
videoAndAudioBox
}
<
/div>`
;
let
nameDiv
=
`
<
div
id
=
"${"
videoOwnerName_
" + this.uid}"
class
=
"localVideoOwnerName"
style
=
"width:${this.localVideoWidth}px;height:26px; position: absolute;bottom: 2px; z-index: 1;overflow:hidden;font-size: 14px;text-align: right; vertical-align:bottom;color: #e7e7e7;display:${this.nameDisplay}"
>
$
{
userName
+
videoAndAudioBox
}
<
/div>`
;
$
(
this
.
localViewId
).
prepend
(
nameDiv
);
$
(
"#"
+
this
.
videoMutedIdName
+
this
.
uid
).
off
(
"click"
,
this
.
_clickVideoMuted
.
bind
(
this
));
...
...
@@ -622,8 +633,6 @@ class WebRtcApe extends Emiter {
this
.
localStream
.
play
(
viewName
);
this
.
client
.
publish
(
this
.
localStream
,
(
err
)
=>
{
loger
.
log
(
"webRtc->推流失败: "
+
err
);
GlobalConfig
.
openCamera
=
0
;
GlobalConfig
.
openMicrophones
=
0
;
this
.
isPublish
=
false
;
this
.
unpublish
();
});
...
...
@@ -678,6 +687,10 @@ class WebRtcApe extends Emiter {
this
.
localStream
.
close
();
this
.
clearLocalView
();
this
.
isPublish
=
false
;
this
.
isEnableVideo
=
true
;
this
.
isEnableAudio
=
true
;
GlobalConfig
.
videoEnabled
=
true
;
GlobalConfig
.
audioEnabled
=
true
;
GlobalConfig
.
openCamera
=
0
;
GlobalConfig
.
openMicrophones
=
0
;
this
.
_emit
(
MessageTypes
.
USER_DEVICE_STATUS_CHAANGE
,
{
...
...
@@ -858,19 +871,19 @@ class WebRtcApe extends Emiter {
if
(
device
)
{
if
(
device
.
kind
==
'audioinput'
)
{
this
.
microphones
.
push
(
device
);
GlobalConfig
.
microphones
.
push
(
device
.
label
);
GlobalConfig
.
microphones
.
push
(
device
.
label
||
"microphone"
+
i
);
}
else
if
(
device
.
kind
==
'videoinput'
)
{
this
.
cameras
.
push
(
device
);
GlobalConfig
.
cameras
.
push
(
device
.
label
);
GlobalConfig
.
cameras
.
push
(
device
.
label
||
"camera"
+
i
);
}
else
{
loger
.
warn
(
'其他设备: '
,
device
);
}
}
}
if
(
GlobalConfig
.
cameras
&&
GlobalConfig
.
cameras
.
length
<
1
){
this
.
isOpenVideo
=
false
;
}
else
{
this
.
isOpenVideo
=
true
;
if
(
GlobalConfig
.
cameras
&&
GlobalConfig
.
cameras
.
length
<
1
)
{
this
.
isOpenVideo
=
false
;
}
else
{
this
.
isOpenVideo
=
true
;
}
let
_deviceData
=
{
cameras
:
GlobalConfig
.
cameras
,
microphones
:
GlobalConfig
.
microphones
};
if
(
_callback
)
{
...
...
@@ -879,10 +892,11 @@ class WebRtcApe extends Emiter {
this
.
_emit
(
MessageTypes
.
GET_DEVICES_SUCCESS
,
_deviceData
);
});
}
/*
*
* 点击禁用和开启视频
* */
*
* 点击禁用和开启视频
* */
_clickVideoMuted
(
evt
)
{
let
className
=
evt
.
currentTarget
.
className
;
let
idArr
=
(
evt
.
currentTarget
.
id
).
split
(
"_"
);
...
...
@@ -894,13 +908,14 @@ class WebRtcApe extends Emiter {
loger
.
log
(
"点击禁用视频->"
+
uid
);
this
.
sendChangeUserMediaEnabled
({
nodeId
:
uid
,
video
:
false
,
audio
:
true
});
}
else
{
loger
.
log
(
"点击解除视频禁用->"
+
uid
);
loger
.
log
(
"点击解除视频禁用->"
+
uid
);
this
.
sendChangeUserMediaEnabled
({
nodeId
:
uid
,
video
:
true
,
audio
:
true
});
}
}
/*
* 点击禁音和开启按钮切换
* */
* 点击禁音和开启按钮切换
* */
_clickAudioMuted
(
evt
)
{
let
className
=
evt
.
currentTarget
.
className
;
let
idArr
=
(
evt
.
currentTarget
.
id
).
split
(
"_"
);
...
...
@@ -925,11 +940,10 @@ class WebRtcApe extends Emiter {
}
/*
* 收到控制音视频禁用消息
* 收到控制音视频禁用消息
{nodeId: uid, video: true, audio: false}
* */
receiveWebRtcMeiaEnabledChange
(
_data
)
{
loger
.
log
(
"收到控制音视频禁用消息"
,
_data
);
// {nodeId: uid, video: true, audio: false}
loger
.
log
(
"收到控制音视频禁用消息"
,
_data
,
"myNodeId:"
+
GlobalConfig
.
nodeId
+
" isEnableVideo:"
+
this
.
isEnableVideo
+
" isEnableAudio:"
+
this
.
isEnableAudio
);
if
(
!
_data
)
{
return
;
}
...
...
@@ -937,17 +951,18 @@ class WebRtcApe extends Emiter {
if
(
_data
.
nodeId
!=
GlobalConfig
.
nodeId
)
{
//不是自己的只设置状态显示即可
//音频
this
.
setUidAudioEnabledStatus
(
_data
.
nodeId
,
Boolean
(
_data
.
audio
));
this
.
setUidAudioEnabledStatus
(
_data
.
nodeId
,
Boolean
(
_data
.
audio
));
//视频
this
.
setUidVideoEnabledStatus
(
_data
.
nodeId
,
Boolean
(
_data
.
video
));
this
.
setUidVideoEnabledStatus
(
_data
.
nodeId
,
Boolean
(
_data
.
video
));
}
else
{
//控制自己的音频
if
(
this
.
isEnableVideo
==
_data
.
video
&&
this
.
isEnableAudio
==
_data
.
audio
){
if
(
this
.
isEnableVideo
==
_data
.
video
&&
this
.
isEnableAudio
==
_data
.
audio
)
{
loger
.
log
(
"收到控制音视频禁用消息->自己当前状态一直不需要设置:"
,
_data
);
return
;
}
//记录自己当前的音视频禁用状态
this
.
isEnableVideo
=
_data
.
video
;
this
.
isEnableAudio
=
_data
.
audio
;
this
.
isEnableVideo
=
_data
.
video
;
this
.
isEnableAudio
=
_data
.
audio
;
if
(
_data
.
audio
==
false
)
{
this
.
disableAudio
(
_data
.
nodeId
);
...
...
@@ -961,10 +976,10 @@ class WebRtcApe extends Emiter {
this
.
enableVideo
(
_data
.
nodeId
);
}
//更新同步用户的媒体禁用状态
loger
.
log
(
"更新同步用户的媒体禁用状态"
,
_data
);
if
(
_data
){
this
.
_emit
(
WebRtcApe
.
UPDATE_USER_MEDIA_MUTED_STATUS
,
_data
);
}
loger
.
log
(
"更新同步用户的媒体禁用状态"
,
_data
);
if
(
_data
)
{
this
.
_emit
(
WebRtcApe
.
UPDATE_USER_MEDIA_MUTED_STATUS
,
_data
);
}
}
}
...
...
@@ -975,7 +990,7 @@ class WebRtcApe extends Emiter {
if
(
parseInt
(
uid
)
==
GlobalConfig
.
nodeId
)
{
loger
.
log
(
"开启禁音:"
+
uid
);
if
(
this
.
localStream
)
{
this
.
setUidAudioEnabledStatus
(
uid
,
false
);
this
.
setUidAudioEnabledStatus
(
uid
,
false
);
this
.
localStream
.
disableAudio
();
}
}
...
...
@@ -989,7 +1004,7 @@ class WebRtcApe extends Emiter {
loger
.
log
(
"开启音频:"
+
uid
);
if
(
this
.
localStream
)
{
this
.
localStream
.
enableAudio
();
this
.
setUidAudioEnabledStatus
(
uid
,
true
);
this
.
setUidAudioEnabledStatus
(
uid
,
true
);
}
}
}
...
...
@@ -1000,16 +1015,16 @@ class WebRtcApe extends Emiter {
* isEnable true开启 false 禁用
*
* */
setUidAudioEnabledStatus
(
uid
,
isEnable
){
loger
.
log
(
"设置音频禁用按钮的状态"
,
uid
,
isEnable
);
if
(
isEnable
==
true
){
setUidAudioEnabledStatus
(
uid
,
isEnable
)
{
loger
.
log
(
"设置音频禁用按钮的状态"
,
uid
,
isEnable
);
if
(
isEnable
==
true
)
{
$
(
"#"
+
this
.
audioMutedIdName
+
uid
).
removeClass
(
"microphoneOff"
);
$
(
"#"
+
this
.
audioMutedIdName
+
uid
).
addClass
(
"audioAndVideMuted microphoneOn"
);
$
(
"#"
+
this
.
audioMutedIdName
+
uid
).
attr
(
"title"
,
this
.
closeMicrophoneTitle
);
}
else
{
$
(
"#"
+
this
.
audioMutedIdName
+
uid
).
attr
(
"title"
,
this
.
closeMicrophoneTitle
);
}
else
{
$
(
"#"
+
this
.
audioMutedIdName
+
uid
).
removeClass
(
"microphoneOn"
);
$
(
"#"
+
this
.
audioMutedIdName
+
uid
).
addClass
(
"audioAndVideMuted microphoneOff"
);
$
(
"#"
+
this
.
audioMutedIdName
+
uid
).
attr
(
"title"
,
this
.
openMicrophoneTitle
);
$
(
"#"
+
this
.
audioMutedIdName
+
uid
).
attr
(
"title"
,
this
.
openMicrophoneTitle
);
}
}
...
...
@@ -1020,7 +1035,7 @@ class WebRtcApe extends Emiter {
if
(
parseInt
(
uid
)
==
GlobalConfig
.
nodeId
)
{
loger
.
log
(
"禁用摄像头:"
+
uid
);
if
(
this
.
localStream
)
{
this
.
setUidVideoEnabledStatus
(
uid
,
false
);
this
.
setUidVideoEnabledStatus
(
uid
,
false
);
this
.
localStream
.
disableVideo
();
}
}
...
...
@@ -1034,30 +1049,40 @@ class WebRtcApe extends Emiter {
if
(
this
.
localStream
)
{
loger
.
log
(
"开启摄像头:"
+
uid
);
this
.
localStream
.
enableVideo
();
this
.
setUidVideoEnabledStatus
(
uid
,
true
);
this
.
setUidVideoEnabledStatus
(
uid
,
true
);
}
}
}
/*
* 设置视频禁用按钮的状态
* 设置视频禁用按钮的状态
* uid nodeId
* isEnable true开启 false 禁用
*
* */
setUidVideoEnabledStatus
(
uid
,
isEnable
){
loger
.
log
(
"设置视频禁用按钮的状态"
,
uid
,
isEnable
);
if
(
isEnable
==
true
){
* */
setUidVideoEnabledStatus
(
uid
,
isEnable
)
{
loger
.
log
(
"设置视频禁用按钮的状态"
,
uid
,
isEnable
);
let
user
=
GlobalConfig
.
getUserInfoFromeNodeId
(
parseInt
(
uid
));
if
(
user
&&
user
.
cameras
&&
user
.
cameras
.
length
<
1
){
//用户没有摄像头 显示音频封面
$
(
"#audioPlayIcoBox"
+
uid
).
show
();
$
(
"#"
+
this
.
videoMutedIdName
+
uid
).
hide
();
return
;
}
if
(
isEnable
==
true
)
{
//开启
$
(
"#audioPlayIcoBox"
+
uid
).
hide
();
$
(
"#"
+
this
.
videoMutedIdName
+
uid
).
removeClass
(
"cameraOff"
);
$
(
"#"
+
this
.
videoMutedIdName
+
uid
).
addClass
(
"audioAndVideMuted cameraOn"
);
$
(
"#"
+
this
.
videoMutedIdName
+
uid
).
attr
(
"title"
,
this
.
closeCameraTitle
);
$
(
"#audioPlayIcoBox"
+
uid
).
hide
();
}
else
{
$
(
"#"
+
this
.
videoMutedIdName
+
uid
).
attr
(
"title"
,
this
.
closeCameraTitle
);
}
else
{
//禁用
$
(
"#audioPlayIcoBox"
+
uid
).
show
();
$
(
"#"
+
this
.
videoMutedIdName
+
uid
).
removeClass
(
"cameraOn"
);
$
(
"#"
+
this
.
videoMutedIdName
+
uid
).
addClass
(
"audioAndVideMuted cameraOff"
);
$
(
"#"
+
this
.
videoMutedIdName
+
uid
).
attr
(
"title"
,
this
.
openCameraTitle
);
$
(
"#audioPlayIcoBox"
+
uid
).
show
();
$
(
"#"
+
this
.
videoMutedIdName
+
uid
).
attr
(
"title"
,
this
.
openCameraTitle
);
}
}
...
...
src/assets/css/mcuStyle.css
查看文件 @
ed3e98b
...
...
@@ -55,5 +55,6 @@
z-index
:
1
;
/*background-size: 100%;*/
background-repeat
:
no-repeat
;
background-image
:
url(../../assets/img/audioPlayIco.png)
;
background-color
:
#232323
;
background-image
:
url(../../assets/img/audioPlayIco.gif)
;
}
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论