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
3b91c746f2cc5157e0cbb2d631eea441aa77e5e0
3b91c746
1 parent
7ede4042
MCU返回的消息中增加了当前人员数量的统计
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
44 行增加
和
33 行删除
src/EngineEntrance.js
src/GlobalConfig.js
src/apes/Ape.js
src/apes/ConferApe.js
src/apes/DocApe.js
src/pdus/pro.js
src/EngineEntrance.js
查看文件 @
3b91c74
...
...
@@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter {
super
();
this
.
lastClassActiveTime
=
0
;
//最后一次课堂激活的时间戳
//sdk 信息
GlobalConfig
.
sdkVersion
=
"v2.3
1.12.20171122
"
;
GlobalConfig
.
sdkVersion
=
"v2.3
2.1.20171123
"
;
loger
.
warn
(
"sdkVersion:"
+
GlobalConfig
.
sdkVersion
);
console
.
log
(
"sdkVersion:"
+
GlobalConfig
.
sdkVersion
);
//设置
...
...
@@ -1177,7 +1177,7 @@ export default class MessageEntrance extends Emiter {
_mcuJoinMCUClassSuccessHandler
(
_data
)
{
//loger.log('MCU 课堂成功.');
loger
.
warn
(
'=====================STEP9======================='
);
//console.log("当前课堂人员列表",GlobalConfig.rosterNum
ber
,GlobalConfig.rosters)
//console.log("当前课堂人员列表",GlobalConfig.rosterNum,GlobalConfig.rosters)
GlobalConfig
.
setCurrentStatus
(
GlobalConfig
.
statusCode_2
);
GlobalConfig
.
classJoinSuccess
=
true
;
...
...
@@ -2742,11 +2742,11 @@ export default class MessageEntrance extends Emiter {
let
interval
=
new
Date
().
getTime
()
-
parseInt
(
this
.
lastClassActiveTime
);
interval
=
interval
/
1000
;
//loger.log("最后一次记录的时间->"+this.lastClassActiveTime,"当前时间:"+new Date().getTime(),"间隔:"+interval+"秒");
loger
.
log
(
"文档加入频道成功->isHost="
,
GlobalConfig
.
isHost
,
"当前总人数:"
,
GlobalConfig
.
rosterNum
ber
,
"sassDoclength="
,
GlobalConfig
.
docListPrepare
.
length
);
loger
.
log
(
"文档加入频道成功->isHost="
,
GlobalConfig
.
isHost
,
"当前总人数:"
,
GlobalConfig
.
rosterNum
,
"sassDoclength="
,
GlobalConfig
.
docListPrepare
.
length
);
//如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
if
(
GlobalConfig
.
docListPrepare
&&
GlobalConfig
.
docListPrepare
.
length
>
0
)
{
//如果当前身份是老师或者当前课堂内只有一个人并且不是H5,有权限同步文档到MCU
if
(
GlobalConfig
.
isHost
||
(
GlobalConfig
.
rosterNum
ber
<=
1
&&
GlobalConfig
.
deviceType
!=
GlobalConfig
.
deviceH5
))
{
if
(
GlobalConfig
.
isHost
||
(
GlobalConfig
.
rosterNum
<=
1
&&
GlobalConfig
.
deviceType
!=
GlobalConfig
.
deviceH5
))
{
for
(
let
i
=
0
;
i
<
GlobalConfig
.
docListPrepare
.
length
;
i
++
)
{
let
value
=
GlobalConfig
.
docListPrepare
[
i
];
if
(
value
)
{
...
...
@@ -2774,7 +2774,7 @@ export default class MessageEntrance extends Emiter {
musicShareApeJoinChannelSuccess
()
{
//如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
if
(
GlobalConfig
.
musicListPrepare
&&
GlobalConfig
.
musicListPrepare
.
length
>
0
)
{
if
(
GlobalConfig
.
isHost
||
(
GlobalConfig
.
rosterNum
ber
<=
1
&&
GlobalConfig
.
deviceType
!=
GlobalConfig
.
deviceH5
))
{
if
(
GlobalConfig
.
isHost
||
(
GlobalConfig
.
rosterNum
<=
1
&&
GlobalConfig
.
deviceType
!=
GlobalConfig
.
deviceH5
))
{
for
(
let
i
=
0
;
i
<
GlobalConfig
.
musicListPrepare
.
length
;
i
++
)
{
let
value
=
GlobalConfig
.
musicListPrepare
[
i
];
if
(
value
)
{
...
...
@@ -2805,7 +2805,7 @@ export default class MessageEntrance extends Emiter {
mediaShareApeJoinChannelSuccess
()
{
//如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
if
(
GlobalConfig
.
sharedMediaList
&&
GlobalConfig
.
sharedMediaList
.
length
>
0
)
{
if
(
GlobalConfig
.
isHost
||
(
GlobalConfig
.
rosterNum
ber
<=
1
&&
GlobalConfig
.
deviceType
!=
GlobalConfig
.
deviceH5
))
{
if
(
GlobalConfig
.
isHost
||
(
GlobalConfig
.
rosterNum
<=
1
&&
GlobalConfig
.
deviceType
!=
GlobalConfig
.
deviceH5
))
{
for
(
let
i
=
0
;
i
<
GlobalConfig
.
sharedMediaList
.
length
;
i
++
)
{
let
value
=
GlobalConfig
.
sharedMediaList
[
i
];
if
(
value
)
{
...
...
src/GlobalConfig.js
查看文件 @
3b91c74
...
...
@@ -641,7 +641,7 @@ GlobalConfig.serverTime = 0; //服务器当前时间戳
GlobalConfig
.
serverAndLoacTimeDistanc
=
0
;
//本地时间和服务器时间错的差值;
GlobalConfig
.
logUrl
=
""
;
//日志上报地址;
GlobalConfig
.
rosterNum
ber
=
0
;
//当前总人数
GlobalConfig
.
rosterNum
=
0
;
//当前总人数
GlobalConfig
.
rosters
=
{};
//当前课堂内的人员数据
GlobalConfig
.
isMobile
=
false
;
//是否是移动端
...
...
src/apes/Ape.js
查看文件 @
3b91c74
...
...
@@ -81,6 +81,17 @@ export default class Ape extends Emiter {
// 数据同步处理
_pduRegAdapterHandler
(
regBuffer
,
seekTime
)
{
let
regPdu
=
pdu
[
'RCAdapterPdu'
].
decode
(
regBuffer
);
if
(
!
regPdu
){
console
.
warn
(
"regPdu 无效"
);
return
;
}
//console.log("regPdu",regPdu);
let
newUserNum
=
regPdu
.
userNum
||
0
;
if
(
newUserNum
!=
GlobalConfig
.
rosterNum
){
GlobalConfig
.
rosterNum
=
newUserNum
;
this
.
_emit
(
MessageTypes
.
CLASS_UPDATE_ROSTER_NUM
,{
rosterLen
:
GlobalConfig
.
rosterNum
});
}
let
regItems
=
regPdu
.
item
;
let
regItemSize
=
regItems
.
length
;
//console.log("RCAdapterPdu数据同步处理",regPdu);
...
...
src/apes/ConferApe.js
查看文件 @
3b91c74
...
...
@@ -26,7 +26,6 @@ class ConferApe extends Ape {
this
.
isSendInsterRoster
=
false
;
//这个很重要,每次MCU连接成功之后只发一次
this
.
isLeave
=
false
;
//记录自己是否已经离开
this
.
rosters
=
{};
//用户列表
this
.
rosterLen
=
0
;
//当前课堂人数
this
.
timerCounter
=
new
TimerCounter
();
//计时器
this
.
startRecordTimer
;
//开始录制的计时器
this
.
recordStatus
=
false
;
//记录录制状态
...
...
@@ -290,13 +289,13 @@ class ConferApe extends Ape {
return
;
}
//如果已经开始录制就不再开启
if
(
GlobalConfig
.
recordStatus
&&
this
.
rosterLen
>
1
)
{
loger
.
warn
(
'目前已经是录制状态->当前课堂人数:'
+
this
.
rosterLen
);
if
(
GlobalConfig
.
recordStatus
&&
GlobalConfig
.
rosterNum
>
1
)
{
loger
.
warn
(
'目前已经是录制状态->当前课堂人数:'
+
GlobalConfig
.
rosterNum
);
return
false
;
}
//如果是host或者当前课堂只有1个人,并且不是H5
if
(
this
.
checkHasRecordControl
())
{
loger
.
warn
(
'开启录制'
,
"isHost"
,
GlobalConfig
.
isHost
,
"recordStatus"
,
GlobalConfig
.
recordStatus
,
"当前人数:"
+
this
.
rosterLen
);
loger
.
warn
(
'开启录制'
,
"isHost"
,
GlobalConfig
.
isHost
,
"recordStatus"
,
GlobalConfig
.
recordStatus
,
"当前人数:"
+
GlobalConfig
.
rosterNum
);
//如果录制的文件名不存在,需要创建一个名字
let
timestampYMD
=
EngineUtils
.
creatTimestampYMD
();
if
(
!
GlobalConfig
.
recordFileName
)
{
...
...
@@ -313,7 +312,7 @@ class ConferApe extends Ape {
checkHasRecordControl
()
{
//loger.warn('检测是否有控制录制操作的权限', "isHost", GlobalConfig.isHost, "recordStatus", GlobalConfig.recordStatus,"当前人数:"+this.rosterLen);
//1.如果自己是老师或者当前课堂只有一个人
if
(
GlobalConfig
.
isHost
||
(
this
.
rosterLen
<=
1
&&
GlobalConfig
.
deviceType
!=
GlobalConfig
.
deviceH5
))
{
if
(
GlobalConfig
.
isHost
||
(
GlobalConfig
.
rosterNum
<=
1
&&
GlobalConfig
.
deviceType
!=
GlobalConfig
.
deviceH5
))
{
return
true
;
}
//2.如果自己不是老师,需要判断当前课堂内是否有老师,如果有老师就不做操作
...
...
@@ -973,8 +972,8 @@ class ConferApe extends Ape {
//loger.log("自己加入课堂的消息->",nodeId,"role-->", nodeData.role, ApeConsts.userTypes[nodeData.role]);
//自己加入的时候,需要做一下判断操作,如果满足以下3个条件就要暂停课堂:
// 1.当前课堂只有自己;2.自己的身份不是host;3当前的课堂状态为(CLASS_STATUS_STARTED= 1;//直播中)
this
.
rosterLen
=
Object
.
keys
(
this
.
rosters
).
length
;
GlobalConfig
.
rosterNumber
=
this
.
rosterLen
;
//记录当前的总人数
//this.rosterLen = Object.keys(this.rosters).length;
//GlobalConfig.rosterNum = this.rosterLen;//记录当前的总人数
/* if (this.rosterLen <=1 && !GlobalConfig.isHost && GlobalConfig.classStatus == ApeConsts.CLASS_STATUS_STARTED) {
loger.warn("当前课堂没有老师->暂停课堂");
this.pauseClass({isForce: true});
...
...
@@ -1030,9 +1029,10 @@ class ConferApe extends Ape {
return
;
}
if
(
!
rosterExists
)
{
this
.
rosterLen
=
Object
.
keys
(
this
.
rosters
).
length
;
GlobalConfig
.
rosterNumber
=
this
.
rosterLen
;
//记录当前的总人数
newNodeData
.
rosterLen
=
this
.
rosterLen
;
//this.rosterLen = Object.keys(this.rosters).length;
//GlobalConfig.rosterNum = this.rosterLen;//记录当前的总人数
//newNodeData.rosterLen = this.rosterLen;
newNodeData
.
rosterLen
=
GlobalConfig
.
rosterNum
if
(
GlobalConfig
.
classType
!=
ApeConsts
.
CLASS_TYPE_ZHIBO
){
loger
.
log
(
"人员加入->"
,
newNodeData
);
}
...
...
@@ -1043,9 +1043,9 @@ class ConferApe extends Ape {
}
}
else
{
//loger.log("更新人员列表数据,rosterExists已经存在",rosterExists);
this
.
rosterLen
=
Object
.
keys
(
this
.
rosters
).
length
;
GlobalConfig
.
rosterNumber
=
this
.
rosterLen
;
//记录当前的总人数
newNodeData
.
rosterLen
=
this
.
rosterLen
;
//this.rosterLen = Object.keys(this.rosters).length;
//GlobalConfig.rosterNum = this.rosterLen;//记录当前的总人数
newNodeData
.
rosterLen
=
GlobalConfig
.
rosterNum
;
if
(
nodeId
!=
GlobalConfig
.
nodeId
)
{
if
(
GlobalConfig
.
classType
!=
ApeConsts
.
CLASS_TYPE_ZHIBO
){
loger
.
log
(
"人员更新信息->"
,
newNodeData
);
...
...
@@ -1079,13 +1079,13 @@ class ConferApe extends Ape {
//如果推流的人员已经不存在,并且当前课堂内人员大于0;
// 如果不判断当前的人数,会出现把正常的视频消息释放的情况;
// 因为会出现先收到视频消息后收到人员加入和更新的消息
if
(
this
.
rosters
[
_param
.
fromNodeId
]
==
null
&&
this
.
rosterLen
>
0
){
if
(
this
.
rosters
[
_param
.
fromNodeId
]
==
null
&&
GlobalConfig
.
rosterNum
>
0
){
//H5不做释放处理
if
(
GlobalConfig
.
deviceType
==
GlobalConfig
.
deviceH5
){
loger
.
warn
(
"H5不做媒体模块的频道释放->当前总人数->"
+
this
.
rosterLen
,
_param
);
loger
.
warn
(
"H5不做媒体模块的频道释放->当前总人数->"
+
GlobalConfig
.
rosterNum
,
_param
);
return
;
}
loger
.
warn
(
"媒体模块被占用->占有人已经不存在课堂中->释放->当前总人数->"
+
this
.
rosterLen
,
_param
);
loger
.
warn
(
"媒体模块被占用->占有人已经不存在课堂中->释放->当前总人数->"
+
GlobalConfig
.
rosterNum
,
_param
);
this
.
_emit
(
MessageTypes
.
CLASS_NONENTITY_ROSTER
,
{
"nodeId"
:
_param
.
fromNodeId
});
}
}
...
...
@@ -1118,12 +1118,12 @@ class ConferApe extends Ape {
}
delete
this
.
rosters
[
nodeId
];
GlobalConfig
.
rosters
=
this
.
rosters
;
this
.
rosterLen
=
Object
.
keys
(
this
.
rosters
).
length
;
GlobalConfig
.
rosterNumber
=
this
.
rosterLen
;
//记录当前的总人数
//this.rosterLen = Object.keys(this.rosters).length;
//GlobalConfig.rosterNum = this.rosterLen;//记录当前的总人数
if
(
!
GlobalConfig
.
isH5
)
{
this
.
emitRosterChange
();
this
.
_emit
(
MessageTypes
.
CLASS_DELETE_ROSTER
,
{
"nodeId"
:
nodeId
,
"rosterLen"
:
this
.
rosterLen
});
this
.
_emit
(
MessageTypes
.
CLASS_DELETE_ROSTER
,
{
"nodeId"
:
nodeId
,
"rosterLen"
:
GlobalConfig
.
rosterNum
});
//当前人员列表中抽一个人来检查离开人员是否占用频道
for
(
let
key
in
this
.
rosters
)
{
...
...
@@ -1131,7 +1131,7 @@ class ConferApe extends Ape {
//判断是否是自己就处理以下操作
if
(
randNodeId
==
GlobalConfig
.
nodeId
)
{
loger
.
log
(
"检查离开的人员是否占用channel"
);
this
.
_emit
(
MessageTypes
.
CLASS_NONENTITY_ROSTER
,
{
"nodeId"
:
nodeId
,
"rosterLen"
:
this
.
rosterLen
});
this
.
_emit
(
MessageTypes
.
CLASS_NONENTITY_ROSTER
,
{
"nodeId"
:
nodeId
,
"rosterLen"
:
GlobalConfig
.
rosterNum
});
//如果离开的人员是老师,需要暂停当前的课堂
if
(
user
&&
user
.
role
==
ApeConsts
.
NR_HOST
)
{
this
.
pauseClass
();
...
...
@@ -1145,9 +1145,9 @@ class ConferApe extends Ape {
//广播当前的人数
emitRosterChange
()
{
if
(
!
GlobalConfig
.
isH5
){
this
.
_emit
(
MessageTypes
.
CLASS_UPDATE_ROSTER_NUM
,
Object
.
keys
(
this
.
rosters
).
length
);
}
//if(!GlobalConfig.isH5){
this
.
_emit
(
MessageTypes
.
CLASS_UPDATE_ROSTER_NUM
,{
rosterLen
:
GlobalConfig
.
rosterNum
});
//}
}
///////数据的封包和解包/////////////////////////////////////////
...
...
@@ -1222,8 +1222,7 @@ class ConferApe extends Ape {
stopApe
()
{
this
.
rosters
=
{};
this
.
rosterLen
=
0
;
GlobalConfig
.
rosterNumber
=
this
.
rosterLen
;
GlobalConfig
.
rosterNum
=
0
;
GlobalConfig
.
rosters
=
this
.
rosters
;
this
.
isLeave
=
true
;
this
.
isSendInsterRoster
=
false
;
...
...
src/apes/DocApe.js
查看文件 @
3b91c74
...
...
@@ -684,7 +684,7 @@ class DocApe extends Ape {
return
;
}
//如果自己不是老师,并且当前课堂内人数大于1,不能操作
if
(
!
GlobalConfig
.
isHost
&&
GlobalConfig
.
rosterNum
ber
>
1
)
{
if
(
!
GlobalConfig
.
isHost
&&
GlobalConfig
.
rosterNum
>
1
)
{
return
;
}
...
...
src/pdus/pro.js
查看文件 @
3b91c74
...
...
@@ -253,6 +253,7 @@ message RCAdapterItemPdu {
message
RCAdapterPdu
{
optional
RCPduType_E
type
=
1
[
default
=
RCPDU_REG_ADAPTER
];
repeated
RCAdapterItemPdu
item
=
2
;
optional
uint32
user_num
=
3
;
//rosterLen
}
// table operation pdu
...
...
请
注册
或
登录
后发表评论