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-01-09 10:51:52 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1d11a47ce9a83ab6b27a1d22c0a3c69f4bf80268
1d11a47c
1 parent
27e53ab7
修改对外接口,修改外部初始化的方法
隐藏空白字符变更
内嵌
并排对比
正在显示
18 个修改的文件
包含
249 行增加
和
207 行删除
dist/main.js
package.json
src/Emiter.js
src/EngineEntrance.js
src/EngineUtils.js
src/EverSocket.js
src/McuClientEngine.js
src/MessageEngine.js
src/MessageTypes.js
src/Sass.js
src/apes/ChatApe.js
src/apes/ConferApe.js
src/apes/DocApe.js
src/apes/VideoApe.js
src/apes/WhiteBoardApe.js
src/index.js
src/mcu.js
webpack.config.umd.js
dist/main.js
查看文件 @
1d11a47
此 diff 太大无法显示。
package.json
查看文件 @
1d11a47
...
...
@@ -31,7 +31,7 @@
"wbp"
:
{
"project"
:
"umd"
,
"entries"
:
{
"main"
:
"./M
essage
Engine.js"
"main"
:
"./M
cuClient
Engine.js"
},
"source"
:
"src/"
,
"build"
:
"dist/"
...
...
src/Emiter.js
查看文件 @
1d11a47
export
default
class
Emiter
{
constructor
()
{
this
.
MAPS
=
{};
...
...
@@ -13,7 +14,7 @@ export default class Emiter {
}
off
(
eid
,
elistener
)
{
if
(
eid
)
{
let
stub
=
this
.
MAPS
[
eid
];
let
stub
=
this
.
MAPS
[
eid
];
if
(
stub
)
{
if
(
elistener
)
{
return
stub
.
splice
(
stub
.
indexOf
(
elistener
),
1
);
...
...
@@ -22,10 +23,11 @@ export default class Emiter {
}
}
}
emit
(
eid
,
data
)
{
_
emit
(
eid
,
data
)
{
if
(
eid
)
{
//eid=* broadcast
let
asteriskStub
=
this
.
MAPS
[
'*'
];
let
asteriskStub
=
this
.
MAPS
[
'*'
];
console
.
log
(
"asteriskStub"
);
if
(
asteriskStub
&&
asteriskStub
.
length
)
{
asteriskStub
.
forEach
(
function
(
elistener
)
{
elistener
(
eid
,
data
);
...
...
src/EngineEntrance.js
0 → 100644
查看文件 @
1d11a47
import
Emiter
from
'./Emiter'
;
import
Sass
from
'Sass'
;
import
Mcu
from
'mcu'
;
import
MessageTypes
from
'MessageTypes'
;
import
Loger
from
'Loger'
;
import
ConferApe
from
'apes/ConferApe'
;
import
ChatApe
from
'apes/ChatApe'
;
import
VideoChat
from
'apes/VideoApe'
;
import
DocApe
from
'apes/DocApe'
;
import
WhiteBoardApe
from
'apes/WhiteBoardApe'
;
import
EngineUtils
from
"EngineUtils"
;
let
loger
=
Loger
.
getLoger
(
'MessageEntrance'
);
let
info
=
{
"version"
:
"v1.0.0"
,
"author"
:
"3mang"
};
let
confInfo
=
{};
let
sass
;
let
mcu
;
let
confer_ape
;
let
chat_ape
;
let
video_ape
;
let
doc_ape
;
let
wb_ape
;
export
default
class
MessageEntrance
extends
Emiter
{
constructor
()
{
super
();
this
.
info
=
info
;
// 应用层会议信息
confInfo
=
{};
// Sass平台层
sass
=
Sass
;
sass
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
sass
.
on
(
sass
.
SUCCESS
,
this
.
_h5SassSuccessHandler
.
bind
(
this
));
// 底层MCU消息层
mcu
=
Mcu
;
mcu
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
mcu
.
on
(
MessageTypes
.
CONFERENCE_JOIN_SUCCESS
,
this
.
_conferenceJoinSuccessHandler
.
bind
(
this
));
// 注册所有应用Ape
confer_ape
=
new
ConferApe
();
confer_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
confer_ape
.
on
(
MessageTypes
.
DOC_SWITCH
,
this
.
docSwitchHandler
.
bind
(
this
));
chat_ape
=
new
ChatApe
();
chat_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
video_ape
=
new
VideoChat
();
video_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
doc_ape
=
new
DocApe
();
doc_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
doc_ape
.
on
(
MessageTypes
.
DOC_UPDATE
,
this
.
docUpdateHandler
.
bind
(
this
));
doc_ape
.
on
(
MessageTypes
.
DOC_DEL
,
this
.
docDeleteHandler
.
bind
(
this
));
wb_ape
=
new
WhiteBoardApe
();
wb_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
_emit
(
type
,
data
));
wb_ape
.
on
(
MessageTypes
.
ANNO_UPDATE
,
this
.
annoUpdateHandler
.
bind
(
this
));
this
.
on
(
MessageTypes
.
DOC_SHOW
,
this
.
docShowHandler
.
bind
(
this
));
this
.
sendChatMsg
=
this
.
_sendChatMsg
;
this
.
joinClass
=
this
.
_joinClass
;
}
// 进入会议
_joinClass
(
_confInfo
)
{
confInfo
=
_confInfo
||
{};
if
(
confInfo
===
null
||
EngineUtils
.
isEmptyObject
(
confInfo
)){
loger
.
log
(
'不能进入会议,传递的参数不对.'
,
_confInfo
);
return
;
}
if
(
sass
){
sass
.
sassChecking
(
_confInfo
);
}
}
// 离开会议
leaveClass
()
{
if
(
mcu
){
mcu
.
leaveMCU
();
}
}
// 通过SASS平台验证
_h5SassSuccessHandler
()
{
loger
.
log
(
'加入底层MCU会议.'
+
confInfo
.
toString
());
if
(
mcu
){
mcu
.
joinMCU
(
confInfo
);
}
}
// MCU 会议成功
_conferenceJoinSuccessHandler
()
{
if
(
sass
){
sass
.
getClassDetail
();
}
}
// 参会处理
conferenceHandler
(
msg_type
)
{
var
msg
=
{
type
:
msg_type
,
data
:
null
};
this
.
_emit
(
msg
.
type
,
msg
);
}
// 发送聊天消息
_sendChatMsg
(
to
,
msg
)
{
if
(
chat_ape
)
{
chat_ape
.
sendChatMsg
(
to
,
msg
);
}
}
// 白板笔记更新
annoUpdateHandler
(
annoInfo
)
{
const
activeDocId
=
confer_ape
.
activeDocId
;
const
docItem
=
doc_ape
.
docList
[
activeDocId
];
if
(
docItem
&&
annoInfo
.
id
==
docItem
.
wbid
)
{
this
.
_emit
(
MessageTypes
.
DOC_ANNO
,
annoInfo
);
}
}
// 文档变更-笔记处理
docShowHandler
(
docItem
)
{
loger
.
log
(
'Doc Show ->'
+
docItem
.
id
+
'|'
+
docItem
.
curPageNo
);
const
annoInfo
=
wb_ape
.
annoInfos
[
docItem
.
wbid
];
if
(
annoInfo
)
{
this
.
_emit
(
MessageTypes
.
DOC_ANNO
,
annoInfo
);
}
else
{
this
.
_emit
(
MessageTypes
.
DOC_ANNO
);
}
}
// 文档切换
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
(
docItem
)
{
loger
.
log
(
'Doc UpdateId ->'
+
docItem
.
id
+
'| activeDocId ->'
+
confer_ape
.
activeDocId
);
if
(
docItem
.
id
==
confer_ape
.
activeDocId
)
{
this
.
_emit
(
MessageTypes
.
DOC_SHOW
,
docItem
);
}
}
//文档删除
docDeleteHandler
(
docItem
){
if
(
docItem
.
id
==
confer_ape
.
activeDocId
)
{
this
.
_emit
(
MessageTypes
.
DOC_DEL
,
docItem
);
}
}
}
//MessageEntrance.MessageTypes = MessageTypes;
...
...
src/EngineUtils.js
0 → 100644
查看文件 @
1d11a47
/**
* Created by hoopoe8 on 2017/1/8.
*/
class
EngineUtils
{
static
isEmptyObject
(
O
){
for
(
var
x
in
O
){
return
false
;
}
return
true
;
}
}
export
default
EngineUtils
;
\ No newline at end of file
...
...
src/EverSocket.js
查看文件 @
1d11a47
...
...
@@ -52,9 +52,9 @@ class EverSocket extends Emiter {
_setConnected
(
isConn
=
true
)
{
this
.
_connected
=
isConn
;
if
(
this
.
_connected
)
{
this
.
emit
(
EverSocket
.
OPEN
);
this
.
_
emit
(
EverSocket
.
OPEN
);
}
else
{
this
.
emit
(
EverSocket
.
CLOSED
);
this
.
_
emit
(
EverSocket
.
CLOSED
);
}
}
...
...
@@ -117,7 +117,7 @@ class EverSocket extends Emiter {
this
.
_lastActiveTime
=
Date
.
now
();
const
bufferData
=
messageEvent
.
data
;
if
(
bufferData
.
byteLength
>
0
)
{
this
.
emit
(
EverSocket
.
MESSAGE
,
bufferData
);
this
.
_
emit
(
EverSocket
.
MESSAGE
,
bufferData
);
}
}
...
...
src/McuClientEngine.js
0 → 100644
查看文件 @
1d11a47
import
EngineEntrance
from
'EngineEntrance'
;
import
MessageTypes
from
'MessageTypes'
;
const
MCU_CLIENT
=
new
EngineEntrance
();
export
function
createMcuClient
()
{
return
MCU_CLIENT
;
}
export
{
MessageTypes
};
...
...
src/MessageEngine.js
已删除
100644 → 0
查看文件 @
27e53ab
import
Emiter
from
'./Emiter'
;
import
h5Sass
from
'Sass'
;
import
mcu
from
'mcu'
;
import
MessageTypes
from
'MessageTypes'
;
import
Loger
from
'Loger'
;
import
ConferApe
from
'apes/ConferApe'
;
import
ChatApe
from
'apes/ChatApe'
;
import
VideoChat
from
'apes/VideoApe'
;
import
DocApe
from
'apes/DocApe'
;
import
WhiteBoardApe
from
'apes/WhiteBoardApe'
;
let
loger
=
Loger
.
getLoger
(
'MessageEngine'
);
export
default
class
MessageEngine
extends
Emiter
{
constructor
()
{
super
();
// 应用层会议信息
this
.
confInfo
=
null
;
// Sass平台层
this
.
h5Sass
=
h5Sass
;
this
.
h5Sass
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
emit
(
type
,
data
));
this
.
h5Sass
.
on
(
h5Sass
.
SUCCESS
,
this
.
_h5SassSuccessHandler
.
bind
(
this
));
// 底层MCU消息层
this
.
mcu
=
mcu
;
this
.
mcu
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
emit
(
type
,
data
));
this
.
mcu
.
on
(
MessageTypes
.
CONFERENCE_JOIN_SUCCESS
,
this
.
_conferenceJoinSuccessHandler
.
bind
(
this
));
// 注册所有应用Ape
this
.
conferApe
=
new
ConferApe
();
this
.
conferApe
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
emit
(
type
,
data
));
this
.
conferApe
.
on
(
MessageTypes
.
DOC_SWITCH
,
this
.
docSwitchHandler
.
bind
(
this
));
this
.
chat_ape
=
new
ChatApe
();
this
.
chat_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
emit
(
type
,
data
));
this
.
video_ape
=
new
VideoChat
();
this
.
video_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
emit
(
type
,
data
));
this
.
doc_ape
=
new
DocApe
();
this
.
doc_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
emit
(
type
,
data
));
this
.
doc_ape
.
on
(
MessageTypes
.
DOC_UPDATE
,
this
.
docUpdateHandler
.
bind
(
this
));
this
.
doc_ape
.
on
(
MessageTypes
.
DOC_DEL
,
this
.
docDeleteHandler
.
bind
(
this
));
this
.
wb_ape
=
new
WhiteBoardApe
();
this
.
wb_ape
.
on
(
'*'
,
(
type
,
data
)
=>
this
.
emit
(
type
,
data
));
this
.
wb_ape
.
on
(
MessageTypes
.
ANNO_UPDATE
,
this
.
annoUpdateHandler
.
bind
(
this
));
this
.
on
(
MessageTypes
.
DOC_SHOW
,
this
.
docShowHandler
.
bind
(
this
));
//this.say = this.say.bind(this)
//this.hello = this.hello.bind(this)
this
.
init
=
this
.
_init
;
}
_init
(
id
)
{
console
.
log
(
"Engine init "
+
id
);
}
// 白板笔记更新
annoUpdateHandler
(
annoInfo
)
{
const
activeDocId
=
this
.
conferApe
.
activeDocId
;
const
docItem
=
this
.
doc_ape
.
docList
[
activeDocId
];
if
(
docItem
&&
annoInfo
.
id
==
docItem
.
wbid
)
{
this
.
emit
(
MessageTypes
.
DOC_ANNO
,
annoInfo
);
}
}
// 文档变更-笔记处理
docShowHandler
(
docItem
)
{
loger
.
log
(
'Doc Show ->'
+
docItem
.
id
+
'|'
+
docItem
.
curPageNo
);
const
annoInfo
=
this
.
wb_ape
.
annoInfos
[
docItem
.
wbid
];
if
(
annoInfo
)
{
this
.
emit
(
MessageTypes
.
DOC_ANNO
,
annoInfo
);
}
else
{
this
.
emit
(
MessageTypes
.
DOC_ANNO
);
}
}
// 文档切换
docSwitchHandler
()
{
const
activeDocId
=
this
.
conferApe
.
activeDocId
;
loger
.
log
(
'Switch Doc Active -> '
+
activeDocId
);
const
docItem
=
this
.
doc_ape
.
docList
[
activeDocId
];
if
(
docItem
)
{
this
.
emit
(
MessageTypes
.
DOC_SHOW
,
docItem
);
}
}
// 文档变更
docUpdateHandler
(
docItem
)
{
loger
.
log
(
'Doc UpdateId ->'
+
docItem
.
id
+
'| activeDocId ->'
+
this
.
conferApe
.
activeDocId
);
if
(
docItem
.
id
==
this
.
conferApe
.
activeDocId
)
{
this
.
emit
(
MessageTypes
.
DOC_SHOW
,
docItem
);
}
}
//文档删除
docDeleteHandler
(
docItem
){
if
(
docItem
.
id
==
this
.
conferApe
.
activeDocId
)
{
this
.
emit
(
MessageTypes
.
DOC_DEL
,
docItem
);
}
}
// MCU 会议成功
_conferenceJoinSuccessHandler
()
{
this
.
h5Sass
.
getClassDetail
();
}
// 通过SASS平台验证
_h5SassSuccessHandler
()
{
loger
.
log
(
'加入底层MCU会议.'
);
this
.
mcu
.
joinMCU
(
this
.
confInfo
);
}
// 进入会议
joinClass
(
_confInfo
)
{
this
.
confInfo
=
_confInfo
;
this
.
h5Sass
.
sassChecking
(
_confInfo
);
}
// 离开会议
leaveClass
()
{
this
.
mcu
.
leaveMCU
();
}
// 参会处理
conferenceHandler
(
msg_type
)
{
var
msg
=
{
type
:
msg_type
,
data
:
null
};
this
.
emit
(
msg
.
type
,
msg
);
}
// 发送聊天消息
sendChatMsg
(
to
,
msg
)
{
if
(
this
.
chat_ape
)
{
this
.
chat_ape
.
sendChatMsg
(
to
,
msg
);
}
}
}
MessageEngine
.
MessageTypes
=
MessageTypes
;
MessageEngine
.
data
=
{
aa
:
"aa"
,
bb
:
11
,
cc
:
"cccc"
};
src/MessageTypes.js
查看文件 @
1d11a47
...
...
@@ -35,16 +35,14 @@ MessageTypes.VIDEO_SHOW = 'video.message';
MessageTypes
.
DOC_SHOW
=
'document.message'
;
MessageTypes
.
DOC_SWITCH
=
'document.switch'
;
MessageTypes
.
DOC_UPDATE
=
'document.update'
;
MessageTypes
.
DOC_DEL
=
'document.delete'
;
MessageTypes
.
DOC_ANNO
=
'document.anno'
;
MessageTypes
.
CHAT_RECEIVE
=
'chat.message'
;
MessageTypes
.
DOC_ANNO
=
'document.anno'
;
MessageTypes
.
ANNO_UPDATE
=
'anno_update'
;
MessageTypes
.
DOC_DEL
=
'document.delete'
;
MessageTypes
.
AUDIO_SHOW
=
'audio.message'
;
export
default
MessageTypes
;
...
...
src/Sass.js
查看文件 @
1d11a47
...
...
@@ -3,10 +3,10 @@ import Loger from 'Loger';
import
MessageTypes
from
'MessageTypes'
;
// 日志对象
const
loger
=
Loger
.
getLoger
(
'
H5
Sass'
);
const
loger
=
Loger
.
getLoger
(
'Sass'
);
let
confInfo
=
{};
class
H5
Sass
extends
Emiter
{
class
Sass
extends
Emiter
{
constructor
()
{
super
();
}
...
...
@@ -14,10 +14,10 @@ class H5Sass extends Emiter {
// Sass校验
sassChecking
(
_confInfo
)
{
loger
.
log
(
'发起Sass校验'
,
_confInfo
);
this
.
confInfo
=
_confInfo
;
confInfo
=
_confInfo
;
// 密码校验
if
(
this
.
confInfo
.
nopassword
===
'true'
)
{
if
(
confInfo
.
nopassword
===
'true'
)
{
return
this
.
sendPWDChecking
();
}
...
...
@@ -27,7 +27,7 @@ class H5Sass extends Emiter {
// 入会校验
sendPWDChecking
()
{
let
url
=
`
http
:
//${
this.confInfo.portal}/3m/getCheckMeetinig.do?siteId=${this.confInfo.siteId}&classId=${this.confInfo.confId}&password=${this.
confInfo.password}`;
let
url
=
`
http
:
//${
confInfo.portal}/3m/getCheckMeetinig.do?siteId=${confInfo.siteId}&classId=${confInfo.confId}&password=${
confInfo.password}`;
loger
.
log
(
'会议密码校验'
,
url
);
fetch
(
url
,
{
timeout
:
5000
...
...
@@ -37,14 +37,14 @@ class H5Sass extends Emiter {
return
ret
.
text
();
}
else
{
loger
.
error
(
`会议密码校验
-
网络异常
.
状态码
:
$
{
ret
.
status
}
`
);
this
.
emit
(
MessageTypes
.
NET_ERROR
);
this
.
_
emit
(
MessageTypes
.
NET_ERROR
);
throw
''
;
}
})
.
then
(
ret
=>
{
if
(
ret
===
'false'
)
{
loger
.
error
(
`会议密码校验
-
失败
.
`
);
return
this
.
emit
(
MessageTypes
.
CONFERENCE_SHOW_WRONG_PASSWORD
);
return
this
.
_
emit
(
MessageTypes
.
CONFERENCE_SHOW_WRONG_PASSWORD
);
}
if
(
ret
===
'true'
)
{
loger
.
log
(
`会议密码校验
-
成功
.
`
);
...
...
@@ -52,17 +52,17 @@ class H5Sass extends Emiter {
return
}
loger
.
error
(
`会议密码校验
-
协议异常
.
`
);
this
.
emit
(
MessageTypes
.
PRO_ERROR
);
this
.
_
emit
(
MessageTypes
.
PRO_ERROR
);
})
.
catch
(
err
=>
{
loger
.
error
(
`会议密码校验
-
异常
.
状态码
:
$
{
err
}
`
);
this
.
emit
(
MessageTypes
.
NET_ERROR
);
this
.
_
emit
(
MessageTypes
.
NET_ERROR
);
});
}
// 发起入会
sendMD5Checking
()
{
let
url
=
`
http
:
//${
this.confInfo.portal}/3m/meeting/md5CheckMeeting.do?siteId=${this.confInfo.siteId}&meetingNumber=${this.confInfo.confId}&userId=${this.confInfo.userId}&userName=${this.confInfo.userName}&userType=${this.confInfo.userType}&nopassword=${this.confInfo.nopassword}&md5=${this.
confInfo.md5}`;
let
url
=
`
http
:
//${
confInfo.portal}/3m/meeting/md5CheckMeeting.do?siteId=${confInfo.siteId}&meetingNumber=${confInfo.confId}&userId=${confInfo.userId}&userName=${confInfo.userName}&userType=${confInfo.userType}&nopassword=${confInfo.nopassword}&md5=${
confInfo.md5}`;
loger
.
log
(
'H5SassMD5校验'
,
url
);
...
...
@@ -74,7 +74,7 @@ class H5Sass extends Emiter {
return
ret
.
json
();
}
else
{
loger
.
error
(
`
H5SassMD5
校验
-
网络异常
.
状态码
:
$
{
ret
.
status
}
`
);
this
.
emit
(
MessageTypes
.
NET_ERROR
);
this
.
_
emit
(
MessageTypes
.
NET_ERROR
);
throw
''
;
}
})
...
...
@@ -82,28 +82,31 @@ class H5Sass extends Emiter {
if
(
ret
.
flag
==
"true"
)
{
if
(
ret
.
h5_mcu_list
)
{
let
server
=
ret
.
h5_mcu_list
.
split
(
";"
)[
0
];
this
.
confInfo
.
MCUServerIP
=
server
.
split
(
":"
)[
0
];
this
.
confInfo
.
MCUServerPort
=
server
.
split
(
":"
)[
1
];
confInfo
.
MCUServerIP
=
server
.
split
(
":"
)[
0
];
confInfo
.
MCUServerPort
=
server
.
split
(
":"
)[
1
];
}
this
.
confInfo
.
maxVideoChannels
=
ret
.
maxVideoChannels
;
this
.
confInfo
.
maxAudioChannels
=
ret
.
maxAudioChannels
;
this
.
confInfo
.
maxMediaChannels
=
this
.
confInfo
.
maxVideoChannels
+
this
.
confInfo
.
maxAudioChannels
;
console
.
log
(
ret
);
confInfo
.
maxVideoChannels
=
ret
.
maxVideoChannels
;
confInfo
.
maxAudioChannels
=
ret
.
maxAudioChannels
;
confInfo
.
maxMediaChannels
=
confInfo
.
maxVideoChannels
+
confInfo
.
maxAudioChannels
;
loger
.
log
(
'H5Sass校验完成'
);
this
.
emit
(
H5Sass
.
SUCCESS
);
this
.
_emit
(
Sass
.
SUCCESS
);
}
else
{
loger
.
log
(
'H5SassMD5校验-失败.'
);
this
.
emit
(
MessageTypes
.
CONFERENCE_JOIN_FAILED
);
this
.
_
emit
(
MessageTypes
.
CONFERENCE_JOIN_FAILED
);
}
})
.
catch
(
err
=>
{
loger
.
error
(
`
H5SassMD5
校验
-
异常
.
状态码
:
$
{
err
}
`
);
this
.
emit
(
MessageTypes
.
NET_ERROR
);
this
.
_emit
(
MessageTypes
.
NET_ERROR
);
console
.
log
(
"aaaaaaaaaaaaaaaaaaa"
);
});
}
// 获取会议详情
getClassDetail
()
{
let
url
=
`
http
:
//${
this.confInfo.portal}/3m/meeting/getClassH5.do?classNumber=${this.
confInfo.confId}`;
let
url
=
`
http
:
//${
confInfo.portal}/3m/meeting/getClassH5.do?classNumber=${
confInfo.confId}`;
loger
.
log
(
'H5Sass获取Class详情.'
,
url
);
...
...
@@ -115,27 +118,27 @@ class H5Sass extends Emiter {
return
ret
.
json
();
}
else
{
loger
.
error
(
`
H5Sass
获取
Class
详情
-
网络异常
.
状态码
:
$
{
ret
.
status
}
`
);
this
.
emit
(
MessageTypes
.
NET_ERROR
);
this
.
_
emit
(
MessageTypes
.
NET_ERROR
);
throw
''
;
}
})
.
then
(
ret
=>
{
if
(
ret
.
errorCode
===
0
)
{
loger
.
log
(
'H5Sass获取Class详情完成'
);
this
.
emit
(
MessageTypes
.
CONFERENCE_SHOW_DETAIL
,
ret
);
this
.
_
emit
(
MessageTypes
.
CONFERENCE_SHOW_DETAIL
,
ret
);
}
else
{
loger
.
warn
(
'H5Sass获取Class详情失败.'
);
this
.
emit
(
MessageTypes
.
NET_ERROR
);
this
.
_
emit
(
MessageTypes
.
NET_ERROR
);
}
})
.
catch
(
err
=>
{
loger
.
error
(
`
H5Sass
获取
Class
详情异常
.
状态码
:
$
{
err
}
`
);
this
.
emit
(
MessageTypes
.
NET_ERROR
);
this
.
_
emit
(
MessageTypes
.
NET_ERROR
);
});
}
}
H5Sass
.
prototype
.
SUCCESS
=
H5
Sass
.
SUCCESS
=
'h5sass.success'
;
Sass
.
prototype
.
SUCCESS
=
Sass
.
SUCCESS
=
'h5sass.success'
;
export
default
new
H5
Sass
;
export
default
new
Sass
;
...
...
src/apes/ChatApe.js
查看文件 @
1d11a47
...
...
@@ -18,7 +18,7 @@ import ApeConsts from './ApeConsts';
import
pdu
from
'pdu'
;
import
Loger
from
'Loger'
;
import
MessageTypes
from
'MessageTypes'
;
import
EngineUtils
from
"EngineUtils"
;
let
loger
=
Loger
.
getLoger
(
'ChatApe'
);
class
ChatApe
extends
Ape
{
...
...
@@ -43,11 +43,16 @@ class ChatApe extends Ape {
}
sendChatMsg
(
to
,
message
)
{
if
(
this
.
_confInfo
===
null
||
EngineUtils
.
isEmptyObject
(
this
.
_confInfo
)){
loger
.
log
(
'发送聊天消息.'
,
to
,
message
,
"Engine 还未初始化数据!"
);
return
;
}
loger
.
log
(
'发送聊天消息.'
,
to
,
message
);
let
chatSendPdu
=
new
pdu
[
'RCChatSendDataRequestPdu'
];
chatSendPdu
.
type
=
pdu
.
RCPDU_CHAT_SEND_DATA_REQUEST
;
chatSendPdu
.
initiator
=
this
.
_confInfo
.
nodeId
;
chatSendPdu
.
peer
=
to
;
chatSendPdu
.
initiator
=
this
.
_confInfo
.
nodeId
;
//发起人
chatSendPdu
.
peer
=
to
;
//发送给谁
chatSendPdu
.
isPublic
=
true
;
chatSendPdu
.
userData
=
this
.
_rCArrayBufferUtil
.
strToUint8Array
(
"h5"
+
message
);
chatSendPdu
.
fromName
=
this
.
_rCArrayBufferUtil
.
strToUint8Array
(
"h5"
+
this
.
_confInfo
.
userName
);
...
...
@@ -71,7 +76,7 @@ class ChatApe extends Ape {
loger
.
log
(
'接受聊天消息.'
,
chatMsg
);
this
.
emit
(
MessageTypes
.
CHAT_RECEIVE
,
chatMsg
);
this
.
_
emit
(
MessageTypes
.
CHAT_RECEIVE
,
chatMsg
);
}
}
...
...
src/apes/ConferApe.js
查看文件 @
1d11a47
...
...
@@ -97,7 +97,7 @@ class ConferApe extends Ape {
if
(
tabTypeMatches
.
length
>
1
&&
tabTypeMatches
[
1
]
==
'show.docsharing'
)
{
if
(
tabInfo
.
match
(
/<visible>
(
.+
)
<
\/
visible>/
)[
1
]
==
'true'
)
{
this
.
activeDocId
=
tabInfo
.
match
(
/<TabID>
(
.+
)
<
\/
TabID>/
)[
1
];
this
.
emit
(
MessageTypes
.
DOC_SWITCH
,
this
.
activeDocId
);
this
.
_
emit
(
MessageTypes
.
DOC_SWITCH
,
this
.
activeDocId
);
}
}
}
catch
(
e
)
{
...
...
@@ -135,12 +135,12 @@ class ConferApe extends Ape {
this
.
emitRosterChange
();
// 自己退出
if
(
nodeId
==
this
.
_confInfo
.
nodeId
)
{
this
.
emit
(
MessageTypes
.
CONFERENCE_EXIT
);
this
.
_
emit
(
MessageTypes
.
CONFERENCE_EXIT
);
}
}
emitRosterChange
()
{
this
.
emit
(
MessageTypes
.
CONFERENCE_SHOW_ROSTER_NUM
,
Object
.
keys
(
this
.
rosters
).
length
);
this
.
_
emit
(
MessageTypes
.
CONFERENCE_SHOW_ROSTER_NUM
,
Object
.
keys
(
this
.
rosters
).
length
);
}
}
...
...
src/apes/DocApe.js
查看文件 @
1d11a47
...
...
@@ -46,7 +46,7 @@ class DocApe extends Ape {
tableDeleteHandler
(
tableId
,
record
){
const
re
=
{};
re
.
type
=
ApeConsts
.
DOCUMENT_DEL
;
this
.
emit
(
MessageTypes
.
DOC_DEL
,
re
);
this
.
_
emit
(
MessageTypes
.
DOC_DEL
,
re
);
}
tableUpdateHandler
(
owner
,
recordId
,
recordData
)
{
try
{
...
...
@@ -65,7 +65,7 @@ class DocApe extends Ape {
recordInfo
.
loadURL
=
`
$
{
recordInfo
.
namePath
}
/${recordInfo.curPageNo}.jpg`
;
}
this
.
docList
[
recordId
]
=
recordInfo
;
this
.
emit
(
MessageTypes
.
DOC_UPDATE
,
recordInfo
);
this
.
_
emit
(
MessageTypes
.
DOC_UPDATE
,
recordInfo
);
loger
.
log
(
'Doc update ->'
+
recordId
);
}
catch
(
e
)
{
loger
.
warn
(
'Doc Table Update Decode包异常'
);
...
...
src/apes/VideoApe.js
查看文件 @
1d11a47
...
...
@@ -60,7 +60,7 @@ class VideoChat extends Ape {
// this._notify(RCApeEvent.E_VIDEO_DATA, videoReceivePdu.sessionId, videoReceivePdu.channelId, video_data);
loger
.
log
(
'接受视频消息.'
,
video_data
);
this
.
emit
(
MessageTypes
.
VIDEO_SHOW
,
video_data
);
this
.
_
emit
(
MessageTypes
.
VIDEO_SHOW
,
video_data
);
}
...
...
@@ -101,7 +101,7 @@ class VideoChat extends Ape {
}
emitVideoChange
()
{
this
.
emit
(
MessageTypes
.
VIDEO_SHOW
,
{
this
.
_
emit
(
MessageTypes
.
VIDEO_SHOW
,
{
activeChannelId
:
this
.
activeChannelId
,
HLSURL
:
this
.
activeURL
,
});
...
...
src/apes/WhiteBoardApe.js
查看文件 @
1d11a47
...
...
@@ -63,7 +63,7 @@ class WhiteBoardApe extends Ape {
svg
:
UTF8
.
getStringFromBytes
(
uncompressedBytes
)
};
this
.
annoInfos
[
recordId
]
=
annoInfo
;
this
.
emit
(
MessageTypes
.
ANNO_UPDATE
,
annoInfo
);
this
.
_
emit
(
MessageTypes
.
ANNO_UPDATE
,
annoInfo
);
}
else
{
loger
.
log
(
'白板动作忽略,类型:'
,
ApeConsts
(
recordInfo
.
type
));
}
...
...
src/index.js
查看文件 @
1d11a47
...
...
@@ -22,5 +22,5 @@ import dfjsd from 'Loger';
import
fdsfds
from
'mcu'
;
import
alexwang
from
'
MessageEngin
e.js'
;
import
alexwang
from
'
EngineEntranc
e.js'
;
...
...
src/mcu.js
查看文件 @
1d11a47
...
...
@@ -83,10 +83,10 @@ class MCU extends Emiter {
switch
(
pduResultCode
)
{
case
PduConsts
.
RET_SUCCESS
:
this
.
_updateMCUConfInfoDesc
(
joinConfPdu
.
get
(
"confDesc"
));
this
.
emit
(
MessageTypes
.
CONFERENCE_JOIN_SUCCESS
,
this
.
confInfo
);
this
.
_
emit
(
MessageTypes
.
CONFERENCE_JOIN_SUCCESS
,
this
.
confInfo
);
break
;
case
PduConsts
.
RET_FULL_CAPACITY
:
this
.
emit
(
MessageTypes
.
CONFERENCE_JOIN_FULL
);
this
.
_
emit
(
MessageTypes
.
CONFERENCE_JOIN_FULL
);
break
;
default
:
loger
.
warn
(
'JoinConfPdu-未知类型-等待处理.'
,
pduResultCode
);
...
...
@@ -98,7 +98,7 @@ class MCU extends Emiter {
if
(
ape
)
{
let
subTypeLabel
=
pdu
.
id2type
(
pduMsg
.
subType
);
loger
.
log
(
'MCU-SecondLayer封装消息'
,
'sessionId'
,
sessionLabel
,
pduMsg
.
sessionId
,
'subtype'
,
subTypeLabel
,
pduMsg
.
subType
);
ape
.
emit
(
pduMsg
.
subType
,
pduMsg
.
data
);
ape
.
_
emit
(
pduMsg
.
subType
,
pduMsg
.
data
);
}
else
{
loger
.
warn
(
sessionLabel
+
'尚未注册'
);
}
...
...
webpack.config.umd.js
查看文件 @
1d11a47
...
...
@@ -2,7 +2,7 @@ module.exports = function (umdConf) {
umdConf
.
devServer
.
host
=
'0.0.0.0'
;
//umdConf.webpackFeatures.enableEntryHTML();//生成
umdConf
.
output
.
publicPath
=
''
;
umdConf
.
output
.
library
=
'M
essage
Engine'
;
umdConf
.
output
.
library
=
'M
CUClient
Engine'
;
//console.dir(umdConf);
...
...
请
注册
或
登录
后发表评论