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
AlexWang
2017-06-22 12:03:11 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
7029aa76e345e0463552bae07997f7d43ddf67d3
7029aa76
2 parents
67ac606e
51e886c5
合并dev
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
750 行增加
和
558 行删除
dist/McuClient.js
src/EngineEntrance.js
src/EngineUtils.js
src/GlobalConfig.js
src/MessageTypes.js
src/apes/QuestionApe.js
dist/McuClient.js
查看文件 @
7029aa7
此 diff 太大无法显示。
src/EngineEntrance.js
查看文件 @
7029aa7
...
...
@@ -33,7 +33,7 @@ import QuestionApe from 'apes/QuestionApe';
import
UTF8
from
'utf-8'
;
let
loger
=
Loger
.
getLoger
(
'McuClient'
);
let
_sdkInfo
=
{
"version"
:
"v1.36.
1.20170619
"
,
"author"
:
"www.3mang.com"
};
let
_sdkInfo
=
{
"version"
:
"v1.36.
8.20170620
"
,
"author"
:
"www.3mang.com"
};
//APE
let
_sass
;
...
...
@@ -1233,651 +1233,820 @@ export default class MessageEntrance extends Emiter {
}
}
<<
<<
<<
<
HEAD
//ChatApe
// 发送聊天消息
_sendChatMsg
(
_messageInfo
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_messageInfo
===
null
||
EngineUtils
.
isEmptyObject
(
_messageInfo
))
{
loger
.
log
(
'发送聊天消息失败->参数错误'
,
_messageInfo
);
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_chat_ape
)
{
_chat_ape
.
sendChatMsg
(
_messageInfo
);
}
}
//监听摄像头麦克风状态
userDeviecStatusChange
(
_data
)
{
/* nodeId:GlobalConfig.nodeId,
userRole:GlobalConfig.userRole,
userName:GlobalConfig.userName,
userId:GlobalConfig.userId,
openCamera:GlobalConfig.openCamera,
openMicrophones:GlobalConfig.openMicrophones*/
if
(
_confer_ape
)
{
_confer_ape
.
updaterUserDeviecStatusChange
(
_data
);
}
}
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
===
===
=
//获取课堂所有参数 api/meeting/detail.do? flash中的接口文件是 getClassParam.do
_sassGetClassParamSuccessHandler
(
_data
)
{
loger
.
log
(
'获取课堂课堂信息完成.'
);
//包含整个课堂最全的信息,储存数据
if
(
_data
)
{
GlobalConfig
.
mcuDelay
=
_data
.
h5Delay
||
0
;
//mcu消息延迟的时间间隔,单位(秒),结合客户端传的messageDelay的值使用
GlobalConfig
.
className
=
_data
.
meetingName
||
""
;
GlobalConfig
.
classBeginTime
=
_data
.
beginTime
||
""
;
GlobalConfig
.
classEndTime
=
_data
.
endTime
||
""
;
GlobalConfig
.
userIp
=
_data
.
userIp
||
""
;
GlobalConfig
.
maxVideoChannels
=
_data
.
maxVideoChannels
;
GlobalConfig
.
maxAudioChannels
=
_data
.
maxAudioChannels
;
GlobalConfig
.
maxMediaChannels
=
Math
.
max
(
GlobalConfig
.
maxVideoChannels
,
GlobalConfig
.
maxAudioChannels
);
GlobalConfig
.
ssTunnelAppURL
=
_data
.
ssTunnelAppURL
||
''
;
//屏幕共享插件的地址
//视频质量相关设置,每次加入课堂都按最新的获取设置
GlobalConfig
.
fps
=
_data
.
fps
||
15
;
GlobalConfig
.
gop
=
_data
.
gop
||
3
;
GlobalConfig
.
videoQuality
=
parseInt
(
_data
.
videoQuality
);
GlobalConfig
.
curVideoQuality
=
GlobalConfig
.
videoQuality
;
//是否自动开始(身份是host的时候才用到的)
GlobalConfig
.
isAutoStartClass
=
_data
.
autoRecord
||
0
;
GlobalConfig
.
serverTime
=
_data
.
serverTime
||
new
Date
().
getTime
();
//获取服务器时间戳
GlobalConfig
.
serverAndLoacTimeDistanc
=
(
new
Date
().
getTime
()
-
GlobalConfig
.
serverTime
)
/
1000
;
//当前系统时间和服务器时间的差值 (秒)
loger
.
warn
(
"服务器时间:"
+
GlobalConfig
.
serverTime
+
" 系统时间:"
+
new
Date
().
getTime
()
+
" 时间差:"
+
GlobalConfig
.
serverAndLoacTimeDistanc
);
GlobalConfig
.
setDocListPrepare
(
_data
.
docListPrepare
);
//提前上传的文档列表
GlobalConfig
.
setRecordList
(
_data
.
recordList
);
//录制回放地址
GlobalConfig
.
setDocList
(
_data
.
docList
);
//文档地址
GlobalConfig
.
setMsList
(
_data
.
msList
);
//推流播流服务器地址(需要对列表中的地址进行分类,里面包含了推流和拉流的地址,目前主要是乐视的需要区分开)
GlobalConfig
.
setRsList
(
_data
.
rsList
);
//播放m3u8格式的地址(录制回放时使用)
GlobalConfig
.
setMcuList
(
_data
.
mcuList
);
//mcu
GlobalConfig
.
setMusicList
(
_data
.
musicList
);
//
GlobalConfig
.
setMusicListPrepare
(
_data
.
musicListPrepare
);
//提前上传的声音文件列表
GlobalConfig
.
setVideoCDNAddr
(
_data
.
videoCDNAddr
);
//cdn加速的拉流地址,直播的时候才使用
GlobalConfig
.
setMediaShareList
(
_data
.
sharedMediaList
);
//提前上传的媒体共享文件列表
//MCU地址
if
(
_data
.
mcuList
&&
_data
.
mcuList
.
length
>
0
)
{
//随机选择一个
let
index
=
parseInt
(
Math
.
random
()
*
_data
.
mcuList
.
length
);
GlobalConfig
.
MCUServerIP
=
_data
.
mcuList
[
index
].
ip
||
""
;
GlobalConfig
.
MCUServerPort
=
_data
.
mcuList
[
index
].
port
||
""
;
loger
.
log
(
'初始->MCU->.'
,
GlobalConfig
.
MCUServerIP
,
GlobalConfig
.
MCUServerPort
);
}
//屏幕共享
//开始屏幕共享
_publishScreenShare
(
_param
)
{
if
(
_video_ape
)
{
_video_ape
.
publishScreenShare
(
_param
);
}
}
//停止屏幕共享
_stopPublishScreenShare
(
_param
)
{
if
(
_video_ape
)
{
_video_ape
.
stopPublishScreenShare
(
_param
);
}
}
//VidoeApe
videoUpdate
(
_data
)
{
//视频同步的消息发送改变,需要通知ferApe模块中的用户更新状态
if
(
_confer_ape
)
{
_confer_ape
.
updaterRosterStatus
(
_data
);
}
}
//录制回放时m3u8播流地址
if
(
_data
.
rsList
&&
_data
.
rsList
.
length
>
0
)
{
let
index
=
parseInt
(
Math
.
random
()
*
_data
.
rsList
.
length
);
GlobalConfig
.
RS_RECORD_PLAY_IP
=
_data
.
rsList
[
index
].
ip
||
""
;
GlobalConfig
.
RS_RECORD_PLAY_PORT
=
_data
.
rsList
[
index
].
port
||
""
;
loger
.
log
(
'初始->RS->.'
,
GlobalConfig
.
RS_RECORD_PLAY_IP
,
GlobalConfig
.
RS_RECORD_PLAY_PORT
);
}
_sendVideoBroadcastMsg
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_video_ape
)
{
return
_video_ape
.
sendVideoBroadcastMsg
(
_param
);
}
}
//上课中音视频推流地址
if
(
GlobalConfig
.
msList
&&
GlobalConfig
.
msList
.
length
>
0
)
{
let
index
=
parseInt
(
Math
.
random
()
*
GlobalConfig
.
msList
.
length
);
GlobalConfig
.
MS_PUBLISH_IP
=
GlobalConfig
.
msList
[
index
].
ip
||
""
;
GlobalConfig
.
MS_PUBLISH_PORT
=
GlobalConfig
.
msList
[
index
].
port
||
""
;
}
loger
.
log
(
'初始->MS->.'
,
GlobalConfig
.
MS_PUBLISH_IP
,
GlobalConfig
.
MS_PUBLISH_PORT
);
//播流的地址和推流地址需要分开的时候,单独设置拉流的地址 rtmp(目前乐视使用)
if
(
GlobalConfig
.
pullRtmpList
&&
GlobalConfig
.
pullRtmpList
.
length
>
0
)
{
//有单独的rtmp拉流地址
let
index
=
parseInt
(
Math
.
random
()
*
GlobalConfig
.
pullRtmpList
.
length
);
GlobalConfig
.
MS_PLAY_RTMP_IP
=
GlobalConfig
.
pullRtmpList
[
index
].
ip
||
""
;
GlobalConfig
.
MS_PLAY_RTMP_PORT
=
GlobalConfig
.
pullRtmpList
[
index
].
port
||
""
;
}
else
{
//如果没有单独的rtmp拉流地址,和推流地址一样即可
GlobalConfig
.
MS_PLAY_RTMP_IP
=
GlobalConfig
.
MS_PUBLISH_IP
;
GlobalConfig
.
MS_PLAY_RTMP_PORT
=
GlobalConfig
.
MS_PUBLISH_PORT
;
}
_getVideoPlayPath
(
_param
)
{
if
(
_video_ape
)
{
return
_video_ape
.
getPlayVideoPath
(
_param
);
}
}
loger
.
log
(
'初始->MSPull->.'
,
GlobalConfig
.
MS_PLAY_RTMP_IP
,
GlobalConfig
.
MS_PLAY_RTMP_PORT
);
//播流的地址和推流地址需要分开的时候,单独设置拉流的地址 hls(目前乐视使用)
if
(
GlobalConfig
.
hlsList
&&
GlobalConfig
.
hlsList
.
length
>
0
)
{
//有单独的hls拉流地址
let
index
=
parseInt
(
Math
.
random
()
*
GlobalConfig
.
hlsList
.
length
);
GlobalConfig
.
MS_PLAY_HLS_IP
=
GlobalConfig
.
hlsList
[
index
].
ip
||
""
;
GlobalConfig
.
MS_PLAY_HLS_PORT
=
GlobalConfig
.
hlsList
[
index
].
port
||
""
;
}
else
{
//没有单独的hls拉流地址,和录制回放地址一样即可
GlobalConfig
.
MS_PLAY_HLS_IP
=
GlobalConfig
.
RS_RECORD_PLAY_IP
;
GlobalConfig
.
MS_PLAY_HLS_PORT
=
GlobalConfig
.
RS_RECORD_PLAY_PORT
;
}
loger
.
log
(
'初始->MSHls->.'
,
GlobalConfig
.
MS_PLAY_HLS_IP
,
GlobalConfig
.
MS_PLAY_HLS_PORT
);
//直播的时候,拉流(rtmp和hls)需要从 videoCDNAddr中获取
//20170531-新规则,所有课堂类型都支持加速
// if(GlobalConfig.classType==ApeConsts.CLASS_TYPE_2&&GlobalConfig.videoCDNAddrList.length>0){
if
(
GlobalConfig
.
videoCDNAddrList
.
length
>
0
)
{
//videoCDNAddrList中rtmppush和hls是混在一起的,需要分离开;
let
listLen
=
GlobalConfig
.
videoCDNAddrList
.
length
;
for
(
let
i
=
0
;
i
<
listLen
;
i
++
)
{
let
ipItem
=
GlobalConfig
.
videoCDNAddrList
[
i
];
if
(
ipItem
)
{
if
(
ipItem
.
indexOf
(
'hls'
)
>=
0
)
{
//直播的时候m3u8拉流地址
GlobalConfig
.
MS_PLAY_HLS_IP
=
ipItem
;
//ip包含了端口
GlobalConfig
.
MS_PLAY_HLS_PORT
=
""
;
loger
.
log
(
'videoCDNAddr>初始->MSHls'
,
GlobalConfig
.
MS_PLAY_HLS_IP
);
}
else
if
(
ipItem
.
indexOf
(
'rtmppull'
)
>=
0
)
{
//直播的时候rtmp拉流地址
GlobalConfig
.
MS_PLAY_RTMP_IP
=
ipItem
;
//ip包含了端口
GlobalConfig
.
MS_PLAY_RTMP_PORT
=
''
;
loger
.
log
(
'videoCDNAddr->初始->MSPull'
,
GlobalConfig
.
MS_PLAY_RTMP_IP
);
}
}
}
_getVideoPublishPath
(
_param
)
{
if
(
_video_ape
)
{
return
_video_ape
.
getPublishVideoPath
(
_param
);
}
}
}
else
{
loger
.
log
(
'不需要videoCDNAddr->'
);
}
_getVideoAllChannelInfo
(
_param
)
{
if
(
_video_ape
)
{
return
_video_ape
.
getAllChannelInfo
(
_param
);
}
}
//文档地址
if
(
_data
.
docList
&&
_data
.
docList
.
length
>
0
)
{
//doc上传地址,随机获取一个
let
index
=
parseInt
(
Math
.
random
()
*
_data
.
docList
.
length
);
loger
.
log
(
"docServer->"
,
_data
.
docList
[
index
]);
GlobalConfig
.
DOCServerIP
=
_data
.
docList
[
index
].
ip
||
""
;
GlobalConfig
.
DOCServerPort
=
_data
.
docList
[
index
].
port
||
""
;
loger
.
log
(
'初始->DOC->.'
,
GlobalConfig
.
DOCServerIP
,
GlobalConfig
.
DOCServerPort
);
}
_publishVideo
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_video_ape
)
{
return
_video_ape
.
publishVideo
(
_param
);
}
}
//record
if
(
_data
.
recordList
&&
_data
.
recordList
.
length
>
0
)
{
let
index
=
parseInt
(
Math
.
random
()
*
_data
.
recordList
.
length
);
GlobalConfig
.
RecordServerIP
=
_data
.
recordList
[
index
].
ip
||
""
;
GlobalConfig
.
RecordServerPort
=
_data
.
recordList
[
index
].
port
||
""
;
loger
.
log
(
'初始->RECORD->.'
,
GlobalConfig
.
RecordServerIP
,
GlobalConfig
.
RecordServerPort
);
}
_stopPublishVideo
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_video_ape
)
{
return
_video_ape
.
stopPublishVideo
(
_param
);
}
}
}
//这里需要考虑是否加延迟处理,课堂信息刚获取完成,客户端需要根据数据创建界面UI,等创建完成后再加入课堂是最合适的(目前没有加延迟)
this
.
_emit
(
MessageTypes
.
CLASS_GET_INFO_SUCCESS
,
GlobalConfig
.
getClassInfo
());
if
(
_data
.
currentInfo
)
{
//根据从Sass获取的数据信息,同步最后一次保存的课堂状态信息
loger
.
log
(
"本地同步最后一次保存过的课堂状态信息"
);
try
{
GlobalConfig
.
setClassStatusInfo
(
JSON
.
parse
(
_data
.
currentInfo
));
}
catch
(
err
)
{
GlobalConfig
.
setClassStatusInfo
(
_data
.
currentInfo
);
}
loger
.
log
(
GlobalConfig
.
classStatusInfo
);
}
else
{
loger
.
log
(
"还没有保存过课堂状信息"
);
}
//AudioApe
audioUpdate
(
_data
)
{
//音频同步的消息发送改变,需要通知ferApe模块中的用户更新状态
if
(
_confer_ape
)
{
_confer_ape
.
updaterRosterStatus
(
_data
);
//录制回放不需要获取ip信息和选点
if
(
GlobalConfig
.
isRecordPlayBack
)
{
if
(
_recordPlayback
)
{
//开启录制回放流程
loger
.
log
(
"开启录制回放流程"
);
_recordPlayback
.
readyRecordPlay
();
}
else
{
loger
.
warn
(
"开启录制回放流程失败->还未创建模块"
);
}
}
else
{
//根据用户的userIp获取信息,选点
this
.
getUserIpInfo
();
}
>>>
>>>
>
51
e886
c5e7fcd06f9e4a662071aaec162c455e1d
}
if
(
_messageInfo
===
null
||
EngineUtils
.
isEmptyObject
(
_messageInfo
))
{
loger
.
log
(
'发送聊天消息失败->参数错误'
,
_messageInfo
);
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_chat_ape
)
{
_chat_ape
.
sendChatMsg
(
_messageInfo
);
}
}
}
sendAudioCommandMsg
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_audio_ape
)
{
return
_audio_ape
.
sendAudioBroadcastMsg
(
_param
);
//监听摄像头麦克风状态
userDeviecStatusChange
(
_data
)
{
/* nodeId:GlobalConfig.nodeId,
userRole:GlobalConfig.userRole,
userName:GlobalConfig.userName,
userId:GlobalConfig.userId,
openCamera:GlobalConfig.openCamera,
openMicrophones:GlobalConfig.openMicrophones*/
if
(
_confer_ape
)
{
_confer_ape
.
updaterUserDeviecStatusChange
(
_data
);
}
}
}
_getPlayAudioPath
(
_param
)
{
if
(
_audio_ape
)
{
return
_audio_ape
.
getAudioPlayPath
(
_param
);
//屏幕共享
//开始屏幕共享
_publishScreenShare
(
_param
)
{
if
(
_video_ape
)
{
_video_ape
.
publishScreenShare
(
_param
);
}
}
//停止屏幕共享
_stopPublishScreenShare
(
_param
)
{
if
(
_video_ape
)
{
_video_ape
.
stopPublishScreenShare
(
_param
);
}
}
//VidoeApe
videoUpdate
(
_data
)
{
//视频同步的消息发送改变,需要通知ferApe模块中的用户更新状态
if
(
_confer_ape
)
{
_confer_ape
.
updaterRosterStatus
(
_data
);
}
}
}
_getPublishAudioPath
(
_param
)
{
if
(
_audio_ape
)
{
return
_audio_ape
.
getAudioPublishPath
(
_param
);
_sendVideoBroadcastMsg
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_video_ape
)
{
return
_video_ape
.
sendVideoBroadcastMsg
(
_param
);
}
}
}
_getAudioAllChannelInfo
(
_param
)
{
if
(
_audio_ape
)
{
return
_audio_ape
.
getAllChannelInfo
(
_param
);
_getVideoPlayPath
(
_param
)
{
if
(
_video_ape
)
{
return
_video_ape
.
getPlayVideoPath
(
_param
);
}
}
}
_publishAudio
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_audio_ape
)
{
return
_audio_ape
.
publishAudio
(
_param
);
_getVideoPublishPath
(
_param
)
{
if
(
_video_ape
)
{
return
_video_ape
.
getPublishVideoPath
(
_param
);
}
}
}
_stopPublishAudio
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_audio_ape
)
{
return
_audio_ape
.
stopPublishAudio
(
_param
);
_getVideoAllChannelInfo
(
_param
)
{
if
(
_video_ape
)
{
return
_video_ape
.
getAllChannelInfo
(
_param
);
}
}
}
//WhiteBoardApe
// 添加标注,发送信息
_sendInsertAnnotaion
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
sendInsetAnnotaion
(
_param
);
_publishVideo
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_video_ape
)
{
return
_video_ape
.
publishVideo
(
_param
);
}
}
}
//CursorApe
// 添加鼠标同步
_sendInsertCursor
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_cursor_ape
)
{
_cursor_ape
.
sendInsertCursor
(
_param
);
_stopPublishVideo
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_video_ape
)
{
return
_video_ape
.
stopPublishVideo
(
_param
);
}
}
}
//删除当前页面上的所有标注
_sendDeleteCurPageAnnotation
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
sendDeleteCurPageAnnotation
(
_param
);
//AudioApe
audioUpdate
(
_data
)
{
//音频同步的消息发送改变,需要通知ferApe模块中的用户更新状态
if
(
_confer_ape
)
{
_confer_ape
.
updaterRosterStatus
(
_data
);
}
}
}
//删除所有标注
_sendDeleteAllAnnotation
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
sendDeleteAllAnnotation
(
_param
);
sendAudioCommandMsg
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_audio_ape
)
{
return
_audio_ape
.
sendAudioBroadcastMsg
(
_param
);
}
}
}
//返回上一步标注
_sendGotoPrev
(
_param
)
{
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
sendGotoPrev
(
_param
);
_getPlayAudioPath
(
_param
)
{
if
(
_audio_ape
)
{
return
_audio_ape
.
getAudioPlayPath
(
_param
);
}
}
}
//DocApe
//获取文档的所有资源地址
_getDocFullAddress
(
_param
)
{
if
(
_doc_ape
)
{
return
_doc_ape
.
getDocFullAddress
(
_param
);
}
else
{
loger
.
error
(
"文档模块还没有创建无法获取"
);
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
"文档模块还没有创建无法获取"
};
_getPublishAudioPath
(
_param
)
{
if
(
_audio_ape
)
{
return
_audio_ape
.
getAudioPublishPath
(
_param
);
}
}
}
//获取文档完整路径
_getDocImageFullPath
(
_param
)
{
if
(
_doc_ape
)
{
return
_doc_ape
.
getDocImageFullPath
(
_param
);
}
else
{
loger
.
error
(
"文档模块还没有创建无法获取"
);
return
[];
_getAudioAllChannelInfo
(
_param
)
{
if
(
_audio_ape
)
{
return
_audio_ape
.
getAllChannelInfo
(
_param
);
}
}
}
_getDocPDFFullPath
(
_param
)
{
if
(
_doc_ape
)
{
return
_doc_ape
.
getDocPDFFullPath
(
_param
);
}
else
{
loger
.
error
(
"文档模块还没有创建,无法获取"
);
return
[];
_publishAudio
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_audio_ape
)
{
return
_audio_ape
.
publishAudio
(
_param
);
}
}
}
//上传文档
_sendDocumentUpload
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
documentUpload
(
_param
);
_stopPublishAudio
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
""
};
}
if
(
_audio_ape
)
{
return
_audio_ape
.
stopPublishAudio
(
_param
);
}
}
}
//切换文档
_sendDocumentSwitchDoc
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
documentSwitchDoc
(
_param
);
//WhiteBoardApe
// 添加标注,发送信息
_sendInsertAnnotaion
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
sendInsetAnnotaion
(
_param
);
}
}
}
//操作文档(翻页)
_sendDocumentSwitchPage
(
_param
)
{
//CursorApe
// 添加鼠标同步
_sendInsertCursor
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
documentSwitchPage
(
_param
);
if
(
_cursor_ape
)
{
_cursor_ape
.
sendInsertCursor
(
_param
);
}
}
//操作文档(页码上的动画步骤操作)
_sendDocumentSwitchAnimation
(
_param
)
{
//删除当前页面上的所有标注
_sendDeleteCurPageAnnotation
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
documentSwitchAnimation
(
_param
);
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
sendDeleteCurPageAnnotation
(
_param
);
}
}
//操作文档(缩放、滚动...)
_sendDocumentCommand
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
documentCommand
(
_param
);
}
}
//删除文档
_sendDocumentDelete
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
documentDelete
(
_param
);
//删除所有标注
_sendDeleteAllAnnotation
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
sendDeleteAllAnnotation
(
_param
);
}
}
}
//删除所有文档
_documentDeleteAll
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
documentDeleteAll
(
_param
);
//返回上一步标注
_sendGotoPrev
(
_param
)
{
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
sendGotoPrev
(
_param
);
}
}
}
//// 文档变更,白板也需要做处理
docUpdateHandler
(
_data
)
{
if
(
!
_mcu
.
connected
&&
!
GlobalConfig
.
isRecordPlayBack
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
//loger.log('Doc UpdateId ->');
//loger.log(_data);
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
docUpdateHandler
(
_data
);
//DocApe
//获取文档的所有资源地址
_getDocFullAddress
(
_param
)
{
if
(
_doc_ape
)
{
return
_doc_ape
.
getDocFullAddress
(
_param
);
}
else
{
loger
.
error
(
"文档模块还没有创建无法获取"
);
return
{
"code"
:
ApeConsts
.
RETURN_FAILED
,
"data"
:
"文档模块还没有创建无法获取"
};
}
}
}
//文档删除,白板也需要做处理
docDeleteHandler
(
_data
)
{
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
docDeleteHandler
(
_data
);
//获取文档完整路径
_getDocImageFullPath
(
_param
)
{
if
(
_doc_ape
)
{
return
_doc_ape
.
getDocImageFullPath
(
_param
);
}
else
{
loger
.
error
(
"文档模块还没有创建无法获取"
);
return
[];
}
}
}
//文档加入频道成功,同步到MCU服务器上的数据
docJoinChannelSuccess
()
{
loger
.
log
(
"docJoinChannelSuccess->isHost="
,
GlobalConfig
.
isHost
,
"length="
,
GlobalConfig
.
docListPrepare
.
length
);
//loger.log("docJoinChannelSuccess docListPrepare=");
//如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
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
);
}
_getDocPDFFullPath
(
_param
)
{
if
(
_doc_ape
)
{
return
_doc_ape
.
getDocPDFFullPath
(
_param
);
}
else
{
loger
.
error
(
"文档模块还没有创建,无法获取"
);
return
[];
}
}
}
//媒体共享模块的接口
//上传
_sendMediaSharedUpload
(
_param
)
{
//上传文档
_sendDocumentUpload
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_mediaShareApe
)
{
_mediaShareApe
.
mediaSharedUpload
(
_param
);
if
(
_doc_ape
)
{
_doc_ape
.
documentUpload
(
_param
);
}
}
//Sass删除媒体文件数据
_sassDeletMediaShare
(
_param
)
{
//切换文档
_sendDocumentSwitchDoc
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
documentSwitchDoc
(
_param
);
}
}
//判断传入的参数是否存在
if
(
_param
==
null
||
EngineUtils
.
isEmptyObject
(
_param
))
{
loger
.
error
(
'删除媒体文件失败->参数错误'
,
_param
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_MEDIASHARE_DELETE_FAILED_PARAM
);
return
;
//操作文档(翻页)
_sendDocumentSwitchPage
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
documentSwitchPage
(
_param
);
}
}
//判断必要的参数字段值
if
(
_param
.
itemIdx
==
null
||
isNaN
(
_param
.
itemIdx
)
||
_param
.
fileId
==
null
||
_param
.
fileId
==
""
)
{
loger
.
error
(
'删除媒体文件失败->'
,
_param
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_MEDIASHARE_DELETE_FAILED_PARAM
);
//操作文档(页码上的动画步骤操作)
_sendDocumentSwitchAnimation
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_doc_ape
)
{
_doc_ape
.
documentSwitchAnimation
(
_param
);
}
}
//操作文档(缩放、滚动...)
_sendDocumentCommand
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
loger
.
log
(
'删除媒体文件->'
,
_param
);
if
(
_sass
)
{
_sass
.
sassDeletMediaShare
(
_param
);
if
(
_doc_ape
)
{
_doc_ape
.
documentCommand
(
_param
);
}
}
//删除
_sendMediaSharedDelete
(
_param
)
{
//删除文档
_sendDocumentDelete
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_mediaShareApe
)
{
_mediaShareApe
.
mediaSharedDelete
(
_param
);
if
(
_doc_ape
)
{
_doc_ape
.
documentDelete
(
_param
);
}
}
//更新媒体文件的状态信息
_sendMediaSharedUpdate
(
_param
)
{
//删除所有文档
_documentDeleteAll
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_mediaShareApe
)
{
_mediaShareApe
.
mediaSharedUpdate
(
_param
);
if
(
_doc_ape
)
{
_doc_ape
.
documentDeleteAll
(
_param
);
}
}
//播放
_sendMediaSharedPlay
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
//// 文档变更,白板也需要做处理
docUpdateHandler
(
_data
)
{
if
(
!
_mcu
.
connected
&&
!
GlobalConfig
.
isRecordPlayBack
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_mediaShareApe
)
{
_mediaShareApe
.
mediaSharedPlay
(
_param
);
//loger.log('Doc UpdateId ->');
//loger.log(_data);
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
docUpdateHandler
(
_data
);
}
}
//停止
_sendMediaSharedStop
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_mediaShareApe
)
{
_mediaShareApe
.
mediaSharedStop
(
_param
);
//文档删除,白板也需要做处理
docDeleteHandler
(
_data
)
{
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
docDeleteHandler
(
_data
);
}
}
}
//媒体共享模块加入频道成功,同步到MCU服务器上的数据
mediaShareApeJoinChannelSuccess
()
{
loger
.
log
(
"媒体共享模块加入频道成功->isHost="
,
GlobalConfig
.
isHost
,
"length="
,
GlobalConfig
.
sharedMediaList
.
length
);
console
.
log
(
"媒体共享模数据->"
,
GlobalConfig
.
sharedMediaList
);
//如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
if
(
GlobalConfig
.
isHost
&&
GlobalConfig
.
sharedMediaList
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
GlobalConfig
.
sharedMediaList
.
length
;
i
++
)
{
let
value
=
GlobalConfig
.
sharedMediaList
[
i
];
if
(
value
)
{
let
paramInfo
=
{
"status"
:
0
,
"creatUserId"
:
value
.
creatUserId
,
"creatUserName"
:
value
.
createUserName
,
"url"
:
value
.
url
,
"fileType"
:
value
.
type
,
"fileId"
:
""
+
value
.
id
,
"fileName"
:
value
.
name
,
"seek"
:
0
};
this
.
_sendMediaSharedUpload
(
paramInfo
);
//文档加入频道成功,同步到MCU服务器上的数据
docJoinChannelSuccess
()
{
loger
.
log
(
"docJoinChannelSuccess->isHost="
,
GlobalConfig
.
isHost
,
"length="
,
GlobalConfig
.
docListPrepare
.
length
);
//loger.log("docJoinChannelSuccess docListPrepare=");
//如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
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
);
}
}
}
}
}
//录制回放相关的处理------------------------------------------------
//录制回放初始化
_initRecordPlayback
(
_param
)
{
//{"classId":"1653304953","portal":"112.126.80.182:80","userRole":"normal","userId":0}
if
(
_param
==
null
)
{
loger
.
error
(
'录制回放初始化失败->参数错误'
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_INIT_RECORD_PLAY_BACK_FAILED
);
return
;
}
//判断必要的参数字段值
if
(
_param
.
classId
==
null
||
isNaN
(
_param
.
classId
)
||
_param
.
portal
==
null
||
_param
.
portal
==
""
)
{
loger
.
error
(
'录制回放初始化失败->'
,
_param
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_INIT_RECORD_PLAY_BACK_FAILED
);
return
;
}
loger
.
log
(
'录制回放初始化->'
,
_param
);
//媒体共享模块的接口
//上传
_sendMediaSharedUpload
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_mediaShareApe
)
{
_mediaShareApe
.
mediaSharedUpload
(
_param
);
}
}
//Sass删除媒体文件数据
_sassDeletMediaShare
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
//保存参数
GlobalConfig
.
isRecordPlayBack
=
true
;
//设置为录制回放状态
GlobalConfig
.
classId
=
parseInt
(
_param
.
classId
);
GlobalConfig
.
portal
=
_param
.
portal
;
GlobalConfig
.
userRole
=
ApeConsts
.
normal
;
//*************很重要,录制回放的时候,身份模式是普通人********
GlobalConfig
.
userId
=
_param
.
userId
||
"0"
;
GlobalConfig
.
userName
=
_param
.
userName
||
""
;
//判断传入的参数是否存在
if
(
_param
==
null
||
EngineUtils
.
isEmptyObject
(
_param
))
{
loger
.
error
(
'删除媒体文件失败->参数错误'
,
_param
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_MEDIASHARE_DELETE_FAILED_PARAM
);
return
;
}
//判断必要的参数字段值
if
(
_param
.
itemIdx
==
null
||
isNaN
(
_param
.
itemIdx
)
||
_param
.
fileId
==
null
||
_param
.
fileId
==
""
)
{
loger
.
error
(
'删除媒体文件失败->'
,
_param
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_MEDIASHARE_DELETE_FAILED_PARAM
);
return
;
}
loger
.
log
(
'删除媒体文件->'
,
_param
);
//获取课堂最完整的数据,录制回放需要获取课堂数据
if
(
_sass
)
{
_sass
.
getClassParam
();
if
(
_sass
)
{
_sass
.
sassDeletMediaShare
(
_param
);
}
}
//删除
_sendMediaSharedDelete
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_mediaShareApe
)
{
_mediaShareApe
.
mediaSharedDelete
(
_param
);
}
}
//更新媒体文件的状态信息
_sendMediaSharedUpdate
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_mediaShareApe
)
{
_mediaShareApe
.
mediaSharedUpdate
(
_param
);
}
}
//播放
_sendMediaSharedPlay
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_mediaShareApe
)
{
_mediaShareApe
.
mediaSharedPlay
(
_param
);
}
}
//停止
_sendMediaSharedStop
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_mediaShareApe
)
{
_mediaShareApe
.
mediaSharedStop
(
_param
);
}
}
}
//开始录制回放
_startRecordPlayback
(
_param
)
{
if
(
_recordPlayback
)
{
_recordPlayback
.
startRecordPlayback
(
_param
);
//媒体共享模块加入频道成功,同步到MCU服务器上的数据
mediaShareApeJoinChannelSuccess
()
{
loger
.
log
(
"媒体共享模块加入频道成功->isHost="
,
GlobalConfig
.
isHost
,
"length="
,
GlobalConfig
.
sharedMediaList
.
length
);
console
.
log
(
"媒体共享模数据->"
,
GlobalConfig
.
sharedMediaList
);
//如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传
if
(
GlobalConfig
.
isHost
&&
GlobalConfig
.
sharedMediaList
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
GlobalConfig
.
sharedMediaList
.
length
;
i
++
)
{
let
value
=
GlobalConfig
.
sharedMediaList
[
i
];
if
(
value
)
{
let
paramInfo
=
{
"status"
:
0
,
"creatUserId"
:
value
.
creatUserId
,
"creatUserName"
:
value
.
createUserName
,
"url"
:
value
.
url
,
"fileType"
:
value
.
type
,
"fileId"
:
""
+
value
.
id
,
"fileName"
:
value
.
name
,
"seek"
:
0
};
this
.
_sendMediaSharedUpload
(
paramInfo
);
}
}
}
}
}
//停止录制回放
_stopRecordPlayback
(
_param
)
{
if
(
_recordPlayback
)
{
_recordPlayback
.
stopRecordPlayback
(
_param
);
}
}
//录制回放相关的处理------------------------------------------------
//录制回放初始化
_initRecordPlayback
(
_param
)
{
//{"classId":"1653304953","portal":"112.126.80.182:80","userRole":"normal","userId":0}
if
(
_param
==
null
)
{
loger
.
error
(
'录制回放初始化失败->参数错误'
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_INIT_RECORD_PLAY_BACK_FAILED
);
return
;
}
//判断必要的参数字段值
if
(
_param
.
classId
==
null
||
isNaN
(
_param
.
classId
)
||
_param
.
portal
==
null
||
_param
.
portal
==
""
)
{
loger
.
error
(
'录制回放初始化失败->'
,
_param
);
this
.
_emit
(
MessageTypes
.
MCU_ERROR
,
MessageTypes
.
ERR_INIT_RECORD_PLAY_BACK_FAILED
);
return
;
}
loger
.
log
(
'录制回放初始化->'
,
_param
);
//暂停录制回放
_pauseRecordPlayback
(
_param
)
{
if
(
_recordPlayback
)
{
_recordPlayback
.
pauseRecordPlayback
(
_param
);
}
}
//保存参数
GlobalConfig
.
isRecordPlayBack
=
true
;
//设置为录制回放状态
GlobalConfig
.
classId
=
parseInt
(
_param
.
classId
);
GlobalConfig
.
portal
=
_param
.
portal
;
GlobalConfig
.
userRole
=
ApeConsts
.
normal
;
//*************很重要,录制回放的时候,身份模式是普通人********
GlobalConfig
.
userId
=
_param
.
userId
||
"0"
;
GlobalConfig
.
userName
=
_param
.
userName
||
""
;
//seek录制回放
_seekRecordPlayback
(
_param
)
{
if
(
_recordPlayback
)
{
_recordPlayback
.
seekRecordPlayback
(
_param
);
//获取课堂最完整的数据,录制回放需要获取课堂数据
if
(
_sass
)
{
_sass
.
getClassParam
();
}
}
}
//录制回放状态更新
_recordPlaybackClearDataHandler
(
_param
)
{
loger
.
log
(
"录制回放状态更新->"
)
if
(
_doc_ape
)
{
_doc_ape
.
clearData
();
}
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
clearData
();
}
if
(
_video_ape
)
{
_video_ape
.
clearData
();
//开始录制回放
_startRecordPlayback
(
_param
)
{
if
(
_recordPlayback
)
{
_recordPlayback
.
startRecordPlayback
(
_param
);
}
}
}
//录制回放加入 课堂成功
_joinRecordPlaybackSuccessHandler
(
_data
)
{
loger
.
log
(
'加入录制回放成功.'
);
GlobalConfig
.
setCurrentStatus
(
GlobalConfig
.
statusCode_2
);
//返回给客户端初始化成功的数据
let
joinClassSuccessCallBackData
=
{};
joinClassSuccessCallBackData
.
isRecordPlayBack
=
GlobalConfig
.
isRecordPlayBack
;
joinClassSuccessCallBackData
.
DOCServerIP
=
GlobalConfig
.
DOCServerIP
;
joinClassSuccessCallBackData
.
DOCServerPort
=
GlobalConfig
.
DOCServerPort
;
joinClassSuccessCallBackData
.
classStatus
=
GlobalConfig
.
classStatus
;
joinClassSuccessCallBackData
.
classId
=
GlobalConfig
.
classId
;
joinClassSuccessCallBackData
.
className
=
GlobalConfig
.
className
;
joinClassSuccessCallBackData
.
h5Module
=
GlobalConfig
.
h5Module
;
joinClassSuccessCallBackData
.
isHost
=
GlobalConfig
.
isHost
;
//
joinClassSuccessCallBackData
.
maxAudioChannels
=
GlobalConfig
.
maxAudioChannels
;
joinClassSuccessCallBackData
.
maxVideoChannels
=
GlobalConfig
.
maxVideoChannels
;
joinClassSuccessCallBackData
.
maxMediaChannels
=
GlobalConfig
.
maxMediaChannels
;
joinClassSuccessCallBackData
.
mcuDelay
=
GlobalConfig
.
mcuDelay
;
joinClassSuccessCallBackData
.
msType
=
GlobalConfig
.
msType
;
joinClassSuccessCallBackData
.
nodeId
=
GlobalConfig
.
nodeId
;
joinClassSuccessCallBackData
.
password
=
GlobalConfig
.
password
;
joinClassSuccessCallBackData
.
passwordRequired
=
GlobalConfig
.
passwordRequired
;
// 老师的默认是true
//GlobalConfig.passwordRequired 老师的默认是true
//GlobalConfig.portal=_data.portal;
joinClassSuccessCallBackData
.
role
=
GlobalConfig
.
role
;
joinClassSuccessCallBackData
.
siteId
=
GlobalConfig
.
siteId
;
joinClassSuccessCallBackData
.
topNodeID
=
GlobalConfig
.
topNodeID
;
joinClassSuccessCallBackData
.
userId
=
GlobalConfig
.
userId
;
joinClassSuccessCallBackData
.
userName
=
GlobalConfig
.
userName
;
joinClassSuccessCallBackData
.
userRole
=
GlobalConfig
.
userRole
;
joinClassSuccessCallBackData
.
userType
=
GlobalConfig
.
userType
;
joinClassSuccessCallBackData
.
siteId
=
GlobalConfig
.
siteId
;
joinClassSuccessCallBackData
.
classId
=
GlobalConfig
.
classId
;
joinClassSuccessCallBackData
.
userRole
=
GlobalConfig
.
userRole
;
joinClassSuccessCallBackData
.
userId
=
GlobalConfig
.
userId
;
joinClassSuccessCallBackData
.
passwordRequired
=
GlobalConfig
.
passwordRequired
;
joinClassSuccessCallBackData
.
classType
=
GlobalConfig
.
classType
||
ApeConsts
.
CLASS_TYPE_1
;
joinClassSuccessCallBackData
.
country
=
GlobalConfig
.
country
;
//国家
joinClassSuccessCallBackData
.
city
=
GlobalConfig
.
city
;
//城市
joinClassSuccessCallBackData
.
province
=
GlobalConfig
.
province
;
//服务商
joinClassSuccessCallBackData
.
isp
=
GlobalConfig
.
isp
;
//服务商
joinClassSuccessCallBackData
.
classTimestamp
=
GlobalConfig
.
classTimestamp
;
//课堂进行的累积时间
joinClassSuccessCallBackData
.
recordTimestamp
=
GlobalConfig
.
recordTimestamp
;
//录制累积的总时间
joinClassSuccessCallBackData
.
recordPlaybackMaxTime
=
GlobalConfig
.
recordPlaybackMaxTime
;
//录制回放的总时间
joinClassSuccessCallBackData
.
fps
=
GlobalConfig
.
fps
;
joinClassSuccessCallBackData
.
gop
=
GlobalConfig
.
gop
;
joinClassSuccessCallBackData
.
videoQuality
=
GlobalConfig
.
videoQuality
;
joinClassSuccessCallBackData
.
ssTunnelAppURL
=
GlobalConfig
.
ssTunnelAppURL
;
joinClassSuccessCallBackData
.
currentSceneTableId
=
GlobalConfig
.
currentSceneTableId
;
//文档区域的模块显示
loger
.
log
(
joinClassSuccessCallBackData
);
//和加入课堂成功使用同样的消息处理
this
.
_emit
(
MessageTypes
.
CLASS_JOIN_SUCCESS
,
joinClassSuccessCallBackData
);
}
// //答题卡
_creatQuestion
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_questionApe
)
{
_questionApe
.
creatQuestion
(
_param
);
//停止录制回放
_stopRecordPlayback
(
_param
)
{
if
(
_recordPlayback
)
{
_recordPlayback
.
stopRecordPlayback
(
_param
);
}
}
}
_getQuestion
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
//暂停录制回放
_pauseRecordPlayback
(
_param
)
{
if
(
_recordPlayback
)
{
_recordPlayback
.
pauseRecordPlayback
(
_param
);
}
}
if
(
_questionApe
)
{
_questionApe
.
getQuestion
(
_param
);
//seek录制回放
_seekRecordPlayback
(
_param
)
{
if
(
_recordPlayback
)
{
_recordPlayback
.
seekRecordPlayback
(
_param
);
}
}
}
_getQuestionResult
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
//录制回放状态更新
_recordPlaybackClearDataHandler
(
_param
)
{
loger
.
log
(
"录制回放状态更新->"
)
if
(
_doc_ape
)
{
_doc_ape
.
clearData
();
}
if
(
_whiteboard_ape
)
{
_whiteboard_ape
.
clearData
();
}
if
(
_video_ape
)
{
_video_ape
.
clearData
();
}
}
if
(
_questionApe
)
{
_questionApe
.
getQuestionResult
(
_param
);
//录制回放加入 课堂成功
_joinRecordPlaybackSuccessHandler
(
_data
)
{
loger
.
log
(
'加入录制回放成功.'
);
GlobalConfig
.
setCurrentStatus
(
GlobalConfig
.
statusCode_2
);
//返回给客户端初始化成功的数据
let
joinClassSuccessCallBackData
=
{};
joinClassSuccessCallBackData
.
isRecordPlayBack
=
GlobalConfig
.
isRecordPlayBack
;
joinClassSuccessCallBackData
.
DOCServerIP
=
GlobalConfig
.
DOCServerIP
;
joinClassSuccessCallBackData
.
DOCServerPort
=
GlobalConfig
.
DOCServerPort
;
joinClassSuccessCallBackData
.
classStatus
=
GlobalConfig
.
classStatus
;
joinClassSuccessCallBackData
.
classId
=
GlobalConfig
.
classId
;
joinClassSuccessCallBackData
.
className
=
GlobalConfig
.
className
;
joinClassSuccessCallBackData
.
h5Module
=
GlobalConfig
.
h5Module
;
joinClassSuccessCallBackData
.
isHost
=
GlobalConfig
.
isHost
;
//
joinClassSuccessCallBackData
.
maxAudioChannels
=
GlobalConfig
.
maxAudioChannels
;
joinClassSuccessCallBackData
.
maxVideoChannels
=
GlobalConfig
.
maxVideoChannels
;
joinClassSuccessCallBackData
.
maxMediaChannels
=
GlobalConfig
.
maxMediaChannels
;
joinClassSuccessCallBackData
.
mcuDelay
=
GlobalConfig
.
mcuDelay
;
joinClassSuccessCallBackData
.
msType
=
GlobalConfig
.
msType
;
joinClassSuccessCallBackData
.
nodeId
=
GlobalConfig
.
nodeId
;
joinClassSuccessCallBackData
.
password
=
GlobalConfig
.
password
;
joinClassSuccessCallBackData
.
passwordRequired
=
GlobalConfig
.
passwordRequired
;
// 老师的默认是true
//GlobalConfig.passwordRequired 老师的默认是true
//GlobalConfig.portal=_data.portal;
joinClassSuccessCallBackData
.
role
=
GlobalConfig
.
role
;
joinClassSuccessCallBackData
.
siteId
=
GlobalConfig
.
siteId
;
joinClassSuccessCallBackData
.
topNodeID
=
GlobalConfig
.
topNodeID
;
joinClassSuccessCallBackData
.
userId
=
GlobalConfig
.
userId
;
joinClassSuccessCallBackData
.
userName
=
GlobalConfig
.
userName
;
joinClassSuccessCallBackData
.
userRole
=
GlobalConfig
.
userRole
;
joinClassSuccessCallBackData
.
userType
=
GlobalConfig
.
userType
;
joinClassSuccessCallBackData
.
siteId
=
GlobalConfig
.
siteId
;
joinClassSuccessCallBackData
.
classId
=
GlobalConfig
.
classId
;
joinClassSuccessCallBackData
.
userRole
=
GlobalConfig
.
userRole
;
joinClassSuccessCallBackData
.
userId
=
GlobalConfig
.
userId
;
joinClassSuccessCallBackData
.
passwordRequired
=
GlobalConfig
.
passwordRequired
;
joinClassSuccessCallBackData
.
classType
=
GlobalConfig
.
classType
||
ApeConsts
.
CLASS_TYPE_1
;
joinClassSuccessCallBackData
.
country
=
GlobalConfig
.
country
;
//国家
joinClassSuccessCallBackData
.
city
=
GlobalConfig
.
city
;
//城市
joinClassSuccessCallBackData
.
province
=
GlobalConfig
.
province
;
//服务商
joinClassSuccessCallBackData
.
isp
=
GlobalConfig
.
isp
;
//服务商
joinClassSuccessCallBackData
.
classTimestamp
=
GlobalConfig
.
classTimestamp
;
//课堂进行的累积时间
joinClassSuccessCallBackData
.
recordTimestamp
=
GlobalConfig
.
recordTimestamp
;
//录制累积的总时间
joinClassSuccessCallBackData
.
recordPlaybackMaxTime
=
GlobalConfig
.
recordPlaybackMaxTime
;
//录制回放的总时间
joinClassSuccessCallBackData
.
fps
=
GlobalConfig
.
fps
;
joinClassSuccessCallBackData
.
gop
=
GlobalConfig
.
gop
;
joinClassSuccessCallBackData
.
videoQuality
=
GlobalConfig
.
videoQuality
;
joinClassSuccessCallBackData
.
ssTunnelAppURL
=
GlobalConfig
.
ssTunnelAppURL
;
joinClassSuccessCallBackData
.
currentSceneTableId
=
GlobalConfig
.
currentSceneTableId
;
//文档区域的模块显示
loger
.
log
(
joinClassSuccessCallBackData
);
//和加入课堂成功使用同样的消息处理
this
.
_emit
(
MessageTypes
.
CLASS_JOIN_SUCCESS
,
joinClassSuccessCallBackData
);
}
// //答题卡
_creatQuestion
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_questionApe
)
{
_questionApe
.
creatQuestion
(
_param
);
}
}
}
_stopQuestion
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
_getQuestion
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_questionApe
)
{
_questionApe
.
getQuestion
(
_param
);
}
}
if
(
_questionApe
)
{
_questionApe
.
stopQuestion
(
_param
);
_getQuestionResult
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_questionApe
)
{
_questionApe
.
getQuestionResult
(
_param
);
}
}
}
_sendAnswer
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
_stopQuestion
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_questionApe
)
{
_questionApe
.
stopQuestion
(
_param
);
}
}
if
(
_questionApe
)
{
_questionApe
.
sendAnswer
(
_param
);
_sendAnswer
(
_param
)
{
if
(
!
_mcu
.
connected
)
{
loger
.
warn
(
GlobalConfig
.
getCurrentStatus
());
return
;
}
if
(
_questionApe
)
{
_questionApe
.
sendAnswer
(
_param
);
}
}
}
}
}
...
...
src/EngineUtils.js
查看文件 @
7029aa7
...
...
@@ -37,7 +37,7 @@ class EngineUtils{
//生成时间戳毫秒
static
creatTimestamp
(){
let
time
=
parseInt
(
new
Date
().
getTime
()
/
1000
);
//精确到
毫
秒
let
time
=
parseInt
(
new
Date
().
getTime
()
/
1000
);
//精确到秒
return
time
;
}
//生成时间戳 string
...
...
src/GlobalConfig.js
查看文件 @
7029aa7
...
...
@@ -460,6 +460,7 @@ GlobalConfig.allowRecordMaxTime = 14400; //(秒)允许录制的最长时间,
GlobalConfig
.
siteId_letv
=
'shchuanbao'
;
//乐视,MS不需要动态选点的站点
GlobalConfig
.
ssTunnelAppURL
=
''
;
//屏幕共享插件的地址
GlobalConfig
.
serverTime
=
0
;
//服务器当前时间戳
GlobalConfig
.
serverAndLoacTimeDistanc
=
0
;
//本地时间和服务器时间错的差值;
export
default
GlobalConfig
;
...
...
src/MessageTypes.js
查看文件 @
7029aa7
...
...
@@ -89,15 +89,11 @@ MessageTypes.DOC_BROADCAST = "doc_broadcast"; //
MessageTypes
.
MEDIA_SHARED_DELETE
=
"media_shared_delete"
;
//删除媒体文件
MessageTypes
.
MEDIA_SHARED_UPDATE
=
"media_shared_update"
;
//更新媒体文件(添加、变更)
//答题卡
//答题卡
和点名共用
MessageTypes
.
START_ANSWER_QUESTION
=
"start_answer_question"
;
//开始答题
MessageTypes
.
UPDATE_ANSWER_QUESTION
=
"update_answer_question"
;
//更新答题数据
MessageTypes
.
STOP_ANSWER_QUESTION
=
"stop_answer_question"
;
//停止答题
//点名
MessageTypes
.
START_CALL_THE_ROLL
=
"start_call_the_roll"
;
//开始点名
MessageTypes
.
UPDATE_CALL_THE_ROLL
=
"update_call_the_roll"
;
//更新点名数据
MessageTypes
.
STOP_CALL_THE_ROLL
=
"stop_call_the_roll"
;
//停止点名
MessageTypes
.
UPDATE_QUESTION_TIME
=
"update_question_time"
;
//更新答题时间
//白板笔记事件定义
MessageTypes
.
WHITEBOARD_ANNOTATION_UPDATE
=
"whiteboard_annotation_update"
;
// 'whiteboard.annotation.update';
...
...
src/apes/QuestionApe.js
查看文件 @
7029aa7
...
...
@@ -23,8 +23,10 @@ class QuestionApe extends Ape {
ApeConsts
.
QUESTION_SESSION_NAME
,
ApeConsts
.
QUESTION_SESSION_TAG
);
this
.
questionList
=
{};
//MCU同步的题目数据
this
.
questionDataList
=
{};
//Sass保存的题目内容数据
this
.
questionTimer
=
new
TimerCounter
();
//答题卡计时器
this
.
questionTimer
.
addTimerCallBack
(
this
.
questionTimerCounterUptate
.
bind
(
this
),
1
);
//计时器监听
//监听Sass事件
this
.
_sass
=
Sass
;
...
...
@@ -47,6 +49,34 @@ class QuestionApe extends Ape {
this
.
registerObj
(
pdu
.
RCPDU_REG_REGISTER_TABLE
,
ApeConsts
.
CONFERENCE_OBJ_QUESTION_ID
,
ApeConsts
.
CONFERENCE_OBJ_QUESTION_NAME
,
ApeConsts
.
CONFERENCE_OBJ_QUESTION_TAG
,
0
,
new
ArrayBuffer
);
}
//答题卡计时器
questionTimerCounterUptate
()
{
if
(
!
this
.
mcu
.
connected
)
{
loger
.
warn
(
'MCU 连接已经断开'
);
if
(
this
.
questionTimer
){
this
.
questionTimer
.
stopTimer
();
}
}
//console.log("时间差:"+GlobalConfig.serverAndLoacTimeDistanc+' questionTimerCounterUptate',this.questionList);
for
(
let
key
in
this
.
questionList
){
let
question
=
this
.
questionList
[
key
];
if
(
question
){
let
currentTime
=
EngineUtils
.
creatTimestamp
()
-
GlobalConfig
.
serverAndLoacTimeDistanc
;
//将当的时间减去服务器时间差
let
timestamp
=
parseInt
(
question
.
timeLimit
-
(
currentTime
-
question
.
timestamp
));
if
(
timestamp
>=
0
){
loger
.
log
(
"question->type:"
+
question
.
type
,
"倒计时:"
+
timestamp
);
this
.
_emit
(
MessageTypes
.
UPDATE_QUESTION_TIME
,{
type
:
question
.
type
,
itemIdx
:
question
.
itemIdx
,
timestamp
:
timestamp
});
}
else
{
this
.
stopQuestion
({
itemIdx
:
question
.
itemIdx
});
}
}
}
if
(
this
.
questionTimer
&&
Object
.
keys
(
this
.
questionList
).
length
<
1
){
this
.
questionTimer
.
stopTimer
();
}
}
//更新信息
sendUpdaterTable
(
_param
)
{
...
...
@@ -140,34 +170,33 @@ class QuestionApe extends Ape {
//停止答题
loger
.
log
(
"更新答题数据"
);
if
(
GlobalConfig
.
isHost
){
//老师,只统计数据,不答题
//先判断时间是否超时
let
timeDistance
=
EngineUtils
.
creatTimestamp
()
-
model
.
timestamp
;
loger
.
log
(
"答题卡显示倒计时->timeDistance:"
+
timeDistance
);
timeDistance
=
model
.
timeLimit
-
timeDistance
;
if
(
timeDistance
<=
0
){
//答题卡时间到,需要停止
loger
.
log
(
"答题卡时间到->需要停止"
);
this
.
stopQuestion
(
model
);
}
else
{
this
.
getQuestionResult
(
model
);
}
////老师,只统计数据,不答题
////先判断时间是否超时
//let timeDistance=EngineUtils.creatTimestamp()-model.timestamp;
//loger.log("答题卡显示倒计时->timeDistance:"+timeDistance);
//timeDistance=model.timeLimit-timeDistance;
//if(timeDistance<=0){
// //答题卡时间到,需要停止
// loger.log("答题卡时间到->需要停止");
// this.stopQuestion(model);
//}else {
// this.getQuestionResult(model);
//}
this
.
getQuestionResult
(
model
);
}
else
if
(
GlobalConfig
.
isNormal
)
{
//学生->如果自己已经提交过答案就不需要再显示
if
(
model
.
totalUserList
.
indexOf
(
GlobalConfig
.
userId
)
>=
0
){
loger
.
log
(
"已经提交过答案-不需要显示答题卡->userId:"
+
GlobalConfig
.
userId
);
//delete this.questionList[itemIdx];
}
else
{
//显示答题卡数据
this
.
_emit
(
MessageTypes
.
START_ANSWER_QUESTION
,
model
);
}
}
if
(
this
.
questionTimer
){
this
.
questionTimer
.
startTimer
();
}
break
;
//case 4:
// //停止点名
// loger.log("更新点名数据");
// this._emit(MessageTypes.UPDATE_CALL_THE_ROLL,model);
// break;
default
:
break
;
}
...
...
@@ -191,15 +220,17 @@ class QuestionApe extends Ape {
case
1
:
case
2
:
case
3
:
case
4
:
case
100
:
//停止答题
loger
.
log
(
"停止答题->"
,
itemDataInfo
);
this
.
_emit
(
MessageTypes
.
STOP_ANSWER_QUESTION
,
itemDataInfo
);
break
;
case
4
:
//停止点名
loger
.
log
(
"停止点名"
);
this
.
_emit
(
MessageTypes
.
STOP_CALL_THE_ROLL
,
itemDataInfo
);
break
;
//case 100:
// //停止点名
// loger.log("停止点名");
// this._emit(MessageTypes.STOP_CALL_THE_ROLL,itemDataInfo);
// break;
default
:
break
;
}
...
...
@@ -234,7 +265,7 @@ class QuestionApe extends Ape {
modelPdu
.
type
=
parseInt
(
_param
.
type
)
||
0
;
modelPdu
.
questionId
=
parseInt
(
_param
.
questionId
)
||
0
;
modelPdu
.
timeLimit
=
parseInt
(
_param
.
timeLimit
)
||
1
;
//有效时间
modelPdu
.
timestamp
=
parseInt
(
_param
.
timestamp
)
||
EngineUtils
.
creatTimestamp
();
//创建的时间
modelPdu
.
timestamp
=
parseInt
(
_param
.
timestamp
)
||
parseInt
(
EngineUtils
.
creatTimestamp
()
-
GlobalConfig
.
serverAndLoacTimeDistanc
);;
//创建的时间(秒)
modelPdu
.
content
=
_param
.
content
||
[];
//题干
modelPdu
.
options
=
_param
.
options
||
[];
//选项列表
modelPdu
.
answer
=
_param
.
answer
||
[];
//用户选择的选项索引
...
...
@@ -352,16 +383,11 @@ class QuestionApe extends Ape {
_sassCreatQuestionSuccessHandler
(
_data
){
//loger.log("创建答题卡成功",_data);
if
(
_data
){
//this.questionDataList[_data.questionId]=_data;//保存题目数据
//获取当前对方系统时间,再减去服务器时间差
let
timestamp
=
parseInt
(
EngineUtils
.
creatTimestamp
()
-
GlobalConfig
.
serverAndLoacTimeDistanc
);
//创建答题卡的时间(秒)
let
questionItem
=
_data
;
/* //判断是答题还是点名,type=100的时候是点名
if(questionItem.type==100){
questionItem.itemIdx=ApeConsts.CONFERENCE_OBJ_QUESTION_ID+1;
}else {
questionItem.itemIdx=ApeConsts.CONFERENCE_OBJ_QUESTION_ID;
}*/
questionItem
.
itemIdx
=
EngineUtils
.
creatTimestamp
();
questionItem
.
itemIdx
=
timestamp
;
questionItem
.
timestamp
=
timestamp
;
this
.
sendUpdaterTable
(
questionItem
);
}
...
...
请
注册
或
登录
后发表评论