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
0a54693fefcc710d9c7ddd0da7eed3e2e3cd229d
0a54693f
1 parent
56eaae2e
1.在课堂状态发生改变的时候,需要判断是否需要停止推流,这个会影响到课堂录制的消息2.在课堂状态信息更新的数据中增加是否需要停止当前音视频推流的字段;3.增加是否需要停止当前推流的事件监听消息;
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
44 行增加
和
21 行删除
dist/McuClient.js
src/EngineEntrance.js
src/MessageTypes.js
src/apes/ConferApe.js
src/pdus/pro.js
dist/McuClient.js
查看文件 @
0a54693
此 diff 太大无法显示。
src/EngineEntrance.js
查看文件 @
0a54693
...
...
@@ -23,11 +23,12 @@ import ApeConsts from 'apes/ApeConsts';
import
Base64
from
'base64-js'
;
import
ArrayBufferUtil
from
'libs/ArrayBufferUtil'
;
import
Server
from
"config/Server"
;
import
MediaModule
from
'apes/MediaModule'
;
import
UTF8
from
'utf-8'
;
let
loger
=
Loger
.
getLoger
(
'McuClient'
);
let
_sdkInfo
=
{
"version"
:
"v1.1
8.0.201705010
"
,
"author"
:
"www.3mang.com"
};
let
_sdkInfo
=
{
"version"
:
"v1.1
9.0.201705011
"
,
"author"
:
"www.3mang.com"
};
//APE
let
_sass
;
...
...
@@ -97,7 +98,7 @@ export default class MessageEntrance extends Emiter {
_confer_ape
.
on
(
MessageTypes
.
CLASS_RECORD_START
,
this
.
_onClassRecordStart
.
bind
(
this
));
//课堂开始录制
_confer_ape
.
on
(
MessageTypes
.
CLASS_RECORD_SUCCESS
,
this
.
_onClassRecordSuccess
.
bind
(
this
));
//课堂开启录制成功
_confer_ape
.
on
(
MessageTypes
.
SWITCH_MS_IP
,
this
.
_switchMsIpHandler
.
bind
(
this
));
//MS动态选点
_confer_ape
.
on
(
MessageTypes
.
STOP_ALL_MEDIA_PUBLISH
,
this
.
_stopAllMediaPublishHandler
.
bind
(
this
));
//课堂状态发生改变,需要停止当前的所有推流
_chat_ape
=
new
ChatApe
();
_chat_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
...
...
@@ -863,6 +864,19 @@ export default class MessageEntrance extends Emiter {
});
}
//课堂状态发生改变,需要停止当前的所有推流
_stopAllMediaPublishHandler
(
_data
){
let
allChannels
=
MediaModule
.
allMediaChannelsList
;
let
channl
=
null
;
for
(
let
i
in
allChannels
){
channl
=
allChannels
[
i
];
if
(
channl
&&
channl
.
status
==
ApeConsts
.
CHANNEL_STATUS_OPENING
&&
channl
.
fromNodeId
==
GlobalConfig
.
nodeId
){
this
.
_emit
(
MessageTypes
.
MEDIA_STOP_PUBLISH
);
return
;
}
}
}
//切换MS ->_param->{reConnect:false} //reConnect(是否立即替换当前的ip并且重新连接)
_switchMsIpHandler
(
_param
)
{
if
(
GlobalConfig
.
isRecordPlayBack
)
{
...
...
src/MessageTypes.js
查看文件 @
0a54693
...
...
@@ -31,14 +31,19 @@ MessageTypes.CLASS_STATUS_INFO_CHANGE="class_status_info_change";// 'class.statu
MessageTypes
.
CLASS_UPDATE_TIMER
=
"class_update_timer"
;
//'class.update.timer';//更新当前上课的时间
MessageTypes
.
CLASS_RECORD_STOP
=
"class_record_stop"
;
//;//停止录制
MessageTypes
.
CLASS_RECORD_START
=
"class_record_start"
;
//;//开始录制
MessageTypes
.
CLASS_RECORD_SUCCESS
=
"class_record_success"
;
////开启录制成功
MessageTypes
.
CLASS_RECORD_SUCCESS
=
"class_record_success"
;
////操作录制状态成功
//聊天模块事件定义
MessageTypes
.
CHAT_RECEIVE
=
"chat_receive_message"
;
// 'chat.receive';
//视频模块事件定义
MessageTypes
.
STOP_ALL_MEDIA_PUBLISH
=
"stop_all_media_publish"
;
//停止所有音视频推流
MessageTypes
.
MEDIA_STOP_PUBLISH
=
"media_stop_publish"
;
//发送给应用层的停止推流消息
MessageTypes
.
USER_DEVICE_STATUS_CHAANGE
=
"user_device_status_change"
;
// 'video.play';//播放视频
MessageTypes
.
VIDEO_PLAY
=
"video_play"
;
// 'video.play';//播放视频
MessageTypes
.
VIDEO_STOP
=
"video_stop"
;
//'video.stop';//停止视频
...
...
src/apes/ConferApe.js
查看文件 @
0a54693
...
...
@@ -255,7 +255,6 @@ class ConferApe extends Ape {
GlobalConfig
.
classStopTime
=
EngineUtils
.
creatTimestampStr
();
this
.
sendConferRecordMsg
({
"recordStatus"
:
true
});
this
.
_emit
(
MessageTypes
.
CLASS_STATUS_INFO_CHANGE
);
this
.
_emit
(
MessageTypes
.
CLASS_RECORD_START
);
//课堂开始录制
}
}
...
...
@@ -321,7 +320,7 @@ class ConferApe extends Ape {
GlobalConfig
.
classStopTime
=
EngineUtils
.
creatTimestampStr
();
this
.
stopRecord
();
this
.
_emit
(
MessageTypes
.
CLASS_STATUS_INFO_CHANGE
);
this
.
sendUpdaterClassStatusInfo
({
"actionType"
:
0
});
this
.
sendUpdaterClassStatusInfo
({
"actionType"
:
0
,
isStopAllPublishMedia
:
true
});
loger
.
log
(
'restorClass'
);
}
...
...
@@ -349,12 +348,12 @@ class ConferApe extends Ape {
//课堂状态改变
this
.
_emit
(
MessageTypes
.
CLASS_STATUS_INFO_CHANGE
);
//同步课堂状态
this
.
sendUpdaterClassStatusInfo
({
"actionType"
:
1
});
this
.
sendUpdaterClassStatusInfo
({
"actionType"
:
1
,
isStopAllPublishMedia
:
true
});
//开始计时
this
.
startTimerCounter
();
}
else
{
loger
.
warn
(
'没有权限'
);
loger
.
warn
(
'没有
开始课堂的
权限'
);
}
}
...
...
@@ -369,7 +368,7 @@ class ConferApe extends Ape {
this
.
stopRecord
();
this
.
_emit
(
MessageTypes
.
CLASS_STATUS_INFO_CHANGE
,
_param
);
this
.
sendUpdaterClassStatusInfo
({
"actionType"
:
2
});
this
.
sendUpdaterClassStatusInfo
({
"actionType"
:
2
,
isStopAllPublishMedia
:
true
});
this
.
stopTimerCounter
();
}
...
...
@@ -415,19 +414,18 @@ class ConferApe extends Ape {
//更新课堂信息
sendUpdaterClassStatusInfo
(
_param
)
{
loger
.
log
(
'更新课堂信息->'
);
//{"actionType": 1,isStopAllPublishMedia:false} //actionType课堂状态 isStopAllPublishMedia是否停止当前的所有推流
loger
.
log
(
'发送更新课堂信息->'
);
if
(
_param
==
null
||
EngineUtils
.
isEmptyObject
(
_param
))
{
loger
.
log
(
'更新课堂信息->参数错误'
);
loger
.
log
(
'
发送
更新课堂信息->参数错误'
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_APE_INTERFACE_PARAM_WRONG
);
return
;
}
itemIdx
=
ApeConsts
.
CONFERENCE_OBJ_TABLE_ID
;
// itemIdx=_param.itemIdx;
let
modelPdu
=
this
.
packPdu
(
_param
,
itemIdx
);
//loger.log('sendUpdaterClassStatusInfo----2------');
loger
.
log
(
modelPdu
);
if
(
modelPdu
==
null
)
{
loger
.
log
(
'更新课堂信息->参数错误'
);
loger
.
log
(
'
发送
更新课堂信息->参数错误'
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_APE_INTERFACE_PARAM_WRONG
);
return
;
}
...
...
@@ -461,7 +459,6 @@ class ConferApe extends Ape {
adapterPdu
.
type
=
pdu
.
RCPDU_REG_ADAPTER
;
adapterPdu
.
item
.
push
(
adapterItemPdu
);
loger
.
log
(
"更新课堂信息->发送更新数据"
);
this
.
sendUniform
(
adapterPdu
,
true
);
}
...
...
@@ -532,7 +529,7 @@ class ConferApe extends Ape {
this
.
_emit
(
MessageTypes
.
CLASS_STATUS_INFO_CHANGE
);
//同步消息给其他人
this
.
sendUpdaterClassStatusInfo
({
"actionType"
:
1
});
this
.
sendUpdaterClassStatusInfo
({
"actionType"
:
1
,
isStopAllPublishMedia
:
false
});
}
}
...
...
@@ -545,12 +542,17 @@ class ConferApe extends Ape {
tableUpdateHandler
(
owner
,
itemIdx
,
itemData
)
{
try
{
let
model
=
this
.
unPackPdu
(
owner
,
itemIdx
,
itemData
);
loger
.
log
(
'
tableUpdateHandler
'
);
loger
.
log
(
'
课堂数据更新
'
);
loger
.
log
(
model
);
//处理课堂更新的信息
if
(
model
&&
model
.
classStatusInfo
)
{
GlobalConfig
.
setClassStatusInfo
(
model
.
classStatusInfo
);
if
(
model
.
classStatusInfo
.
isStopAllPublishMedia
){
//课堂状态发送改变 需要对当前正在推的流进行停止,因为录制的问题;
this
.
_emit
(
MessageTypes
.
STOP_ALL_MEDIA_PUBLISH
);
}
}
//通知应用层更新课堂状态
this
.
_emit
(
MessageTypes
.
CLASS_UPTATE_STATUS
,
GlobalConfig
.
classStatusInfo
);
...
...
@@ -616,19 +618,19 @@ class ConferApe extends Ape {
try
{
let
conferRecordSendPdu
=
pdu
[
'RCConferenceRecordRequestPdu'
].
decode
(
_data
);
// {"initiator":820461225,"record":false,"classTime":3213,"filename":"h5dev/20170410/1437784290_20170410.rec"}
loger
.
log
(
"
onSendConferRecordRequestHandler
->"
,
conferRecordSendPdu
);
loger
.
log
(
"
录制回放控制操作成功
->"
,
conferRecordSendPdu
);
if
(
conferRecordSendPdu
&&
conferRecordSendPdu
.
record
==
true
||
conferRecordSendPdu
.
record
==
"true"
){
//每次开启录制的时候,需要把当前显示的文档数据更新一次,否则无法录制已经显示的文件
this
.
_emit
(
MessageTypes
.
CLASS_RECORD_SUCCESS
);
}
}
catch
(
err
)
{
loger
.
warn
(
"
onSendConferRecordRequestHandler err
"
,
err
.
message
);
loger
.
warn
(
"
录制回放控制操作错误->
"
,
err
.
message
);
}
}
rosterInsertHandler
(
nodeId
,
nodeData
)
{
loger
.
log
(
"rosterInsertHandler
--->"
);
//loger.log("人员进入
--->");
if
(
GlobalConfig
.
nodeId
==
nodeId
)
{
}
else
{
...
...
@@ -834,8 +836,9 @@ class ConferApe extends Ape {
classStatusInfo
.
serverTimestamp
=
GlobalConfig
.
serverTimestamp
;
//当前的系统时间戳
classStatusInfo
.
activeDocId
=
GlobalConfig
.
activeDocId
;
//当前激活的文档id
classStatusInfo
.
activeDocCurPage
=
GlobalConfig
.
activeDocCurPage
;
//当前激活的文档的当前页
classStatusInfo
.
isStopAllPublishMedia
=
_param
.
isStopAllPublishMedia
||
false
;
loger
.
log
(
"classStatusInfo--->"
,
classStatusInfo
);
//
loger.log("classStatusInfo--->", classStatusInfo);
/*
optional uint32 item_idx=1;
...
...
@@ -855,7 +858,7 @@ class ConferApe extends Ape {
}
unPackPdu
(
owner
,
itemIdx
,
itemData
)
{
loger
.
log
(
"课堂
===
unPackPdu "
);
loger
.
log
(
"课堂
数据->
unPackPdu "
);
if
(
owner
==
null
||
itemIdx
==
null
||
itemData
==
null
)
{
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_APE_INTERFACE_PARAM_WRONG
);
return
null
;
...
...
src/pdus/pro.js
查看文件 @
0a54693
...
...
@@ -956,6 +956,7 @@ message RCClassStatusInfoPdu {
optional
uint32
server_timestamp
=
19
;
//当前的系统时间戳
optional
uint32
active_doc_id
=
20
;
//当前激活的文档id
optional
uint32
active_doc_cur_page
=
21
;
//当前激活的文档的当前页
optional
bool
isStopAllPublishMedia
=
22
;
//是否停止推流
}
message
RCConferenceRecordRequestPdu
{
...
...
请
注册
或
登录
后发表评论