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
f7dc5a650eb0ed2f38278a8bb9ec3368986027e1
f7dc5a65
1 parent
6419d964
1.修复媒体共享和伴音模块的seek处理问题;2.聊天模块增加图片消息;3增加踢人接口和第三方消息接口
隐藏空白字符变更
内嵌
并排对比
正在显示
7 个修改的文件
包含
55 行增加
和
8 行删除
src/EngineEntrance.js
src/MessageTypes.js
src/apes/ChatApe.js
src/apes/ConferApe.js
src/apes/MediaSharedApe.js
src/apes/MusicSharedApe.js
src/apes/ThirdMessage.js
src/EngineEntrance.js
查看文件 @
f7dc5a6
...
...
@@ -35,7 +35,7 @@ import QuestionApe from 'apes/QuestionApe';
import
UTF8
from
'utf-8'
;
let
loger
=
Loger
.
getLoger
(
'McuClient'
);
let
_sdkInfo
=
{
"version"
:
"v1.
49.1
.20170724"
,
"author"
:
"www.3mang.com"
};
let
_sdkInfo
=
{
"version"
:
"v1.
50.7
.20170724"
,
"author"
:
"www.3mang.com"
};
//APE
let
_sass
;
...
...
@@ -168,6 +168,8 @@ export default class MessageEntrance extends Emiter {
this
.
kickOutRosterFormNodeId
=
this
.
_kickOutRosterFormNodeId
.
bind
(
this
);
//把指定nodeId的人踢出课堂
this
.
sendThridChannelMessage
=
this
.
_sendThridChannelMessage
.
bind
(
this
);
//通道第三方消息通道发送消息
//录制回放
this
.
initRecordPlayback
=
this
.
_initRecordPlayback
.
bind
(
this
);
this
.
startRecordPlayback
=
this
.
_startRecordPlayback
.
bind
(
this
);
...
...
@@ -433,13 +435,21 @@ export default class MessageEntrance extends Emiter {
GlobalConfig
.
isRecordPlayBack
=
false
;
//设置为非录制回放状态
GlobalConfig
.
classId
=
parseInt
(
_param
.
classId
);
GlobalConfig
.
portal
=
_param
.
portal
;
//H5处理
GlobalConfig
.
isH5
=
_param
.
isH5
||
false
;
//外部传入的参数,是否是H5
if
(
GlobalConfig
.
isH5
==
true
){
GlobalConfig
.
platform
=
"H5"
;
GlobalConfig
.
deviceType
=
3
//3是H5
loger
.
warn
(
"设备类型是H5"
);
}
//GlobalConfig.userId = _param.userId || "0";
//IOS 安卓处理,需要外部传入摄像头和麦克风信息
if
(
GlobalConfig
.
isMobile
){
GlobalConfig
.
cameras
=
_param
.
cameras
||
[];
GlobalConfig
.
cameras
=
_param
.
microphones
||
[];
}
//如果没有名字,随机起一个名字
GlobalConfig
.
userName
=
_param
.
userName
||
"user_"
+
(
new
Date
().
getTime
()
%
1000000
);
...
...
@@ -1057,6 +1067,17 @@ export default class MessageEntrance extends Emiter {
}
}
//通过第三方消息通道发送消息
_sendThridChannelMessage
(
_param
){
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_confer_ape
)
{
_confer_ape
.
onThirdReciveParentMessage
(
_param
);
}
}
//将指定nodeId的人踢出课堂
_kickOutRosterFormNodeId
(
_param
){
if
(
!
_mcu
.
connected
)
{
...
...
src/MessageTypes.js
查看文件 @
f7dc5a6
...
...
@@ -39,7 +39,8 @@ 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
.
RECEIVE_THIRD_MESSGAE
=
"receive_third_message"
;
//接收到第三方消息
//聊天模块事件定义
MessageTypes
.
CHAT_RECEIVE
=
"chat_receive_message"
;
// 'chat.receive';
...
...
src/apes/ChatApe.js
查看文件 @
f7dc5a6
...
...
@@ -85,7 +85,7 @@ class ChatApe extends Ape {
chatMsg
.
message
=
this
.
_rCArrayBufferUtil
.
uint8ArrayToStr
(
chatReceivePdu
.
userData
,
2
);
chatMsg
.
fromName
=
this
.
_rCArrayBufferUtil
.
uint8ArrayToStr
(
chatReceivePdu
.
fromName
,
2
);
chatMsg
.
fromRole
=
chatReceivePdu
.
fromRole
;
chatMsg
.
msgType
=
chatReceivePdu
.
msgType
||
0
;
loger
.
log
(
'接收聊天消息.'
,
chatMsg
);
this
.
_emit
(
MessageTypes
.
CHAT_RECEIVE
,
chatMsg
);
...
...
src/apes/ConferApe.js
查看文件 @
f7dc5a6
...
...
@@ -739,7 +739,14 @@ class ConferApe extends Ape {
//收到父级页面的消息,需要广播发送出去
onThirdReciveParentMessage
(
_msg
)
{
loger
.
log
(
'收到页面的消息->广播给其他模块->'
,
_msg
);
this
.
sendThirdBroadcastData
({
to
:
0
,
message
:
_msg
});
//尝试将外部传入的数据转换为JSON 字符串
let
_message
=
_msg
;
try
{
_message
=
JSON
.
parse
(
_msg
);
}
catch
(
err
){
}
this
.
sendThirdBroadcastData
({
to
:
0
,
message
:
_message
});
}
//发送第三方广播消息
...
...
@@ -759,7 +766,15 @@ class ConferApe extends Ape {
thirdBroadcastSendPdu
.
initiator
=
this
.
_classInfo
.
nodeId
;
//发起人
thirdBroadcastSendPdu
.
peer
=
parseInt
(
_param
.
to
)
||
0
;
//发送给谁,公聊的时候是0,私聊的时候是指定的用户id
thirdBroadcastSendPdu
.
isPublic
=
true
;
thirdBroadcastSendPdu
.
message
=
this
.
_rCArrayBufferUtil
.
strToUint8Array
(
"h5"
+
_param
.
message
);
let
messageStr
=
_param
.
message
||
""
;
//尝试把信息转换为JSON 字符串,如果是字符串就不需要转
try
{
messageStr
=
JSON
.
stringify
(
messageStr
);
}
catch
(
err
){
}
thirdBroadcastSendPdu
.
message
=
this
.
_rCArrayBufferUtil
.
strToUint8Array
(
"h5"
+
messageStr
);
if
(
!
thirdBroadcastSendPdu
.
isPublic
&&
0
!=
thirdBroadcastSendPdu
.
peer
)
{
//发送给制定的人
...
...
@@ -780,6 +795,7 @@ class ConferApe extends Ape {
//loger.log("监听第三方消息通道消息->1", thirdMessage);
thirdMessage
.
message
=
this
.
_rCArrayBufferUtil
.
uint8ArrayToStr
(
thirdBroadcastReceivePdu
.
message
,
2
);
loger
.
log
(
"监听第三方消息通道消息->"
,
thirdMessage
);
this
.
_emit
(
MessageTypes
.
RECEIVE_THIRD_MESSGAE
,
thirdMessage
);
if
(
this
.
thirdMessage
)
{
this
.
thirdMessage
.
sendMessageToParent
(
thirdMessage
.
message
);
}
...
...
src/apes/MediaSharedApe.js
查看文件 @
f7dc5a6
...
...
@@ -405,6 +405,7 @@ class MediaSharedApe extends Ape {
getMediaPackFullInfo
.
mediaVolume
==
this
.
lastActiveData
.
mediaVolume
){
let
timeDistance
=
Math
.
abs
(
new
Date
().
getTime
()
-
parseInt
(
this
.
lastActiveData
.
time
))
/
1000
;
let
seekDistance
=
Math
.
abs
(
getMediaPackFullInfo
.
seek
-
this
.
lastActiveData
.
seek
)
-
timeDistance
;
seekDistance
=
Math
.
abs
(
seekDistance
);
if
(
seekDistance
<=
5
){
//记录最后一次的数据
loger
.
warn
(
"媒体共享更新数据->数据只有SEEK发生改变,低于5秒不需要再更新->timeDistance:"
+
timeDistance
+
"->seekDistance"
+
seekDistance
);
...
...
src/apes/MusicSharedApe.js
查看文件 @
f7dc5a6
...
...
@@ -399,10 +399,11 @@ class MusicSharedApe extends Ape {
if
(
this
.
lastActiveData
&&
this
.
lastActiveData
.
status
==
1
){
if
(
getMusicPackFullInfo
&&
getMusicPackFullInfo
.
status
==
1
&&
getMusicPackFullInfo
.
m
ediaVolume
==
this
.
lastActiveData
.
media
Volume
){
getMusicPackFullInfo
.
m
usicVolume
==
this
.
lastActiveData
.
music
Volume
){
let
timeDistance
=
Math
.
abs
(
new
Date
().
getTime
()
-
parseInt
(
this
.
lastActiveData
.
time
))
/
1000
;
let
seekDistance
=
Math
.
abs
(
getMusicPackFullInfo
.
seek
-
this
.
lastActiveData
.
seek
)
-
timeDistance
;
seekDistance
=
Math
.
abs
(
seekDistance
);
if
(
seekDistance
<
5
){
//记录最后一次的数据
loger
.
warn
(
"伴音更新数据->数据只有SEEK发生改变,低于5秒不需要再更新->timeDistance:"
+
timeDistance
+
"->seekDistance"
+
seekDistance
);
...
...
src/apes/ThirdMessage.js
查看文件 @
f7dc5a6
...
...
@@ -26,8 +26,15 @@ class ThirdMessage extends Emiter{
return
;
}
if
(
this
.
messenger
){
let
sendMsg
=
""
;
//尝试转换为JSON 字符串
try
{
sendMsg
=
JSON
.
stringify
(
_msg
);
}
catch
(
err
){
sendMsg
=
_msg
;
}
loger
.
log
(
'发送消息给父级页面->'
,
_msg
);
this
.
messenger
.
send
(
_m
sg
);
this
.
messenger
.
send
(
sendM
sg
);
}
}
//收到父级页面的消息
...
...
请
注册
或
登录
后发表评论