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
54815f50e3601b8b836cfdd6e288add7bb88bfcc
54815f50
1 parent
96ebd6ef
修改选点和录制回放
隐藏空白字符变更
内嵌
并排对比
正在显示
13 个修改的文件
包含
140 行增加
和
113 行删除
dist/McuClient.js
src/EngineEntrance.js
src/MessageTypes.js
src/RecordPlayBackParse.js
src/Sass.js
src/ServerCheck.js
src/apes/Ape.js
src/apes/DocApe.js
src/apes/MediaModule.js
src/apes/VideoApe.js
src/apes/WhiteBoardApe.js
src/pdus/PduType.js
src/pdus/pro.js
dist/McuClient.js
查看文件 @
54815f5
此 diff 太大无法显示。
src/EngineEntrance.js
查看文件 @
54815f5
...
...
@@ -26,7 +26,7 @@ import ArrayBufferUtil from 'libs/ArrayBufferUtil';
import
UTF8
from
'utf-8'
;
let
loger
=
Loger
.
getLoger
(
'MessageEntrance'
);
let
_sdkInfo
=
{
"version"
:
"v.1.8.
1.20170327-5
"
,
"author"
:
"www.3mang.com"
};
let
_sdkInfo
=
{
"version"
:
"v.1.8.
3.20170329-4
"
,
"author"
:
"www.3mang.com"
};
//APE
let
_sass
;
...
...
@@ -165,6 +165,7 @@ export default class MessageEntrance extends Emiter {
this
.
sendDocumentSwitchDoc
=
this
.
_sendDocumentSwitchDoc
.
bind
(
this
);
//切换文档
this
.
sendDocumentSwitchPage
=
this
.
_sendDocumentSwitchPage
.
bind
(
this
);
//翻页
this
.
sendDocumentDelete
=
this
.
_sassDeleteDocument
.
bind
(
this
);
this
.
sendDocBroadcastMsg
=
this
.
_sendDocBroadcastMsg
.
bind
(
this
);
//删除文档,先通过Sass删除,sass删除成功之后再同步mcu
//this.sendDocumentDeleteAll= this._documentDeleteAll;//删除所有文档
this
.
sendDocumentCommand
=
this
.
_sendDocumentCommand
.
bind
(
this
);
...
...
@@ -173,8 +174,12 @@ export default class MessageEntrance extends Emiter {
//获取文档图片的完整路径
this
.
getDocPDFFullPath
=
this
.
_getDocPDFFullPath
.
bind
(
this
);
//获取文档的完整路径
this
.
setDebuger
=
this
.
_setDebuger
.
bind
(
this
);
//debug
}
_setDebuger
(
_data
){
GlobalConfig
.
isDebuger
=
_data
.
isDebuger
||
true
;
}
//mcu异常监听
_mcuErrorHandler
(
_data
,
_option
)
{
let
option
=
_option
||
""
;
...
...
@@ -649,6 +654,15 @@ export default class MessageEntrance extends Emiter {
}
}
_sendDocBroadcastMsg
(
_param
){
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
sendDocBroadcastMsg
(
_param
);
}
}
//Sass删除文档成功之后,同步删除MCU数据
_sassDeleteDocumentSuccess
(
_param
)
{
loger
.
log
(
'sassDeleteDocumentSuccess'
,
_param
);
...
...
@@ -987,7 +1001,7 @@ export default class MessageEntrance extends Emiter {
//// 文档变更,白板也需要做处理
docUpdateHandler
(
_data
)
{
if
(
!
_mcu
.
connected
)
{
if
(
!
_mcu
.
connected
&&!
GlobalConfig
.
isRecordPlayBack
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
...
...
@@ -1007,39 +1021,30 @@ export default class MessageEntrance extends Emiter {
//文档加入频道成功,同步到MCU服务器上的数据
docJoinChannelSuccess
()
{
loger
.
log
(
"docJoinChannelSuccess isHost="
,
GlobalConfig
.
isHost
);
loger
.
log
(
GlobalConfig
.
docListPrepare
);
loger
.
log
(
"docJoinChannelSuccess docListPrepare="
);
loger
.
log
(
"docJoinChannelSuccess->isHost="
,
GlobalConfig
.
isHost
,
"length="
,
GlobalConfig
.
docListPrepare
.
length
);
//loger.log("docJoinChannelSuccess docListPrepare=");
//如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
if
(
GlobalConfig
.
isHost
)
{
for
(
let
value
of
GlobalConfig
.
docListPrepare
)
{
if
(
GlobalConfig
.
isHost
&&
GlobalConfig
.
docListPrepare
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
GlobalConfig
.
docListPrepare
.
length
;
i
++
)
{
let
value
=
GlobalConfig
.
docListPrepare
[
i
];
if
(
value
)
{
//loger.log("判断是否需要把提前上传的文档上传到mcu", value);
let
paramInfo
=
{
"pageNum"
:
value
.
pdfSize
,
"fileName"
:
value
.
name
,
"fileType"
:
value
.
type
,
"relativeUrl"
:
value
.
relativeLocation
,
"url"
:
value
.
absoluteLocation
,
"creatUserId"
:
value
.
createUserID
,
"docId"
:
value
.
id
,
"md5"
:
value
.
MD5
,
"visible"
:
false
};
this
.
_sendDocumentUpload
(
paramInfo
);
}
}
/* for (let value of GlobalConfig.docListPrepare) {
if (value) {
/* //提前上传的文档文档信息的结构
{
"MD5": "f3feb3fac8cd3a953bded00e07a0c66b",
"absoluteLocation": "http://101.200.150.192/DocSharing/data/526661904/20170203-115400026/f3feb3fac8cd3a953bded00e07a0c66b.swf",
"createUserID": "972",
"createUserIP": "114.241.81.175",
"createUserName": "base",
"dynamicPPT": 0,
"dynamicTransferStatic": "",
"id": "8ab3b0ed5a00f2fa015a0219a3df016c",
"meetingNumber": "",
"name": "McuClient_v.1.0.1_API.pdf",
"orderStr": "",
"pdfSize": 5,
"processEndTime": "2017-02-03 11:54:31",
"processRate": 0,
"processStartTime": "2017-02-03 11:54:27",
"relativeLocation": "/DocSharing/data/526661904/20170203-115400026/f3feb3fac8cd3a953bded00e07a0c66b.swf",
"siteID": "h5test",
"size": 360920,
"status": 3,
"type": "pdf",
"uploadEndTime": "2017-02-03 11:54:27",
"uploadStartTime": "2017-02-03 11:54:27"
}*/
loger.log("判断是否需要把提前上传的文档上传到mcu", value);
let paramInfo = {
"pageNum": value.pdfSize,
...
...
@@ -1055,7 +1060,7 @@ export default class MessageEntrance extends Emiter {
this._sendDocumentUpload(paramInfo);
}
}
}
*/
}
}
...
...
src/MessageTypes.js
查看文件 @
54815f5
...
...
@@ -50,6 +50,8 @@ MessageTypes.AUDIO_BROADCAST= "audio_broadcast";//'audio.broadcast';
//文档模块事件定义
MessageTypes
.
DOC_DELETE
=
"document_delete"
;
//'document.delete';//删除文档
MessageTypes
.
DOC_UPDATE
=
"document_update"
;
// 'document.update';//更新文档(添加、变更)
MessageTypes
.
DOC_BROADCAST
=
"doc_broadcast"
;
//
//MessageTypes.DOC_SHOW = 'document.show';
//MessageTypes.DOC_UPLOAD='document.upload';//上传文档
//MessageTypes.DOC_COMMAND='document.command';//操作文档
...
...
src/RecordPlayBackParse.js
查看文件 @
54815f5
...
...
@@ -131,7 +131,7 @@ class RecordPlayBackParse extends Emiter {
pduMsg
.
type
=
PduType
.
RCPDU_SEND_DATA_REQUEST
;
pduType
=
PduType
.
RCPDU_SEND_DATA_REQUEST
;
}
loger
.
log
(
'pduType'
,
pduType
);
//
loger.log('pduType', pduType);
switch
(
pduType
)
{
case
PduType
.
RCPDU_CONNECT_PROVIDER_RESPONSE
:
//加入课堂请求返回数据处理
...
...
@@ -157,7 +157,7 @@ class RecordPlayBackParse extends Emiter {
let
ape
=
this
.
_apes
[
pduMsg
.
sessionId
];
let
sessionLabel
=
ApeConsts
(
pduMsg
.
sessionId
);
//只做解析存储,不对外发送
loger
.
log
(
'解析数据-timestamp->'
,
timestamp
,
'sessionId->'
,
pduMsg
.
sessionId
,
'sessionLabel->'
,
sessionLabel
);
//
loger.log('解析数据-timestamp->', timestamp, 'sessionId->', pduMsg.sessionId, 'sessionLabel->', sessionLabel);
switch
(
pduMsg
.
sessionId
)
{
case
ApeConsts
.
CONFERENCE_SESSION_ID
:
this
.
saveParseData
(
data
,
timestamp
,
this
.
_conferApeMssages
);
...
...
@@ -226,12 +226,12 @@ class RecordPlayBackParse extends Emiter {
this
.
_emit
(
MessageTypes
.
CLASS_UPDATE_TIMER
,
{
"classTimestamp"
:
this
.
_recordPlaybackTimestamp
});
//各个APE模块根据时间查找消息数据
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_conferApeMssages
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_chatApeMssages
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_docApeMssages
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_whiteApeMssages
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_videoApeMssages
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_audioApeMssages
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_conferApeMssages
,
"conferApe"
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_chatApeMssages
,
"chatApe"
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_docApeMssages
,
"docApe"
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_whiteApeMssages
,
"whiteApe"
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_videoApeMssages
,
"videoAp"
);
this
.
_searchMessageFromTime
(
this
.
_recordPlaybackTimestamp
,
this
.
_audioApeMssages
,
"audioApe"
);
}
//加载录制文件
...
...
@@ -322,12 +322,13 @@ class RecordPlayBackParse extends Emiter {
}
//根据时间查找数据
_searchMessageFromTime
(
_timestamp
,
_apeMessages
)
{
_searchMessageFromTime
(
_timestamp
,
_apeMessages
,
_ape
)
{
let
msgDataArr
=
_apeMessages
[
_timestamp
];
if
(
!
msgDataArr
)
{
//没有数据,需要查找当前时间点属于哪一个时间戳关键帧
}
else
{
//把时间点对应的数据发送,同一秒内有存在多个数据的情况
loger
.
log
(
_ape
,
"回放数据->"
,
msgDataArr
.
length
)
for
(
let
i
=
0
;
i
<
msgDataArr
.
length
;
i
++
)
{
this
.
_everSocketMsgReceivedHandler
(
msgDataArr
[
i
].
byteData
,
0
);
}
...
...
@@ -440,12 +441,14 @@ class RecordPlayBackParse extends Emiter {
let
counter
=
0
;
let
messageItem
;
let
keyFrameSeek
=
0
;
//let mssageArr=[];
for
(
let
i
=
this
.
_recordPlaybackTimestamp
;
i
>
0
;
i
--
)
{
messageItem
=
_apeMessages
[
i
];
if
(
messageItem
)
{
//把时间点对应的数据发送,同一秒内有存在多个数据的情况
for
(
let
i
=
0
;
i
<
messageItem
.
length
;
i
++
)
{
this
.
_everSocketMsgReceivedHandler
(
messageItem
[
i
].
byteData
,
0
);
//mssageArr.push(messageItem[i].byteData);
counter
++
;
if
(
counter
>
30
){
loger
.
warn
(
"SEEK->最多处理历史消息30条"
);
...
...
@@ -454,7 +457,13 @@ class RecordPlayBackParse extends Emiter {
}
}
}
////mssageArr记录的数据是按时间最大排序的,发消息的时候需要从时间小的开始,倒着发数据
//let len=mssageArr.length;
//if(len>0){
// for (let k=len-1;k>0;k--){
// this._everSocketMsgReceivedHandler(mssageArr[k], 0);
// }
//}
}
}
...
...
src/Sass.js
查看文件 @
54815f5
...
...
@@ -419,7 +419,7 @@ class Sass extends Emiter {
let
url
=
`
http
:
//${GlobalConfig.portal}/3m/recordingMeeting/insertRecordingMeeting.do?siteID=${siteID}&meetingID=${meetingID}&userID=${userID}&userName=${userName}&meetingName=${meetingName}&startTime=${startTime}&endTime=${endTime}&playUrl=${playUrl}&streamName=${streamName}&downloadUrl=${downloadUrl}&configFile=${confRecordFileName}×tamp=${timestamp}&recordTimestamp=${recordTimestamp}&authId=${authId}`;
loger
.
log
(
'saveClassRecordContrlInfo'
,
url
);
fetch
(
url
,
{
fetch
(
encodeURI
(
url
)
,
{
timeout
:
5000
})
.
then
(
ret
=>
{
...
...
@@ -441,7 +441,6 @@ class Sass extends Emiter {
.
catch
(
err
=>
{
loger
.
error
(
`保存开始录制信息异常
.
状态码
:
$
{
err
}
`
);
});
}
}
...
...
src/ServerCheck.js
查看文件 @
54815f5
...
...
@@ -21,7 +21,7 @@ let tempMcuIp="";
let
tempMcuPort
=
""
;
let
tempMsIp
=
""
;
let
tempMsPort
=
""
;
let
msDefaultPort
=
"
:
1935"
;
let
msDefaultPort
=
"1935"
;
let
mcuDefaultPort
=
"7777"
;
let
speedTestPort
=
':5555'
;
//测速端口统一
...
...
@@ -51,14 +51,14 @@ class ServerCheck extends Emiter {
let
md5Str
=
MD5
(
"addr="
+
ip
+
"&token=b657c3507b324353e09c1958ee956a98efceb3e3"
);
//("addr=" + ip + "&token=b657c3507b324353e09c1958ee956a98efceb3e3"),转成MD5
let
timestamp
=
new
Date
().
getTime
();
let
location
=
`
http
:
//ipapi.ipip.net/find?addr=${ip}&sid=14&uid=5237&sig=${md5Str}&_=${timestamp}`;
loger
.
log
(
'获取IP信息 '
,
userIp
,
location
);
//
loger.log('获取IP信息 ', userIp, location);
fetchJsonp
(
location
,
{
timeout
:
timeOutDelay
,
}).
then
(
function
(
response
)
{
return
response
.
json
()
}).
then
(
function
(
json
)
{
loger
.
log
(
'获取IP信息返回'
,
json
)
//
loger.log('获取IP信息返回', json)
if
(
json
)
{
userIpInfo
.
ret
=
json
.
ret
;
userIpInfo
.
country
=
json
.
data
[
0
];
//国家
...
...
@@ -68,31 +68,31 @@ class ServerCheck extends Emiter {
}
this
.
serverGetUserIpInfoCallback
(
userIpInfo
);
}.
bind
(
this
)).
catch
(
function
(
ex
)
{
loger
.
log
(
'获取IP信息失败'
,
ex
.
message
)
//
loger.log('获取IP信息失败', ex.message)
this
.
serverGetUserIpInfoCallback
(
userIpInfo
);
}.
bind
(
this
));
}
//获取ip信息返回
serverGetUserIpInfoCallback
(
userIpInfo
)
{
loger
.
log
(
"获取IP详情,开始处理"
,
userIpInfo
);
//
loger.log("获取IP详情,开始处理", userIpInfo);
if
(
userIpInfo
.
ret
==
"ok"
)
{
GlobalConfig
.
country
=
userIpInfo
.
country
;
//国家
GlobalConfig
.
city
=
userIpInfo
.
city
;
//城市
GlobalConfig
.
province
=
userIpInfo
.
province
;
//服务商
GlobalConfig
.
isp
=
userIpInfo
.
isp
;
//服务商
loger
.
log
(
"获取ip详情成功,country:"
+
GlobalConfig
.
country
+
",city:"
+
GlobalConfig
.
city
+
",isp:"
+
GlobalConfig
.
isp
);
//
loger.log("获取ip详情成功,country:" + GlobalConfig.country + ",city:" + GlobalConfig.city + ",isp:" + GlobalConfig.isp);
this
.
_chooseBestIpFromServer
();
}
else
{
loger
.
log
(
"获取ip详情失败"
);
//
loger.log("获取ip详情失败");
this
.
_chooseBestIpFromSassParam
();
}
}
//从IPIP服务列表中选择最快的IP
_chooseBestIpFromServer
()
{
loger
.
log
(
"从Server服务列表中选择最快的IP"
);
//
loger.log("从Server服务列表中选择最快的IP");
isRequestMcuCallback
=
false
;
isRequestMsCallback
=
false
;
isTestFromServer
=
true
;
...
...
@@ -130,7 +130,7 @@ class ServerCheck extends Emiter {
}
//从Sass返回的msList mcuList中选点
_chooseBestIpFromSassParam
()
{
loger
.
log
(
"从Sass服务列表中选择最快的IP"
);
//
loger.log("从Sass服务列表中选择最快的IP");
isRequestMcuCallback
=
false
;
isRequestMsCallback
=
false
;
isTestFromSass
=
false
;
...
...
@@ -157,7 +157,7 @@ class ServerCheck extends Emiter {
//获取最快的MCU服务器地址,参数是一个ip数组
getBestMcuServer
(
_param
)
{
loger
.
log
(
'开始MCU选点 '
,
_param
);
//
loger.log('开始MCU选点 ', _param);
if
(
_param
==
null
||
_param
.
length
<
1
){
this
.
_getBestMcuServerCallbackHandler
(
""
)
return
;
...
...
@@ -167,7 +167,7 @@ class ServerCheck extends Emiter {
loger
.
warn
(
'getBestMcuServer -> nothing!'
);
this
.
_getBestMcuServerCallbackHandler
(
""
)
}
else
{
//
loger.log('getBestMcuServer done -> ', fatest_ip_response);
loger
.
log
(
'getBestMcuServer done -> '
,
fatest_ip_response
);
this
.
_getBestMcuServerCallbackHandler
(
fatest_ip_response
)
}
}.
bind
(
this
),
timeOutDelay
);
...
...
@@ -175,7 +175,7 @@ class ServerCheck extends Emiter {
//获取最快的MS服务器地址,参数是一个ip数组
getBestMsServer
(
_param
)
{
loger
.
log
(
'开始MS选点 '
,
_param
);
//
loger.log('开始MS选点 ', _param);
if
(
_param
==
null
||
_param
.
length
<
1
){
this
.
_getBestMsServerCallbackHandler
(
""
)
return
;
...
...
@@ -185,16 +185,16 @@ class ServerCheck extends Emiter {
loger
.
warn
(
'getBestMsServer -> nothing!'
);
this
.
_getBestMsServerCallbackHandler
(
""
);
}
else
{
//
loger.log('getBestMsServer done -> ', fatest_ip_response);
loger
.
log
(
'getBestMsServer done -> '
,
fatest_ip_response
);
this
.
_getBestMsServerCallbackHandler
(
fatest_ip_response
);
}
}.
bind
(
this
),
timeOutDelay
);
}
_getBestMcuServerCallbackHandler
(
_data
)
{
loger
.
log
(
"MCU选点返回1"
,
_data
);
//
loger.log("MCU选点返回1", _data);
if
(
isRequestMcuCallback
)
{
loger
.
log
(
"MCU选点,已经有返回"
);
//
loger.log("MCU选点,已经有返回");
return
;
}
isRequestMcuCallback
=
true
;
...
...
@@ -211,14 +211,14 @@ class ServerCheck extends Emiter {
}
}
}
loger
.
log
(
"MCU选点返回2"
,
tempMcuIp
,
tempMcuPort
);
//
loger.log("MCU选点返回2",tempMcuIp,tempMcuPort);
this
.
_startConnectMcu
();
}
_getBestMsServerCallbackHandler
(
_data
)
{
loger
.
log
(
"MS选点返回1"
,
_data
);
//
loger.log("MS选点返回1", _data);
if
(
isRequestMsCallback
)
{
loger
.
log
(
"_getBestMsServerCallbackHandler,已经有返回"
);
//
loger.log("_getBestMsServerCallbackHandler,已经有返回");
return
;
}
isRequestMsCallback
=
true
;
...
...
@@ -229,13 +229,13 @@ class ServerCheck extends Emiter {
}
tempMsPort
=
msDefaultPort
;
for
(
let
i
=
0
;
i
<
checkMsIpGroup
.
length
;
i
++
){
if
(
tempMs
Port
==
checkMsIpGroup
[
i
].
ip
){
if
(
tempMs
Ip
==
checkMsIpGroup
[
i
].
ip
){
tempMsPort
=
checkMsIpGroup
[
i
].
port
||
msDefaultPort
;
break
;
}
}
}
loger
.
log
(
"MS选点返回2"
,
tempMsIp
,
tempMsPort
);
//
loger.log("MS选点返回2", tempMsIp,tempMsPort);
this
.
_startConnectMcu
();
}
...
...
@@ -251,7 +251,7 @@ class ServerCheck extends Emiter {
GlobalConfig
.
MCUServerPort
=
tempMcuPort
;
GlobalConfig
.
MSServerIP
=
tempMsIp
;
GlobalConfig
.
MSServerPort
=
tempMsPort
;
loger
.
log
(
"Server选点完成"
,
"mcu-->"
,
GlobalConfig
.
MCUServerIP
,
GlobalConfig
.
MCUServerPort
,
"ms---->"
,
GlobalConfig
.
MSServerIP
,
GlobalConfig
.
MSServerPort
);
//
loger.log("Server选点完成", "mcu-->",GlobalConfig.MCUServerIP,GlobalConfig.MCUServerPort,"ms---->",GlobalConfig.MSServerIP,GlobalConfig.MSServerPort);
this
.
_emit
(
ServerCheck
.
SEVER_CHECK_BEST_IP_SUCCESS
);
}
}
else
{
...
...
@@ -278,12 +278,12 @@ class ServerCheck extends Emiter {
//按country没有查找到就返回default
if
(
!
countryData
){
countryData
=
jsona
.
MCU
.
default
;
loger
.
log
(
"_returnServerMCU->countryData->default"
,
countryData
);
//
loger.log("_returnServerMCU->countryData->default",countryData);
return
countryData
;
}
if
(
country
!=
"中国"
){
loger
.
log
(
"_returnServerMCU->countryData"
,
countryData
);
//
loger.log("_returnServerMCU->countryData",countryData);
return
countryData
;
}
...
...
@@ -292,7 +292,7 @@ class ServerCheck extends Emiter {
let
ispData
=
countryData
.
isp
[
isp
];
//isp查找到就返回
if
(
ispData
){
loger
.
log
(
"_returnServerMCU->ispData"
,
ispData
);
//
loger.log("_returnServerMCU->ispData",ispData);
return
ispData
;
}
...
...
@@ -300,7 +300,7 @@ class ServerCheck extends Emiter {
let
provinceData
=
countryData
.
province
[
province
];
//用province查找到就返回
if
(
provinceData
){
loger
.
log
(
"_returnServerMCU->provinceData"
,
provinceData
);
//
loger.log("_returnServerMCU->provinceData",provinceData);
return
provinceData
;
}
...
...
@@ -308,10 +308,10 @@ class ServerCheck extends Emiter {
//isp province都没有,使用default
let
defaultData
=
countryData
.
default
if
(
defaultData
){
loger
.
log
(
"_returnServerMCU->defaultData"
,
defaultData
);
//
loger.log("_returnServerMCU->defaultData",defaultData);
return
defaultData
;
}
else
{
loger
.
log
(
"_returnServerMCU->defaultData"
,
""
);
//
loger.log("_returnServerMCU->defaultData","");
return
[];
}
return
[];
...
...
@@ -324,12 +324,12 @@ class ServerCheck extends Emiter {
//按country没有查找到就返回default
if
(
!
countryData
){
countryData
=
jsona
.
MS
.
default
;
loger
.
log
(
"_returnServerMS->countryData->default"
,
countryData
);
//
loger.log("_returnServerMS->countryData->default",countryData);
return
countryData
;
}
if
(
country
!=
"中国"
){
loger
.
log
(
"_returnServerMS->countryData"
,
countryData
);
//
loger.log("_returnServerMS->countryData",countryData);
return
countryData
;
}
...
...
@@ -338,7 +338,7 @@ class ServerCheck extends Emiter {
let
ispData
=
countryData
.
isp
[
isp
];
//isp查找到就返回
if
(
ispData
){
loger
.
log
(
"_returnServerMS->ispData"
,
ispData
);
//
loger.log("_returnServerMS->ispData",ispData);
return
ispData
;
}
...
...
@@ -346,7 +346,7 @@ class ServerCheck extends Emiter {
let
provinceData
=
countryData
.
province
[
province
];
//用province查找到就返回
if
(
provinceData
){
loger
.
log
(
"_returnServerMS->provinceData"
,
provinceData
);
//
loger.log("_returnServerMS->provinceData",provinceData);
return
provinceData
;
}
...
...
@@ -354,10 +354,10 @@ class ServerCheck extends Emiter {
//isp province都没有,使用default
let
defaultData
=
countryData
.
default
if
(
defaultData
){
loger
.
log
(
"_returnServerMS->defaultData"
,
defaultData
);
//
loger.log("_returnServerMS->defaultData",defaultData);
return
defaultData
;
}
else
{
loger
.
log
(
"_returnServerMS->defaultData"
,
""
);
//
loger.log("_returnServerMS->defaultData","");
return
[];
}
...
...
src/apes/Ape.js
查看文件 @
54815f5
...
...
@@ -371,7 +371,6 @@ export default class Ape extends Emiter {
}
sendChatUniform
(
appPdu
,
top
)
{
loger
.
log
(
'Ape发送数据UNIFORM PDU'
);
//console.log(appPdu);
//loger.log('当前的状态============',GlobalConfig.getCurrentStatus().code);
if
(
GlobalConfig
.
getCurrentStatus
().
code
==
0
||
GlobalConfig
.
getCurrentStatus
().
code
==
1
)
{
...
...
@@ -391,6 +390,7 @@ export default class Ape extends Emiter {
PduConsts
.
SEG_ONCE
);
uniformPdu
.
data
=
appPdu
.
toArrayBuffer
();
loger
.
log
(
'Ape发送数据UNIFORM PDU'
,
uniformPdu
);
// Mcu发送
this
.
mcu
.
send
(
uniformPdu
);
}
...
...
src/apes/DocApe.js
查看文件 @
54815f5
...
...
@@ -42,6 +42,7 @@ class DocApe extends Ape {
}
/////////////发送数据操作//////////////////////////////////////////////////////
//上传文档
documentUpload
(
paramInfo
){
if
(
paramInfo
==
null
||
EngineUtils
.
isEmptyObject
(
paramInfo
)){
...
...
@@ -96,7 +97,7 @@ class DocApe extends Ape {
this
.
sendUniform
(
adapterPdu
,
true
);
}
updaterDoc
(
_docDataModel
,
_itemIdx
){
loger
.
log
(
"文档===updaterDoc "
,
_itemIdx
);
//
loger.log("文档===updaterDoc ",_itemIdx);
//验证坐标点集合数组是否合法
if
(
_docDataModel
==
null
||
_itemIdx
==
null
){
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_APE_INTERFACE_PARAM_WRONG
);
...
...
@@ -266,7 +267,7 @@ class DocApe extends Ape {
//console.log(docDataModelPdu);
//console.log(docDataModel);
if
(
docDataModel
==
null
){
loger
.
log
(
'document
Command失败
,文档不存在'
,
paramInfo
);
loger
.
log
(
'document
SwitchPage->
,文档不存在'
,
paramInfo
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_APE_INTERFACE_PARAM_WRONG
);
return
;
}
...
...
@@ -279,13 +280,30 @@ class DocApe extends Ape {
this
.
updaterDoc
(
docDataModel
,
docDataModel
.
itemIdx
);
}
//缩放/滚动
//文档切换显示模式
documentSwitchShowModel
(
paramInfo
){
loger
.
log
(
'documentSwitchShowModel'
,
paramInfo
);
//获取已经存在的数据
let
docDataModel
=
this
.
docList
[
paramInfo
.
itemIdx
];
if
(
docDataModel
==
null
){
loger
.
log
(
'documentSwitchShowModel->文档不存在'
,
paramInfo
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_APE_INTERFACE_PARAM_WRONG
);
return
;
}
//更新数据的字段
docDataModel
.
action
=
ApeConsts
.
DOC_ACTION_SWITCH_PAGE
;
docDataModel
.
curPageNo
=
parseInt
(
paramInfo
.
curPageNo
)
||
1
;
if
(
docDataModel
.
curPageNo
<
1
){
docDataModel
.
curPageNo
=
1
;
//默认值最小是1
}
this
.
updaterDoc
(
docDataModel
,
docDataModel
.
itemIdx
);
}
//缩放/滚动/显示模式
documentCommand
(
paramInfo
){
//console.log(this.docList);
//获取已经存在的数据
let
docDataModel
=
this
.
docList
[
paramInfo
.
itemIdx
];
//console.log(docDataModelPdu);
//console.log(docDataModel);
if
(
docDataModel
==
null
){
loger
.
log
(
'documentCommand失败,文档不存在'
,
paramInfo
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_APE_INTERFACE_PARAM_WRONG
);
...
...
@@ -293,7 +311,7 @@ class DocApe extends Ape {
}
//更新数据的字段
docDataModel
.
action
=
ApeConsts
.
DOC_ACTION_COMMAND
;
//docDataModel.scale=parseInt(paramInfo.scale)||100;//默认是100(百分比)
docDataModel
.
showType
=
parseInt
(
paramInfo
.
showType
)
||
0
;
//0;//完整显示;1;//按宽度显示;2;//按高度显示
this
.
updaterDoc
(
docDataModel
,
docDataModel
.
itemIdx
);
}
...
...
@@ -403,28 +421,6 @@ class DocApe extends Ape {
loger
.
log
(
'tableUpdateHandler 数据无效--> itemIdx'
,
itemIdx
);
}
/*try {
const recordInfo = pdu['RCDocSendDataRequestPdu'].decode(itemData);
recordInfo.type = ApeConsts.DOCUMENT_LOAD;
recordInfo.ext = recordInfo.name.substr(recordInfo.name.indexOf('.') + 1);
recordInfo.wbid = (recordInfo.id << 10) + recordInfo.curPageNo;
recordInfo.isPicture = ~['bmp', 'png', 'gif', 'jpg', 'jpeg'].indexOf(recordInfo.ext);
if (recordInfo.isPicture) {
recordInfo.namePath = recordInfo.uri.substring(0, recordInfo.uri.lastIndexOf('.'));
recordInfo.loadURL = recordInfo.namePath + '.' + recordInfo.ext;
} else {
recordInfo.namePath = recordInfo.uri.substring(0, recordInfo.uri.lastIndexOf('/'));
recordInfo.loadURL = `${recordInfo.namePath}/${recordInfo.curPageNo}.jpg`;
}
this.docList[recordId] = recordInfo;
this._emit(MessageTypes.DOC_UPDATE, recordInfo);
loger.log('Doc update ->' + itemIdx);
} catch (e) {
loger.warn('Doc Table Update Decode包异常');
}*/
}
onJoinChannelHandlerSuccess
(){
loger
.
log
(
this
.
_session_name
+
' onJoinChannelHandlerSuccess==========================='
);
...
...
@@ -488,6 +484,7 @@ class DocApe extends Ape {
optional string file_name=16;//文档的名字
optional string dynamic_TS=17;//"dynamicTransferStatic": "0"
optional string md5=18;//md5
optional uint32 show_type=19;//显示模式
}*/
//判断type类型,根据type设置不同的参数
...
...
@@ -510,6 +507,7 @@ class DocApe extends Ape {
docModelPdu
.
md5
=
_param
.
md5
||
""
;
//MD5
docModelPdu
.
fileName
=
_param
.
fileName
||
"doc_"
+
_itemIdx
;
//文档的名字
docModelPdu
.
dynamicTS
=
_param
.
dynamicTS
||
"0"
;
//文档上传后返回值中的字段dynamicTransferStatic
docModelPdu
.
showType
=
_param
.
showType
||
0
;
//文档显示模式
loger
.
log
(
docModelPdu
);
return
docModelPdu
;
}
...
...
@@ -523,7 +521,7 @@ class DocApe extends Ape {
try
{
let
docModelPdu
=
pdu
[
'RCDocSendDataModelPdu'
].
decode
(
itemData
);
loger
.
log
(
docModelPdu
);
//
loger.log(docModelPdu);
return
docModelPdu
;
}
catch
(
err
){
loger
.
log
(
"文档收到数据 unPackPdu Pdu解析错误,itemIdx="
+
itemIdx
+
" err:"
+
err
.
message
);
...
...
src/apes/MediaModule.js
查看文件 @
54815f5
...
...
@@ -44,6 +44,7 @@ class MediaModule {
+
port
+
"/live/"
+
_param
.
streamId
;
}
path
=
path
.
replace
(
"::"
,
":"
);
//如果ip和port之间有多的:需要去掉
return
{
"code"
:
ApeConsts
.
RETURN_SUCCESS
,
"data"
:
""
,
"playUrl"
:
path
};
}
...
...
@@ -61,6 +62,8 @@ class MediaModule {
+
port
+
"/live/"
+
_param
.
streamId
+
"/total.m3u8"
;
path
=
path
.
replace
(
"::"
,
":"
);
//如果ip和port之间有多的:需要去掉
return
{
"code"
:
ApeConsts
.
RETURN_SUCCESS
,
"data"
:
""
,
"playUrl"
:
path
};
}
...
...
@@ -93,6 +96,7 @@ class MediaModule {
let
publishUrl
=
"rtmp://"
+
GlobalConfig
.
MSServerIP
+
port
+
"/"
+
pubType
+
"/"
+
streamId
;
publishUrl
=
publishUrl
.
replace
(
"::"
,
":"
);
//如果ip和port之间有多的:需要去掉
this
.
needPublishMediaChannel
[
publishUrl
]
=
{
"channelId"
:
freeChannel
,
"publishUrl"
:
publishUrl
,
...
...
src/apes/VideoApe.js
查看文件 @
54815f5
...
...
@@ -292,7 +292,6 @@ class VideoApe extends Ape {
}
videoReceivePdu
.
data
=
this
.
_rCArrayBufferUtil
.
uint8ArrayToStr
(
videoReceivePdu
.
data
,
2
);
//开头两个字会乱码
loger
.
log
(
'视频控制消息处理 .'
,
videoReceivePdu
);
loger
.
log
(
videoReceivePdu
);
//判断接收者的id,如果不是0,并且也不是自己的nodeId,那么消息不做处理
if
(
videoReceivePdu
.
toNodeId
!=
0
&&
videoReceivePdu
.
toNodeId
!=
GlobalConfig
.
nodeId
)
{
...
...
src/apes/WhiteBoardApe.js
查看文件 @
54815f5
...
...
@@ -277,7 +277,7 @@ class WhiteBoardApe extends Ape {
//文档更新,白板也要更新
docUpdateHandler
(
_data
)
{
loger
.
log
(
"白板收到文档更新的消息docUpdateHandler"
);
loger
.
log
(
_data
);
//
loger.log(_data);
//如果切换了文档或翻页,清除之前的添加步骤记录
if
(
_data
.
action
==
ApeConsts
.
DOC_ACTION_SWITCH_DOC
||
_data
.
action
==
ApeConsts
.
DOC_ACTION_SWITCH_PAGE
)
{
...
...
@@ -324,7 +324,7 @@ class WhiteBoardApe extends Ape {
annotaionItems
.
push
(
item
);
loger
.
log
(
"显示和文档对应的白板数据docUpdateHandler itemIdx:"
,
item
.
itemIdx
,
"doc itemIdx:"
,
GlobalConfig
.
activeDocId
,
"curPageNo:"
,
GlobalConfig
.
activeDocCurPage
);
}
else
{
//
loger.log("不显示白板数据docUpdateHandler",item);
loger
.
log
(
"不显示白板数据docUpdateHandler"
,
item
);
}
}
var
updateObj
=
{
...
...
src/pdus/PduType.js
查看文件 @
54815f5
...
...
@@ -107,3 +107,4 @@ RCPduPackage.RCPDU_SEND_AUDIO_DATA_REQUEST = 502;
RCPduPackage
.
RCPDU_SEND_GIFT_DATA_REQUEST
=
503
;
RCPduPackage
.
RCPDU_SEND_CHAT_DATA_REQUEST
=
504
;
RCPduPackage
.
RCPDU_THIRD_BROADCAST_DATA_REQUEST
=
505
;
//第三方广播消息
RCPduPackage
.
RCPDU_SEND_DOC_BROADCAST_DATA_REQUEST
=
506
;
...
...
src/pdus/pro.js
查看文件 @
54815f5
...
...
@@ -146,6 +146,7 @@ enum RCPduType_E {
RCPDU_SEND_GIFT_DATA_REQUEST
=
503
;
RCPDU_SEND_CHAT_DATA_REQUEST
=
504
;
RCPDU_THIRD_BROADCAST_DATA_REQUEST
=
505
;
RCPDU_SEND_DOC_BROADCAST_DATA_REQUEST
=
506
;
}
enum
RCPduNodeType_E
{
...
...
@@ -731,8 +732,17 @@ message RCDocSendDataModelPdu {
optional
string
file_name
=
16
;
//文档的名字
optional
string
dynamic_TS
=
17
;
//"dynamicTransferStatic": "0"
optional
string
md5
=
18
;
//md5
optional
uint32
show_type
=
19
;
//文档显示模式
}
message
RCDocBroadcastDataRequestPdu
{
optional
uint32
from_node_id
=
1
;
//发起人
optional
uint32
to_node_id
=
2
;
//接收人,如果是0就是所有人都接收
optional
uint32
actionType
=
3
;
//消息指令类型;
optional
bytes
data
=
4
;
//其他数据,这个根据actionType来确定数据的结构
}
message
RCGiftSendDataRequestPdu
{
optional
uint32
initiator
=
1
;
required
uint32
peer
=
2
;
...
...
请
注册
或
登录
后发表评论