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 14:42:32 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e2d5525a1fef5bc815dde9f31b4929a857aa3347
e2d5525a
1 parent
77e77b32
1.视频模块增加m3u8播流地址
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
52 行增加
和
6 行删除
src/EngineEntrance.js
src/GlobalConfig.js
src/apes/VideoApe.js
src/EngineEntrance.js
查看文件 @
e2d5525
...
...
@@ -330,6 +330,14 @@ export default class MessageEntrance extends Emiter {
GlobalConfig
.
MSServerPort
=
server
.
split
(
":"
)[
1
];
}
//m3u8播流地址
if
(
_data
.
rs
){
//RS地址默认使用第一个
let
server
=
_data
.
rs
.
split
(
";"
)[
0
];
GlobalConfig
.
RSServerIP
=
server
.
split
(
":"
)[
0
];
GlobalConfig
.
RSServerPort
=
server
.
split
(
":"
)[
1
];
}
GlobalConfig
.
docServer
=
_data
.
doc
;
GlobalConfig
.
h5_mcu_list
=
_data
.
h5_mcu_list
;
GlobalConfig
.
h5Module
=
_data
.
h5Module
;
...
...
@@ -346,7 +354,7 @@ export default class MessageEntrance extends Emiter {
}
}
//获取会议
所有参数
getClassH5
//获取会议
基本信息
getClassH5
_sassGetClassDetailSuccessHandler
(
_data
)
{
loger
.
log
(
'获取getClassDetail完成.'
);
/* {
...
...
src/GlobalConfig.js
查看文件 @
e2d5525
...
...
@@ -257,6 +257,10 @@ GlobalConfig.MCUServerPort=9003;
GlobalConfig
.
MSServerIP
=
""
;
//推流 播流的地址
GlobalConfig
.
MSServerPort
=
""
;
//m3u8播流地址
GlobalConfig
.
RSServerIP
=
""
;
GlobalConfig
.
RSServerPort
=
""
;
GlobalConfig
.
maxVideoChannels
=
0
;
GlobalConfig
.
maxAudioChannels
=
0
;
GlobalConfig
.
maxMediaChannels
=
0
;
...
...
src/apes/VideoApe.js
查看文件 @
e2d5525
...
...
@@ -59,7 +59,7 @@ class VideoChat extends Ape {
if
(
_param
.
type
==
"m3u8"
)
{
//M3U8 默认用80端口
//http://123.56.73.119/hls/h5dev_403074980_0_983042_1487641745/index.m3u8
path
=
"http://"
+
GlobalConfig
.
M
SServerIP
path
=
"http://"
+
GlobalConfig
.
R
SServerIP
+
"/hls/"
+
_param
.
siteId
+
"_"
+
_param
.
classId
+
"_"
+
_param
.
userId
...
...
@@ -95,12 +95,21 @@ 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
.
siteId
+
"_"
+
GlobalConfig
.
classId
+
"_"
+
GlobalConfig
.
userId
+
"_"
+
freeChannel
+
"_"
+
timestamp
;
let
publishUrl
=
"rtmp://"
+
GlobalConfig
.
MSServerIP
+
port
+
"/
flash
/"
+
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
}};
}
//推流
publishVideo
(
_param
)
{
if
(
_param
==
null
||
_param
.
channelId
==
null
||
_param
.
classId
==
null
||
_param
.
userId
==
null
||
_param
.
siteId
==
null
||
_param
.
timestamp
==
null
)
{
loger
.
warn
(
'publishVideo,参数错误'
,
_param
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_APE_INTERFACE_PARAM_WRONG
);
return
{
"code"
:
1
,
"data"
:
""
};
}
loger
.
log
(
'publishVideo -> maxVideoChannels'
,
GlobalConfig
.
maxVideoChannels
);
//同一个nodeId只允许推一个流,如果已经推了就不能再推
...
...
@@ -109,20 +118,30 @@ class VideoChat extends Ape {
return
;
}
//判断当前是否还有空闲的channle
let
freeChannel
=
this
.
getFreeVideoChannel
();
if
(
freeChannel
==
0
)
{
loger
.
warn
(
"publishVideo,没有空闲的channel "
);
return
{
"code"
:
1
,
"data"
:
"不能再打开更多的设备"
};
}
//判断当前的频道是否已经占用
if
(
this
.
checkChannelIsOpening
(
_param
.
channelId
)){
loger
.
warn
(
_param
.
channelId
,
"频道已经被占用"
);
return
{
"code"
:
1
,
"data"
:
"频道已经被占用!"
};
}
let
channelInfo
=
{};
channelInfo
.
status
=
ApeConsts
.
CHANNEL_STATUS_OPENING
;
channelInfo
.
fromNodeId
=
GlobalConfig
.
nodeId
;
channelInfo
.
channelId
=
freeChannel
;
channelInfo
.
timestamp
=
EngineUtils
.
creatTimestamp
();
channelInfo
.
classId
=
GlobalConfig
.
classId
;
channelInfo
.
channelId
=
_param
.
channelId
;
//freeChannel
channelInfo
.
timestamp
=
_param
.
timestamp
;
//EngineUtils.creatTimestamp();
channelInfo
.
classId
=
_param
.
classId
;
//GlobalConfig.classId;
channelInfo
.
siteId
=
_param
.
siteId
;
//GlobalConfig.siteId;
channelInfo
.
toNodeId
=
0
;
channelInfo
.
mediaType
=
ApeConsts
.
MEDIA_TYPE_VIDEO
;
this
.
sendTableUpdateHandler
(
channelInfo
);
return
{
"code"
:
0
,
"data"
:
"推流成功!"
}
}
//停止推流,
...
...
@@ -330,6 +349,7 @@ class VideoChat extends Ape {
let
packPduModel
=
new
pdu
[
'RCVideoChannelInfoPdu'
];
packPduModel
.
status
=
_param
.
status
||
ApeConsts
.
CHANNEL_STATUS_RELEASED
;
packPduModel
.
channelId
=
_itemIdx
;
packPduModel
.
siteId
=
_param
.
siteId
||
GlobalConfig
.
siteId
;
//GlobalConfig.siteId;
packPduModel
.
classId
=
parseInt
(
_param
.
classId
)
||
parseInt
(
GlobalConfig
.
classId
);
packPduModel
.
mediaType
=
_param
.
mediaType
||
ApeConsts
.
MEDIA_TYPE_VIDEO
;
packPduModel
.
timestamp
=
_param
.
timestamp
||
EngineUtils
.
creatTimestamp
();
...
...
@@ -387,6 +407,20 @@ class VideoChat extends Ape {
}
return
0
;
}
//检查频道是否已经被占用
checkChannelIsOpening
(
_channelId
){
if
(
_channelId
==
null
){
loger
.
warn
(
"checkChannelIsOpening error,channel="
,
_channelId
);
return
true
;
}
let
channelInfo
=
this
.
videoChannels
[
_channelId
];
if
(
channelInfo
==
null
||
channelInfo
.
status
==
ApeConsts
.
CHANNEL_STATUS_RELEASED
){
return
false
;
}
return
true
;
}
}
export
default
VideoChat
;
...
...
请
注册
或
登录
后发表评论