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
李勇
2017-02-21 10:12:56 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
77e77b3229e53e2fcaa32ac23d4e95678435966d
77e77b32
1 parent
d7f5d87f
1.修改视频模块推流播流地址的拼接
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
55 行增加
和
46 行删除
src/EngineEntrance.js
src/McuClientEngine.js
src/apes/ConferApe.js
src/apes/VideoApe.js
src/EngineEntrance.js
查看文件 @
77e77b3
...
...
@@ -41,8 +41,6 @@ let _joinClassSuccessCallBackFun;
//监听mcu所有错误异常回调函数
let
_mcuErrorCallBackFun
;
let
leaveDelay
;
//MCUClient 外部实例化主类
export
default
class
MessageEntrance
extends
Emiter
{
constructor
()
{
...
...
@@ -54,10 +52,9 @@ export default class MessageEntrance extends Emiter {
//初始化状态
GlobalConfig
.
setCurrentStatus
(
GlobalConfig
.
statusCode_0
);
//全局的Error处理
this
.
on
(
MessageTypes
.
MCU_ERROR
,
this
.
_mcuErrorHandler
.
bind
(
this
));
//this.on(MessageTypes.DOC_SHOW, this.docShowHandler.bind(this));
// Sass平台层
_sass
=
Sass
;
_sass
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
...
...
@@ -79,6 +76,7 @@ export default class MessageEntrance extends Emiter {
_confer_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
_confer_ape
.
on
(
MessageTypes
.
CLASS_EXIT
,
this
.
_doClassExit
.
bind
(
this
));
//监听自己的关闭事件
_confer_ape
.
on
(
MessageTypes
.
CLASS_STATUS_INFO_CHANGE
,
this
.
_onClassStatusInfoChange
.
bind
(
this
));
//当前会议状态信息发生改变
_confer_ape
.
on
(
MessageTypes
.
CLASS_DELETE_ROSTER
,
this
.
_onClassDeleteRoster
.
bind
(
this
));
//当前会议人员离开
_chat_ape
=
new
ChatApe
();
_chat_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
...
...
@@ -174,6 +172,18 @@ export default class MessageEntrance extends Emiter {
_onClassStatusInfoChange
(
_param
)
{
this
.
_sassSaveClassStatusInfo
();
}
//有人员离开
_onClassDeleteRoster
(
_data
){
//{"nodeId":nodeId}
//当有人员离开的时候,如果离开的人员已经推流,那么需要停止推流,然后释放channel;
//只有自己是主持人的时候出才处理下面的事情
if
(
_data
!=
null
&&
_data
.
nodeId
!=
null
&&
GlobalConfig
.
isHost
){
loger
.
log
(
"有人员离开,检查一下离开的人员是否关闭推流"
);
if
(
_video_ape
){
_video_ape
.
stopPublishVideo
(
_data
.
nodeId
);
}
}
}
//Sass
//初始化
...
...
@@ -615,12 +625,15 @@ export default class MessageEntrance extends Emiter {
}
// 离开会议
_leaveClass
()
{
//停止推流
if
(
_video_ape
){
_video_ape
.
stopPublishVideo
();
}
//离开会议
if
(
_confer_ape
){
_confer_ape
.
leaveClass
();
}
//断开MCU连接
if
(
_mcu
){
_mcu
.
leaveMCU
();
GlobalConfig
.
setCurrentStatus
(
GlobalConfig
.
statusCode_3
);
...
...
@@ -757,36 +770,6 @@ export default class MessageEntrance extends Emiter {
_doc_ape
.
documentDeleteAll
(
_param
);
}
}
/* // 白板笔记更新(svg)
annoUpdateHandler(annoInfo) {
const activeDocId = _confer_ape.activeDocId;
const docItem = _doc_ape.docList[activeDocId];
if (docItem && annoInfo.id == docItem.wbid) {
this._emit(MessageTypes.DOC_ANNOTATION, annoInfo);
}
}*/
/* // 文档变更-笔记处理
docShowHandler(docItem) {
loger.log('Doc Show ->' + docItem.id + '|' + docItem.curPageNo);
const annoInfo = _whiteboard_ape.annoInfos[docItem.wbid];
if (annoInfo) {
this._emit(MessageTypes.DOC_ANNOTATION, annoInfo);
} else {
this._emit(MessageTypes.DOC_ANNOTATION);
}
}*/
/* // 文档切换
docSwitchHandler() {
const activeDocId = _confer_ape.activeDocId;
loger.log('Switch Doc Active -> ' + activeDocId);
const docItem = _doc_ape.docList[activeDocId];
if (docItem) {
this._emit(MessageTypes.DOC_SHOW, docItem);
}
}*/
//// 文档变更,白板也需要做处理
docUpdateHandler
(
_data
)
{
...
...
@@ -804,7 +787,6 @@ export default class MessageEntrance extends Emiter {
}
}
//文档加入频道成功,同步到MCU服务器上的数据
docJoinChannelSuccess
(){
loger
.
log
(
"docJoinChannelSuccess isHost="
,
GlobalConfig
.
isHost
);
...
...
src/McuClientEngine.js
查看文件 @
77e77b3
...
...
@@ -2,6 +2,7 @@ import EngineEntrance from 'EngineEntrance';
import
MessageTypes
from
'MessageTypes'
;
const
MCU_CLIENT
=
new
EngineEntrance
();
export
function
createMcuClient
()
{
return
MCU_CLIENT
;
}
...
...
src/apes/ConferApe.js
查看文件 @
77e77b3
...
...
@@ -460,7 +460,8 @@ class ConferApe extends Ape {
//视频模块发生更新,人员状态需要更新
updaterRosterStatus
(
_param
){
loger
.
log
(
"视频模块发生更新,人员状态需要更新"
,
_param
);
loger
.
log
(
"视频模块发生更新,人员状态需要更新"
);
console
.
log
(
_param
);
//如果是自己。改变自己的状态同步到MCU
}
//删除用户
...
...
src/apes/VideoApe.js
查看文件 @
77e77b3
...
...
@@ -46,17 +46,35 @@ class VideoChat extends Ape {
//获取播流地址
getPlayVideoPath
(
_param
)
{
loger
.
log
(
'getPlayVideoPath'
);
if
(
_param
==
null
||
_param
.
classId
==
null
||
_param
.
channelId
==
null
||
_param
.
timestamp
==
null
)
{
if
(
_param
==
null
||
_param
.
siteId
==
null
||
_param
.
classId
==
null
||
_param
.
userId
==
null
||
_param
.
channelId
==
null
||
_param
.
timestamp
==
null
)
{
loger
.
warn
(
'getPlayVideoPath,参数错误'
,
_param
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_APE_INTERFACE_PARAM_WRONG
);
return
{
"code"
:
1
,
"data"
:
"
getPlayVideoPath,参数错误
"
};
return
{
"code"
:
1
,
"data"
:
""
};
}
let
path
=
""
;
if
(
_param
.
type
==
"m3u8"
)
{
path
=
"http://"
+
GlobalConfig
.
MSServerIP
+
":80"
+
"/hls/"
+
_param
.
classId
+
"_"
+
_param
.
channelId
+
"_"
+
_param
.
timestamp
+
".m3u8"
;
//M3U8 默认用80端口
//http://123.56.73.119/hls/h5dev_403074980_0_983042_1487641745/index.m3u8
path
=
"http://"
+
GlobalConfig
.
MSServerIP
+
"/hls/"
+
_param
.
siteId
+
"_"
+
_param
.
classId
+
"_"
+
_param
.
userId
+
"_"
+
_param
.
channelId
+
"_"
+
_param
.
timestamp
+
"/index.m3u8"
;
}
else
{
let
port
=
(
GlobalConfig
.
MSServerPort
==
""
||
GlobalConfig
.
MSServerPort
==
null
)
?
""
:
":"
+
GlobalConfig
.
MSServerPort
;
path
=
"rtmp://"
+
GlobalConfig
.
MSServerIP
+
port
+
"/live/"
+
_param
.
classId
+
"_"
+
_param
.
channelId
+
"_"
+
_param
.
timestamp
;
path
=
"rtmp://"
+
GlobalConfig
.
MSServerIP
+
port
+
"/live/"
+
_param
.
siteId
+
"_"
+
_param
.
classId
+
"_"
+
_param
.
userId
+
"_"
+
_param
.
channelId
+
"_"
+
_param
.
timestamp
;
}
return
{
"code"
:
0
,
"data"
:
path
};
}
...
...
@@ -77,8 +95,8 @@ class VideoChat extends Ape {
let
port
=
(
GlobalConfig
.
MSServerPort
==
""
||
GlobalConfig
.
MSServerPort
==
null
)
?
""
:
":"
+
GlobalConfig
.
MSServerPort
;
let
timestamp
=
EngineUtils
.
creatTimestamp
();
let
publishUrl
=
"rtmp://"
+
GlobalConfig
.
MSServerIP
+
port
+
"/live/"
+
GlobalConfig
.
classId
+
"_"
+
freeChannel
+
"_"
+
timestamp
;
return
{
"code"
:
0
,
"data"
:
{
"channelId"
:
freeChannel
,
"timestamp"
:
timestamp
,
"publishUrl"
:
publishUrl
}};
let
publishUrl
=
"rtmp://"
+
GlobalConfig
.
MSServerIP
+
port
+
"/live/"
+
GlobalConfig
.
siteId
+
"_"
+
GlobalConfig
.
classId
+
"_"
+
GlobalConfig
.
userId
+
"_"
+
freeChannel
+
"_"
+
timestamp
;
return
{
"code"
:
0
,
"data"
:
{
"siteId"
:
GlobalConfig
.
siteId
,
"classId"
:
GlobalConfig
.
classId
,
"userId"
:
GlobalConfig
.
userId
,
"channelId"
:
freeChannel
,
"timestamp"
:
timestamp
,
"publishUrl"
:
publishUrl
}};
}
//推流
...
...
@@ -107,13 +125,16 @@ class VideoChat extends Ape {
this
.
sendTableUpdateHandler
(
channelInfo
);
}
//停止推流
//停止推流
,
stopPublishVideo
(
_param
)
{
loger
.
log
(
'stopPublishVideo -> maxVideoChannels'
,
GlobalConfig
.
maxVideoChannels
);
let
openingChannel
=
this
.
getOpeningVideoChannel
(
GlobalConfig
.
nodeId
);
//_param如果为空,那么默认就是当前自己的nodeId,否则用_param
let
nodeId
=
_param
||
GlobalConfig
.
nodeId
;
let
openingChannel
=
this
.
getOpeningVideoChannel
(
nodeId
);
if
(
openingChannel
==
0
)
{
loger
.
warn
(
"stopPublishVideo,没有打开的channel"
);
return
{
"code"
:
1
,
"data"
:
"没有打开的设备channel"
};
loger
.
warn
(
nodeId
,
"stopPublishVideo,没有打开的channel,不需要关闭"
);
return
{
"code"
:
1
,
"data"
:
"没有打开的channel,不需要关闭"
};
}
let
channelInfo
=
{};
...
...
@@ -196,6 +217,10 @@ class VideoChat extends Ape {
// return;
//}
let
updateModelPdu
=
this
.
packPdu
(
_channelInfo
,
_channelInfo
.
channelId
);
//let updateModelPdu=this.packPdu({},ApeConsts.VIDEO_OBJ_TABLE_ID+2);
if
(
updateModelPdu
==
null
){
loger
.
warn
(
"sendTableUpdateHandler error,updateModelPdu=null"
);
return
;
}
let
tableItemPdu
=
new
pdu
[
'RCRegistryTableItemPdu'
];
tableItemPdu
.
itemIdx
=
_channelInfo
.
channelId
;
//tableItemPdu.itemIdx=ApeConsts.VIDEO_OBJ_TABLE_ID+2;
...
...
请
注册
或
登录
后发表评论