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
李勇
8 years ago
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
82393cdc8e86b615add70a1a3d5eecf66c669b10
82393cdc
1 parent
900908ef
1.最终使用的server信息来源描述 修复;2.被踢出课堂时,增加新进入的人员的信息
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
70 行增加
和
37 行删除
src/EngineEntrance.js
src/GlobalConfig.js
src/apes/ConferApe.js
src/EngineEntrance.js
查看文件 @
82393cd
...
...
@@ -57,7 +57,7 @@ export default class MessageEntrance extends Emiter {
constructor
()
{
super
();
//sdk 信息
GlobalConfig
.
sdkVersion
=
"v1.6
1.0.20170729
"
;
GlobalConfig
.
sdkVersion
=
"v1.6
2.3.20170731
"
;
loger
.
warn
(
"sdkVersion:"
+
GlobalConfig
.
sdkVersion
);
//获取设备和系统信息
...
...
@@ -300,9 +300,22 @@ export default class MessageEntrance extends Emiter {
}
//mcu异常监听
_mcuErrorHandler
(
_data
,
_option
)
{
let
option
=
_option
||
""
;
let
errorMessage
=
{
"code"
:
_data
,
"reson"
:
MessageTypes
.
ErrorReson
[
_data
]
+
" "
+
option
};
_mcuErrorHandler
(
_data
)
{
let
errorMessage
=
{};
//目前只有 userId和身份相同时被踢的时候有type值判断
switch
(
_data
.
type
){
case
MessageTypes
.
ERR_CLASS_KICK_OUT
:
case
MessageTypes
.
ERR_CLASS_REMOTE_LANDING
:
if
(
_data
){
errorMessage
=
{
"code"
:
_data
.
type
,
"reson"
:
MessageTypes
.
ErrorReson
[
_data
.
type
],
"data"
:
_data
.
data
};
}
break
;
default
:
errorMessage
=
{
"code"
:
_data
,
"reson"
:
MessageTypes
.
ErrorReson
[
_data
],
"data"
:{}};
break
;
}
this
.
_emit
(
MessageTypes
.
ERROR_EVENT
,
errorMessage
);
loger
.
error
(
"MCU_ERROR"
,
errorMessage
);
}
...
...
@@ -736,12 +749,17 @@ export default class MessageEntrance extends Emiter {
GlobalConfig
.
hlsPullListFinal
=
GlobalConfig
.
rsPullListFinal
;
}
loger
.
warn
(
"课堂最终使用的服务列表->来自本地Server.json"
);
loger
.
warn
(
" GlobalConfig.mcuListFinal"
,
GlobalConfig
.
mcuListFinal
);
loger
.
warn
(
" GlobalConfig.msListFinal"
,
GlobalConfig
.
msListFinal
);
loger
.
warn
(
" GlobalConfig.rtmpPullListFinal"
,
GlobalConfig
.
rtmpPullListFinal
);
loger
.
warn
(
" GlobalConfig.hlsListFinal"
,
GlobalConfig
.
hlsPullListFinal
);
loger
.
warn
(
" GlobalConfig.rsListFinal"
,
GlobalConfig
.
rsPullListFinal
);
if
(
!
ServerConfig
.
localServerJson
||!
ServerConfig
.
localServerJson
.
MCU
||!
ServerConfig
.
localServerJson
.
MS
){
loger
.
warn
(
"课堂最终使用的服务列表->来自Sass"
);
}
else
{
loger
.
warn
(
"课堂最终使用的服务列表->来自本地Server.json"
);
}
loger
.
warn
(
"mcuListFinal"
,
GlobalConfig
.
mcuListFinal
);
loger
.
warn
(
"msListFinal"
,
GlobalConfig
.
msListFinal
);
loger
.
warn
(
"rtmpPullListFinal"
,
GlobalConfig
.
rtmpPullListFinal
);
loger
.
warn
(
"hlsListFinal"
,
GlobalConfig
.
hlsPullListFinal
);
loger
.
warn
(
"rsListFinal"
,
GlobalConfig
.
rsPullListFinal
);
}
//从Sass中选择的mcu、ms列表
_choiceMcuAndMsListFromSass
()
{
...
...
@@ -1422,7 +1440,7 @@ export default class MessageEntrance extends Emiter {
//是否自动开始(身份是host的时候才用到的)
GlobalConfig
.
isAutoStartClass
=
_data
.
autoRecord
||
0
;
GlobalConfig
.
logUrl
=
_data
.
logUrl
||
""
;
GlobalConfig
.
serverTime
=
_data
.
serverTime
||
new
Date
().
getTime
();
//获取服务器时间戳
GlobalConfig
.
serverAndLoacTimeDistanc
=
(
new
Date
().
getTime
()
-
GlobalConfig
.
serverTime
)
/
1000
;
//当前系统时间和服务器时间的差值 (秒)
loger
.
warn
(
"服务器时间:"
+
GlobalConfig
.
serverTime
+
" 系统时间:"
+
new
Date
().
getTime
()
+
" 时间差:"
+
GlobalConfig
.
serverAndLoacTimeDistanc
);
...
...
@@ -1485,7 +1503,7 @@ export default class MessageEntrance extends Emiter {
GlobalConfig.hlsListFinal=GlobalConfig.hlsPullList;
GlobalConfig.rsListFinal=GlobalConfig.rsList;
GlobalConfig.mcuListFinal=GlobalConfig.mcuList;*/
}
}
//课堂获取Sass数据完成
this
.
_emit
(
MessageTypes
.
CLASS_GET_INFO_SUCCESS
,
GlobalConfig
.
getClassInfo
());
...
...
src/GlobalConfig.js
查看文件 @
82393cd
...
...
@@ -518,6 +518,7 @@ GlobalConfig.siteId_letv = 'shchuanbao'; //乐视,MS不需要动态选点的
GlobalConfig
.
ssTunnelAppURL
=
''
;
//屏幕共享插件的地址
GlobalConfig
.
serverTime
=
0
;
//服务器当前时间戳
GlobalConfig
.
serverAndLoacTimeDistanc
=
0
;
//本地时间和服务器时间错的差值;
GlobalConfig
.
logUrl
=
""
;
//日志上报地址;
GlobalConfig
.
rosterNumber
=
0
;
//当前总人数
...
...
src/apes/ConferApe.js
查看文件 @
82393cd
...
...
@@ -26,7 +26,7 @@ class ConferApe extends Ape {
);
this
.
rosters
=
{};
//用户列表
this
.
rosterLen
=
0
;
//当前课堂人数
this
.
rosterLen
=
0
;
//当前课堂人数
this
.
timerCounter
=
new
TimerCounter
();
//计时器
//第三方消息控制 parent和Iframe直接的通讯
...
...
@@ -150,7 +150,7 @@ class ConferApe extends Ape {
nodeInfoRecordPdu
.
explorer
=
GlobalConfig
.
explorer
;
nodeInfoRecordPdu
.
explorerVersion
=
GlobalConfig
.
explorerVersion
;
nodeInfoRecordPdu
.
os
=
GlobalConfig
.
os
;
nodeInfoRecordPdu
.
sdkVersion
=
GlobalConfig
.
sdkVersion
||
"未知版本"
;
nodeInfoRecordPdu
.
sdkVersion
=
GlobalConfig
.
sdkVersion
||
"未知版本"
;
return
nodeInfoRecordPdu
;
}
...
...
@@ -449,7 +449,7 @@ class ConferApe extends Ape {
//将指定nodeId的人踢出课堂
kickOutRosterFormNodeId
(
_param
)
{
if
(
GlobalConfig
.
isNormal
)
{
if
(
GlobalConfig
.
isNormal
)
{
loger
.
warn
(
"普通身份没有踢人的权限"
);
return
;
}
...
...
@@ -747,10 +747,10 @@ class ConferApe extends Ape {
onThirdReciveParentMessage
(
_msg
)
{
loger
.
log
(
'收到页面的消息->广播给其他模块->'
,
_msg
);
//尝试将外部传入的数据转换为JSON 字符串
let
_message
=
_msg
;
try
{
_message
=
JSON
.
parse
(
_msg
);
}
catch
(
err
){
let
_message
=
_msg
;
try
{
_message
=
JSON
.
parse
(
_msg
);
}
catch
(
err
)
{
}
this
.
sendThirdBroadcastData
({
to
:
0
,
message
:
_message
});
...
...
@@ -773,12 +773,12 @@ class ConferApe extends Ape {
thirdBroadcastSendPdu
.
initiator
=
this
.
_classInfo
.
nodeId
;
//发起人
thirdBroadcastSendPdu
.
peer
=
parseInt
(
_param
.
to
)
||
0
;
//发送给谁,公聊的时候是0,私聊的时候是指定的用户id
thirdBroadcastSendPdu
.
isPublic
=
true
;
let
messageStr
=
_param
.
message
||
""
;
let
messageStr
=
_param
.
message
||
""
;
//尝试把信息转换为JSON 字符串,如果是字符串就不需要转
try
{
messageStr
=
JSON
.
stringify
(
messageStr
);
}
catch
(
err
){
try
{
messageStr
=
JSON
.
stringify
(
messageStr
);
}
catch
(
err
)
{
}
thirdBroadcastSendPdu
.
message
=
this
.
_rCArrayBufferUtil
.
strToUint8Array
(
"h5"
+
messageStr
);
...
...
@@ -802,7 +802,7 @@ class ConferApe extends Ape {
//loger.log("监听第三方消息通道消息->1", thirdMessage);
thirdMessage
.
message
=
this
.
_rCArrayBufferUtil
.
uint8ArrayToStr
(
thirdBroadcastReceivePdu
.
message
,
2
);
loger
.
log
(
"监听第三方消息通道消息->"
,
thirdMessage
);
this
.
_emit
(
MessageTypes
.
RECEIVE_THIRD_MESSGAE
,
thirdMessage
);
this
.
_emit
(
MessageTypes
.
RECEIVE_THIRD_MESSGAE
,
thirdMessage
);
if
(
this
.
thirdMessage
)
{
this
.
thirdMessage
.
sendMessageToParent
(
thirdMessage
.
message
);
}
...
...
@@ -861,12 +861,19 @@ class ConferApe extends Ape {
//1.判断进入的用户身份,如果进入的人身份是host,助教,监课,并且和自己的身份冲突,自己会被踢掉
//2.最后进入的人会踢掉之前进入的人,nodeId是按时间戳生成的,最后进入的人nodeId的值比之前进入的人大
if
(
parseInt
(
nodeId
)
>
GlobalConfig
.
nodeId
)
{
let
newUserInfo
=
{
userId
:
nodeData
.
userId
,
userName
:
nodeData
.
name
,
nodeId
:
nodeData
.
nodeId
,
userRole
:
nodeData
.
userRole
,
deviceType
:
nodeData
.
deviceType
}
if
(
nodeData
.
role
==
ApeConsts
.
NR_HOST
&&
GlobalConfig
.
isHost
)
{
this
.
kickOutRoster
();
this
.
kickOutRoster
(
newUserInfo
);
return
;
}
else
if
(
nodeData
.
userId
==
GlobalConfig
.
userId
&&
GlobalConfig
.
userId
!=
"0"
)
{
loger
.
log
(
"异地登陆->userId->"
,
GlobalConfig
.
userId
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_CLASS_REMOTE_LANDING
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
{
type
:
MessageTypes
.
ERR_CLASS_REMOTE_LANDING
,
data
:
newUserInfo
}
);
this
.
_emit
(
MessageTypes
.
CLASS_RUN_EXIT
,
{
'type'
:
1
});
}
}
...
...
@@ -912,26 +919,33 @@ class ConferApe extends Ape {
loger
.
log
(
"NR_INVISIBLE"
);
return
;
}
if
(
!
rosterExists
){
this
.
rosterLen
=
Object
.
keys
(
this
.
rosters
).
length
;
if
(
!
rosterExists
)
{
this
.
rosterLen
=
Object
.
keys
(
this
.
rosters
).
length
;
GlobalConfig
.
rosterNumber
=
this
.
rosterLen
;
//记录当前的总人数
newNodeData
.
rosterLen
=
this
.
rosterLen
;
newNodeData
.
rosterLen
=
this
.
rosterLen
;
loger
.
log
(
"人员加入->"
,
newNodeData
);
this
.
_emit
(
MessageTypes
.
CLASS_INSERT_ROSTER
,
{
"nodeId"
:
nodeId
,
"nodeData"
:
newNodeData
});
this
.
emitRosterChange
();
}
else
{
//loger.log("更新人员列表数据,rosterExists已经存在",rosterExists);
this
.
rosterLen
=
Object
.
keys
(
this
.
rosters
).
length
;
this
.
rosterLen
=
Object
.
keys
(
this
.
rosters
).
length
;
GlobalConfig
.
rosterNumber
=
this
.
rosterLen
;
//记录当前的总人数
newNodeData
.
rosterLen
=
this
.
rosterLen
;
newNodeData
.
rosterLen
=
this
.
rosterLen
;
loger
.
log
(
"人员更新信息->"
,
newNodeData
);
this
.
_emit
(
MessageTypes
.
CLASS_UPDATE_ROSTER
,
{
"nodeId"
:
nodeId
,
"nodeData"
:
newNodeData
});
}
}
//踢出用户
kickOutRoster
()
{
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_CLASS_KICK_OUT
);
//踢出用户(_param是新进入的人的信息)
kickOutRoster
(
_newUserInfo
)
{
/* {
userId: nodeData.userId,
userName: nodeData.name,
nodeId:nodeData.nodeId,
userRole:nodeData.userRole,
deviceType: nodeData.deviceType
}*/
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
{
type
:
MessageTypes
.
ERR_CLASS_KICK_OUT
,
data
:
_newUserInfo
});
this
.
_emit
(
MessageTypes
.
CLASS_RUN_EXIT
,
{
'type'
:
1
});
}
...
...
@@ -990,11 +1004,11 @@ class ConferApe extends Ape {
loger
.
log
(
nodeId
,
"->离开课堂->身份->"
,
user
.
role
);
}
delete
this
.
rosters
[
nodeId
];
this
.
rosterLen
=
Object
.
keys
(
this
.
rosters
).
length
;
this
.
rosterLen
=
Object
.
keys
(
this
.
rosters
).
length
;
GlobalConfig
.
rosterNumber
=
this
.
rosterLen
;
//记录当前的总人数
this
.
emitRosterChange
();
this
.
_emit
(
MessageTypes
.
CLASS_DELETE_ROSTER
,
{
"nodeId"
:
nodeId
,
"rosterLen"
:
this
.
rosterLen
});
this
.
_emit
(
MessageTypes
.
CLASS_DELETE_ROSTER
,
{
"nodeId"
:
nodeId
,
"rosterLen"
:
this
.
rosterLen
});
//当前人员列表中抽一个人来检查离开人员是否占用频道
for
(
let
key
in
this
.
rosters
)
{
...
...
@@ -1002,7 +1016,7 @@ class ConferApe extends Ape {
//如果抽到的人是自己就处理以下操作
if
(
randNodeId
==
GlobalConfig
.
nodeId
)
{
loger
.
log
(
randNodeId
,
"有权限检查离开的人员是否占用channel"
);
this
.
_emit
(
MessageTypes
.
CLASS_NONENTITY_ROSTER
,
{
"nodeId"
:
nodeId
,
"rosterLen"
:
this
.
rosterLen
});
this
.
_emit
(
MessageTypes
.
CLASS_NONENTITY_ROSTER
,
{
"nodeId"
:
nodeId
,
"rosterLen"
:
this
.
rosterLen
});
//如果离开的人员是老师,需要暂停当前的课堂
if
(
user
&&
user
.
role
==
ApeConsts
.
NR_HOST
)
{
...
...
请
注册
或
登录
后发表评论