正在显示
6 个修改的文件
包含
1333 行增加
和
701 行删除
| @@ -28,6 +28,7 @@ import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | @@ -28,6 +28,7 @@ import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | ||
| 28 | import Server from "config/Server"; | 28 | import Server from "config/Server"; |
| 29 | import MediaModule from 'apes/MediaModule'; | 29 | import MediaModule from 'apes/MediaModule'; |
| 30 | import MediaSharedApe from 'apes/MediaSharedApe'; | 30 | import MediaSharedApe from 'apes/MediaSharedApe'; |
| 31 | +import MusicSharedApe from 'apes/MusicSharedApe'; | ||
| 31 | import QuestionApe from 'apes/QuestionApe'; | 32 | import QuestionApe from 'apes/QuestionApe'; |
| 32 | 33 | ||
| 33 | import UTF8 from 'utf-8'; | 34 | import UTF8 from 'utf-8'; |
| @@ -48,6 +49,7 @@ let _whiteboard_ape; | @@ -48,6 +49,7 @@ let _whiteboard_ape; | ||
| 48 | let _cursor_ape; | 49 | let _cursor_ape; |
| 49 | let _recordPlayback; | 50 | let _recordPlayback; |
| 50 | let _mediaShareApe; | 51 | let _mediaShareApe; |
| 52 | +let _musicShareApe; | ||
| 51 | let _questionApe; | 53 | let _questionApe; |
| 52 | 54 | ||
| 53 | //MCUClient 外部实例化主类 | 55 | //MCUClient 外部实例化主类 |
| @@ -125,6 +127,10 @@ export default class MessageEntrance extends Emiter { | @@ -125,6 +127,10 @@ export default class MessageEntrance extends Emiter { | ||
| 125 | _mediaShareApe.on('*', (type, data) => this._emit(type, data)); | 127 | _mediaShareApe.on('*', (type, data) => this._emit(type, data)); |
| 126 | _mediaShareApe.on(MediaSharedApe.MEDIASHARED_JOIN_CHANNEL_SUCCESS, this.mediaShareApeJoinChannelSuccess.bind(this)); | 128 | _mediaShareApe.on(MediaSharedApe.MEDIASHARED_JOIN_CHANNEL_SUCCESS, this.mediaShareApeJoinChannelSuccess.bind(this)); |
| 127 | 129 | ||
| 130 | + _musicShareApe = new MusicSharedApe(); | ||
| 131 | + _musicShareApe.on('*', (type, data) => this._emit(type, data)); | ||
| 132 | + _musicShareApe.on(MusicSharedApe.MUSICSHARED_JOIN_CHANNEL_SUCCESS, this.musicShareApeJoinChannelSuccess.bind(this)); | ||
| 133 | + | ||
| 128 | _whiteboard_ape = new WhiteBoardApe(); | 134 | _whiteboard_ape = new WhiteBoardApe(); |
| 129 | _whiteboard_ape.on('*', (type, data) => this._emit(type, data)); | 135 | _whiteboard_ape.on('*', (type, data) => this._emit(type, data)); |
| 130 | 136 | ||
| @@ -221,6 +227,10 @@ export default class MessageEntrance extends Emiter { | @@ -221,6 +227,10 @@ export default class MessageEntrance extends Emiter { | ||
| 221 | this.mediaSharedStop = this._sendMediaSharedStop.bind(this); //停止 | 227 | this.mediaSharedStop = this._sendMediaSharedStop.bind(this); //停止 |
| 222 | this.mediaSharedUpdate = this._sendMediaSharedUpdate.bind(this); //更新媒体的状态 | 228 | this.mediaSharedUpdate = this._sendMediaSharedUpdate.bind(this); //更新媒体的状态 |
| 223 | 229 | ||
| 230 | + this.musicSharedPlay = this._sendMusicSharedPlay.bind(this); //Music播放 | ||
| 231 | + this.musicSharedStop = this._sendMusicSharedStop.bind(this); //Music停止 | ||
| 232 | + this.musicSharedUpdate = this._sendMusicSharedUpdate.bind(this); //Music更新媒体的状态 | ||
| 233 | + | ||
| 224 | //答题卡 | 234 | //答题卡 |
| 225 | this.creatQuestion = this._creatQuestion.bind(this); | 235 | this.creatQuestion = this._creatQuestion.bind(this); |
| 226 | this.getQuestion = this._getQuestion.bind(this); | 236 | this.getQuestion = this._getQuestion.bind(this); |
| @@ -1233,821 +1243,894 @@ export default class MessageEntrance extends Emiter { | @@ -1233,821 +1243,894 @@ export default class MessageEntrance extends Emiter { | ||
| 1233 | } | 1243 | } |
| 1234 | } | 1244 | } |
| 1235 | 1245 | ||
| 1236 | - | ||
| 1237 | - //获取课堂所有参数 api/meeting/detail.do? flash中的接口文件是 getClassParam.do | 1246 | + //获取课堂所有参数 api/meeting/detail.do? flash中的接口文件是 getClassParam.do |
| 1238 | _sassGetClassParamSuccessHandler(_data) { | 1247 | _sassGetClassParamSuccessHandler(_data) { |
| 1239 | - loger.log('获取课堂课堂信息完成.'); | ||
| 1240 | - //包含整个课堂最全的信息,储存数据 | ||
| 1241 | - if (_data) { | ||
| 1242 | - GlobalConfig.mcuDelay = _data.h5Delay || 0; //mcu消息延迟的时间间隔,单位(秒),结合客户端传的messageDelay的值使用 | ||
| 1243 | - GlobalConfig.className = _data.meetingName || ""; | ||
| 1244 | - GlobalConfig.classBeginTime = _data.beginTime || ""; | ||
| 1245 | - GlobalConfig.classEndTime = _data.endTime || ""; | ||
| 1246 | - GlobalConfig.userIp = _data.userIp || ""; | ||
| 1247 | - | ||
| 1248 | - GlobalConfig.maxVideoChannels = _data.maxVideoChannels; | ||
| 1249 | - GlobalConfig.maxAudioChannels = _data.maxAudioChannels; | ||
| 1250 | - GlobalConfig.maxMediaChannels = Math.max(GlobalConfig.maxVideoChannels, GlobalConfig.maxAudioChannels); | ||
| 1251 | - | ||
| 1252 | - GlobalConfig.ssTunnelAppURL = _data.ssTunnelAppURL || ''; //屏幕共享插件的地址 | ||
| 1253 | - | ||
| 1254 | - //视频质量相关设置,每次加入课堂都按最新的获取设置 | ||
| 1255 | - GlobalConfig.fps = _data.fps || 15; | ||
| 1256 | - GlobalConfig.gop = _data.gop || 3; | ||
| 1257 | - GlobalConfig.videoQuality = parseInt(_data.videoQuality); | ||
| 1258 | - GlobalConfig.curVideoQuality = GlobalConfig.videoQuality; | ||
| 1259 | - | ||
| 1260 | - //是否自动开始(身份是host的时候才用到的) | ||
| 1261 | - GlobalConfig.isAutoStartClass = _data.autoRecord || 0; | ||
| 1262 | - | ||
| 1263 | - GlobalConfig.serverTime = _data.serverTime || new Date().getTime(); //获取服务器时间戳 | ||
| 1264 | - GlobalConfig.serverAndLoacTimeDistanc = (new Date().getTime() - GlobalConfig.serverTime) / 1000; //当前系统时间和服务器时间的差值 (秒) | ||
| 1265 | - loger.warn("服务器时间:" + GlobalConfig.serverTime + " 系统时间:" + new Date().getTime() + " 时间差:" + GlobalConfig.serverAndLoacTimeDistanc); | ||
| 1266 | - | ||
| 1267 | - GlobalConfig.setDocListPrepare(_data.docListPrepare); //提前上传的文档列表 | ||
| 1268 | - GlobalConfig.setRecordList(_data.recordList); //录制回放地址 | ||
| 1269 | - GlobalConfig.setDocList(_data.docList); //文档地址 | ||
| 1270 | - GlobalConfig.setMsList(_data.msList); //推流播流服务器地址(需要对列表中的地址进行分类,里面包含了推流和拉流的地址,目前主要是乐视的需要区分开) | ||
| 1271 | - GlobalConfig.setRsList(_data.rsList); //播放m3u8格式的地址(录制回放时使用) | ||
| 1272 | - GlobalConfig.setMcuList(_data.mcuList); //mcu | ||
| 1273 | - GlobalConfig.setMusicList(_data.musicList); // | ||
| 1274 | - GlobalConfig.setMusicListPrepare(_data.musicListPrepare); //提前上传的声音文件列表 | ||
| 1275 | - GlobalConfig.setVideoCDNAddr(_data.videoCDNAddr); //cdn加速的拉流地址,直播的时候才使用 | ||
| 1276 | - GlobalConfig.setMediaShareList(_data.sharedMediaList); //提前上传的媒体共享文件列表 | ||
| 1277 | - | ||
| 1278 | - //MCU地址 | ||
| 1279 | - if (_data.mcuList && _data.mcuList.length > 0) { | ||
| 1280 | - //随机选择一个 | ||
| 1281 | - let index = parseInt(Math.random() * _data.mcuList.length); | ||
| 1282 | - GlobalConfig.MCUServerIP = _data.mcuList[index].ip || ""; | ||
| 1283 | - GlobalConfig.MCUServerPort = _data.mcuList[index].port || ""; | ||
| 1284 | - loger.log('初始->MCU->.', GlobalConfig.MCUServerIP, GlobalConfig.MCUServerPort); | ||
| 1285 | - } | 1248 | + loger.log('获取课堂课堂信息完成.'); |
| 1249 | + //包含整个课堂最全的信息,储存数据 | ||
| 1250 | + if (_data) { | ||
| 1251 | + GlobalConfig.mcuDelay = _data.h5Delay || 0; //mcu消息延迟的时间间隔,单位(秒),结合客户端传的messageDelay的值使用 | ||
| 1252 | + GlobalConfig.className = _data.meetingName || ""; | ||
| 1253 | + GlobalConfig.classBeginTime = _data.beginTime || ""; | ||
| 1254 | + GlobalConfig.classEndTime = _data.endTime || ""; | ||
| 1255 | + GlobalConfig.userIp = _data.userIp || ""; | ||
| 1256 | + | ||
| 1257 | + GlobalConfig.maxVideoChannels = _data.maxVideoChannels; | ||
| 1258 | + GlobalConfig.maxAudioChannels = _data.maxAudioChannels; | ||
| 1259 | + GlobalConfig.maxMediaChannels = Math.max(GlobalConfig.maxVideoChannels, GlobalConfig.maxAudioChannels); | ||
| 1260 | + | ||
| 1261 | + GlobalConfig.ssTunnelAppURL = _data.ssTunnelAppURL || ''; //屏幕共享插件的地址 | ||
| 1262 | + | ||
| 1263 | + //视频质量相关设置,每次加入课堂都按最新的获取设置 | ||
| 1264 | + GlobalConfig.fps = _data.fps || 15; | ||
| 1265 | + GlobalConfig.gop = _data.gop || 3; | ||
| 1266 | + GlobalConfig.videoQuality = parseInt(_data.videoQuality); | ||
| 1267 | + GlobalConfig.curVideoQuality = GlobalConfig.videoQuality; | ||
| 1268 | + | ||
| 1269 | + //是否自动开始(身份是host的时候才用到的) | ||
| 1270 | + GlobalConfig.isAutoStartClass = _data.autoRecord || 0; | ||
| 1271 | + | ||
| 1272 | + GlobalConfig.serverTime = _data.serverTime || new Date().getTime(); //获取服务器时间戳 | ||
| 1273 | + GlobalConfig.serverAndLoacTimeDistanc = (new Date().getTime() - GlobalConfig.serverTime) / 1000; //当前系统时间和服务器时间的差值 (秒) | ||
| 1274 | + loger.warn("服务器时间:" + GlobalConfig.serverTime + " 系统时间:" + new Date().getTime() + " 时间差:" + GlobalConfig.serverAndLoacTimeDistanc); | ||
| 1275 | + | ||
| 1276 | + GlobalConfig.setDocListPrepare(_data.docListPrepare); //提前上传的文档列表 | ||
| 1277 | + GlobalConfig.setRecordList(_data.recordList); //录制回放地址 | ||
| 1278 | + GlobalConfig.setDocList(_data.docList); //文档地址 | ||
| 1279 | + GlobalConfig.setMsList(_data.msList); //推流播流服务器地址(需要对列表中的地址进行分类,里面包含了推流和拉流的地址,目前主要是乐视的需要区分开) | ||
| 1280 | + GlobalConfig.setRsList(_data.rsList); //播放m3u8格式的地址(录制回放时使用) | ||
| 1281 | + GlobalConfig.setMcuList(_data.mcuList); //mcu | ||
| 1282 | + GlobalConfig.setMusicList(_data.musicList); // | ||
| 1283 | + GlobalConfig.setMusicListPrepare(_data.musicListPrepare); //提前上传的声音文件列表 | ||
| 1284 | + GlobalConfig.setVideoCDNAddr(_data.videoCDNAddr); //cdn加速的拉流地址,直播的时候才使用 | ||
| 1285 | + GlobalConfig.setMediaShareList(_data.sharedMediaList); //提前上传的媒体共享文件列表 | ||
| 1286 | + | ||
| 1287 | + //MCU地址 | ||
| 1288 | + if (_data.mcuList && _data.mcuList.length > 0) { | ||
| 1289 | + //随机选择一个 | ||
| 1290 | + let index = parseInt(Math.random() * _data.mcuList.length); | ||
| 1291 | + GlobalConfig.MCUServerIP = _data.mcuList[index].ip || ""; | ||
| 1292 | + GlobalConfig.MCUServerPort = _data.mcuList[index].port || ""; | ||
| 1293 | + loger.log('初始->MCU->.', GlobalConfig.MCUServerIP, GlobalConfig.MCUServerPort); | ||
| 1294 | + } | ||
| 1286 | 1295 | ||
| 1287 | - //录制回放时m3u8播流地址 | ||
| 1288 | - if (_data.rsList && _data.rsList.length > 0) { | ||
| 1289 | - let index = parseInt(Math.random() * _data.rsList.length); | ||
| 1290 | - GlobalConfig.RS_RECORD_PLAY_IP = _data.rsList[index].ip || ""; | ||
| 1291 | - GlobalConfig.RS_RECORD_PLAY_PORT = _data.rsList[index].port || ""; | ||
| 1292 | - loger.log('初始->RS->.', GlobalConfig.RS_RECORD_PLAY_IP, GlobalConfig.RS_RECORD_PLAY_PORT); | ||
| 1293 | - } | 1296 | + //录制回放时m3u8播流地址 |
| 1297 | + if (_data.rsList && _data.rsList.length > 0) { | ||
| 1298 | + let index = parseInt(Math.random() * _data.rsList.length); | ||
| 1299 | + GlobalConfig.RS_RECORD_PLAY_IP = _data.rsList[index].ip || ""; | ||
| 1300 | + GlobalConfig.RS_RECORD_PLAY_PORT = _data.rsList[index].port || ""; | ||
| 1301 | + loger.log('初始->RS->.', GlobalConfig.RS_RECORD_PLAY_IP, GlobalConfig.RS_RECORD_PLAY_PORT); | ||
| 1302 | + } | ||
| 1294 | 1303 | ||
| 1295 | - //上课中音视频推流地址 | ||
| 1296 | - if (GlobalConfig.msList && GlobalConfig.msList.length > 0) { | ||
| 1297 | - let index = parseInt(Math.random() * GlobalConfig.msList.length); | ||
| 1298 | - GlobalConfig.MS_PUBLISH_IP = GlobalConfig.msList[index].ip || ""; | ||
| 1299 | - GlobalConfig.MS_PUBLISH_PORT = GlobalConfig.msList[index].port || ""; | ||
| 1300 | - } | ||
| 1301 | - loger.log('初始->MS->.', GlobalConfig.MS_PUBLISH_IP, GlobalConfig.MS_PUBLISH_PORT); | ||
| 1302 | - | ||
| 1303 | - //播流的地址和推流地址需要分开的时候,单独设置拉流的地址 rtmp(目前乐视使用) | ||
| 1304 | - if (GlobalConfig.pullRtmpList && GlobalConfig.pullRtmpList.length > 0) { | ||
| 1305 | - //有单独的rtmp拉流地址 | ||
| 1306 | - let index = parseInt(Math.random() * GlobalConfig.pullRtmpList.length); | ||
| 1307 | - GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.pullRtmpList[index].ip || ""; | ||
| 1308 | - GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.pullRtmpList[index].port || ""; | ||
| 1309 | - } else { | ||
| 1310 | - //如果没有单独的rtmp拉流地址,和推流地址一样即可 | ||
| 1311 | - GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.MS_PUBLISH_IP; | ||
| 1312 | - GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.MS_PUBLISH_PORT; | ||
| 1313 | - } | 1304 | + //上课中音视频推流地址 |
| 1305 | + if (GlobalConfig.msList && GlobalConfig.msList.length > 0) { | ||
| 1306 | + let index = parseInt(Math.random() * GlobalConfig.msList.length); | ||
| 1307 | + GlobalConfig.MS_PUBLISH_IP = GlobalConfig.msList[index].ip || ""; | ||
| 1308 | + GlobalConfig.MS_PUBLISH_PORT = GlobalConfig.msList[index].port || ""; | ||
| 1309 | + } | ||
| 1310 | + loger.log('初始->MS->.', GlobalConfig.MS_PUBLISH_IP, GlobalConfig.MS_PUBLISH_PORT); | ||
| 1311 | + | ||
| 1312 | + //播流的地址和推流地址需要分开的时候,单独设置拉流的地址 rtmp(目前乐视使用) | ||
| 1313 | + if (GlobalConfig.pullRtmpList && GlobalConfig.pullRtmpList.length > 0) { | ||
| 1314 | + //有单独的rtmp拉流地址 | ||
| 1315 | + let index = parseInt(Math.random() * GlobalConfig.pullRtmpList.length); | ||
| 1316 | + GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.pullRtmpList[index].ip || ""; | ||
| 1317 | + GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.pullRtmpList[index].port || ""; | ||
| 1318 | + } else { | ||
| 1319 | + //如果没有单独的rtmp拉流地址,和推流地址一样即可 | ||
| 1320 | + GlobalConfig.MS_PLAY_RTMP_IP = GlobalConfig.MS_PUBLISH_IP; | ||
| 1321 | + GlobalConfig.MS_PLAY_RTMP_PORT = GlobalConfig.MS_PUBLISH_PORT; | ||
| 1322 | + } | ||
| 1314 | 1323 | ||
| 1315 | - loger.log('初始->MSPull->.', GlobalConfig.MS_PLAY_RTMP_IP, GlobalConfig.MS_PLAY_RTMP_PORT); | ||
| 1316 | - | ||
| 1317 | - //播流的地址和推流地址需要分开的时候,单独设置拉流的地址 hls(目前乐视使用) | ||
| 1318 | - if (GlobalConfig.hlsList && GlobalConfig.hlsList.length > 0) { | ||
| 1319 | - //有单独的hls拉流地址 | ||
| 1320 | - let index = parseInt(Math.random() * GlobalConfig.hlsList.length); | ||
| 1321 | - GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.hlsList[index].ip || ""; | ||
| 1322 | - GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.hlsList[index].port || ""; | ||
| 1323 | - } else { | ||
| 1324 | - //没有单独的hls拉流地址,和录制回放地址一样即可 | ||
| 1325 | - GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.RS_RECORD_PLAY_IP; | ||
| 1326 | - GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.RS_RECORD_PLAY_PORT; | ||
| 1327 | - } | ||
| 1328 | - loger.log('初始->MSHls->.', GlobalConfig.MS_PLAY_HLS_IP, GlobalConfig.MS_PLAY_HLS_PORT); | ||
| 1329 | - | ||
| 1330 | - //直播的时候,拉流(rtmp和hls)需要从 videoCDNAddr中获取 | ||
| 1331 | - //20170531-新规则,所有课堂类型都支持加速 | ||
| 1332 | - // if(GlobalConfig.classType==ApeConsts.CLASS_TYPE_2&&GlobalConfig.videoCDNAddrList.length>0){ | ||
| 1333 | - if (GlobalConfig.videoCDNAddrList.length > 0) { | ||
| 1334 | - //videoCDNAddrList中rtmppush和hls是混在一起的,需要分离开; | ||
| 1335 | - let listLen = GlobalConfig.videoCDNAddrList.length; | ||
| 1336 | - for (let i = 0; i < listLen; i++) { | ||
| 1337 | - let ipItem = GlobalConfig.videoCDNAddrList[i]; | ||
| 1338 | - if (ipItem) { | ||
| 1339 | - if (ipItem.indexOf('hls') >= 0) { | ||
| 1340 | - //直播的时候m3u8拉流地址 | ||
| 1341 | - GlobalConfig.MS_PLAY_HLS_IP = ipItem; //ip包含了端口 | ||
| 1342 | - GlobalConfig.MS_PLAY_HLS_PORT = ""; | ||
| 1343 | - loger.log('videoCDNAddr>初始->MSHls', GlobalConfig.MS_PLAY_HLS_IP); | ||
| 1344 | - } else if (ipItem.indexOf('rtmppull') >= 0) { | ||
| 1345 | - //直播的时候rtmp拉流地址 | ||
| 1346 | - GlobalConfig.MS_PLAY_RTMP_IP = ipItem; //ip包含了端口 | ||
| 1347 | - GlobalConfig.MS_PLAY_RTMP_PORT = ''; | ||
| 1348 | - loger.log('videoCDNAddr->初始->MSPull', GlobalConfig.MS_PLAY_RTMP_IP); | ||
| 1349 | - } | 1324 | + loger.log('初始->MSPull->.', GlobalConfig.MS_PLAY_RTMP_IP, GlobalConfig.MS_PLAY_RTMP_PORT); |
| 1325 | + | ||
| 1326 | + //播流的地址和推流地址需要分开的时候,单独设置拉流的地址 hls(目前乐视使用) | ||
| 1327 | + if (GlobalConfig.hlsList && GlobalConfig.hlsList.length > 0) { | ||
| 1328 | + //有单独的hls拉流地址 | ||
| 1329 | + let index = parseInt(Math.random() * GlobalConfig.hlsList.length); | ||
| 1330 | + GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.hlsList[index].ip || ""; | ||
| 1331 | + GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.hlsList[index].port || ""; | ||
| 1332 | + } else { | ||
| 1333 | + //没有单独的hls拉流地址,和录制回放地址一样即可 | ||
| 1334 | + GlobalConfig.MS_PLAY_HLS_IP = GlobalConfig.RS_RECORD_PLAY_IP; | ||
| 1335 | + GlobalConfig.MS_PLAY_HLS_PORT = GlobalConfig.RS_RECORD_PLAY_PORT; | ||
| 1336 | + } | ||
| 1337 | + loger.log('初始->MSHls->.', GlobalConfig.MS_PLAY_HLS_IP, GlobalConfig.MS_PLAY_HLS_PORT); | ||
| 1338 | + | ||
| 1339 | + //直播的时候,拉流(rtmp和hls)需要从 videoCDNAddr中获取 | ||
| 1340 | + //20170531-新规则,所有课堂类型都支持加速 | ||
| 1341 | + // if(GlobalConfig.classType==ApeConsts.CLASS_TYPE_2&&GlobalConfig.videoCDNAddrList.length>0){ | ||
| 1342 | + if (GlobalConfig.videoCDNAddrList.length > 0) { | ||
| 1343 | + //videoCDNAddrList中rtmppush和hls是混在一起的,需要分离开; | ||
| 1344 | + let listLen = GlobalConfig.videoCDNAddrList.length; | ||
| 1345 | + for (let i = 0; i < listLen; i++) { | ||
| 1346 | + let ipItem = GlobalConfig.videoCDNAddrList[i]; | ||
| 1347 | + if (ipItem) { | ||
| 1348 | + if (ipItem.indexOf('hls') >= 0) { | ||
| 1349 | + //直播的时候m3u8拉流地址 | ||
| 1350 | + GlobalConfig.MS_PLAY_HLS_IP = ipItem; //ip包含了端口 | ||
| 1351 | + GlobalConfig.MS_PLAY_HLS_PORT = ""; | ||
| 1352 | + loger.log('videoCDNAddr>初始->MSHls', GlobalConfig.MS_PLAY_HLS_IP); | ||
| 1353 | + } else if (ipItem.indexOf('rtmppull') >= 0) { | ||
| 1354 | + //直播的时候rtmp拉流地址 | ||
| 1355 | + GlobalConfig.MS_PLAY_RTMP_IP = ipItem; //ip包含了端口 | ||
| 1356 | + GlobalConfig.MS_PLAY_RTMP_PORT = ''; | ||
| 1357 | + loger.log('videoCDNAddr->初始->MSPull', GlobalConfig.MS_PLAY_RTMP_IP); | ||
| 1350 | } | 1358 | } |
| 1351 | } | 1359 | } |
| 1352 | - | ||
| 1353 | - } else { | ||
| 1354 | - loger.log('不需要videoCDNAddr->'); | ||
| 1355 | - } | ||
| 1356 | - | ||
| 1357 | - //文档地址 | ||
| 1358 | - if (_data.docList && _data.docList.length > 0) { | ||
| 1359 | - //doc上传地址,随机获取一个 | ||
| 1360 | - let index = parseInt(Math.random() * _data.docList.length); | ||
| 1361 | - loger.log("docServer->", _data.docList[index]); | ||
| 1362 | - GlobalConfig.DOCServerIP = _data.docList[index].ip || ""; | ||
| 1363 | - GlobalConfig.DOCServerPort = _data.docList[index].port || ""; | ||
| 1364 | - loger.log('初始->DOC->.', GlobalConfig.DOCServerIP, GlobalConfig.DOCServerPort); | ||
| 1365 | - } | ||
| 1366 | - | ||
| 1367 | - //record | ||
| 1368 | - if (_data.recordList && _data.recordList.length > 0) { | ||
| 1369 | - let index = parseInt(Math.random() * _data.recordList.length); | ||
| 1370 | - GlobalConfig.RecordServerIP = _data.recordList[index].ip || ""; | ||
| 1371 | - GlobalConfig.RecordServerPort = _data.recordList[index].port || ""; | ||
| 1372 | - loger.log('初始->RECORD->.', GlobalConfig.RecordServerIP, GlobalConfig.RecordServerPort); | ||
| 1373 | } | 1360 | } |
| 1374 | 1361 | ||
| 1375 | - } | ||
| 1376 | - //这里需要考虑是否加延迟处理,课堂信息刚获取完成,客户端需要根据数据创建界面UI,等创建完成后再加入课堂是最合适的(目前没有加延迟) | ||
| 1377 | - this._emit(MessageTypes.CLASS_GET_INFO_SUCCESS, GlobalConfig.getClassInfo()); | ||
| 1378 | - | ||
| 1379 | - if (_data.currentInfo) { | ||
| 1380 | - //根据从Sass获取的数据信息,同步最后一次保存的课堂状态信息 | ||
| 1381 | - loger.log("本地同步最后一次保存过的课堂状态信息"); | ||
| 1382 | - try { | ||
| 1383 | - GlobalConfig.setClassStatusInfo(JSON.parse(_data.currentInfo)); | ||
| 1384 | - } catch (err) { | ||
| 1385 | - GlobalConfig.setClassStatusInfo(_data.currentInfo); | ||
| 1386 | - } | ||
| 1387 | - loger.log(GlobalConfig.classStatusInfo); | ||
| 1388 | } else { | 1362 | } else { |
| 1389 | - loger.log("还没有保存过课堂状信息"); | 1363 | + loger.log('不需要videoCDNAddr->'); |
| 1390 | } | 1364 | } |
| 1391 | 1365 | ||
| 1392 | - //录制回放不需要获取ip信息和选点 | ||
| 1393 | - if (GlobalConfig.isRecordPlayBack) { | ||
| 1394 | - if (_recordPlayback) { | ||
| 1395 | - //开启录制回放流程 | ||
| 1396 | - loger.log("开启录制回放流程"); | ||
| 1397 | - _recordPlayback.readyRecordPlay(); | ||
| 1398 | - } else { | ||
| 1399 | - loger.warn("开启录制回放流程失败->还未创建模块"); | ||
| 1400 | - } | ||
| 1401 | - } else { | ||
| 1402 | - //根据用户的userIp获取信息,选点 | ||
| 1403 | - this.getUserIpInfo(); | 1366 | + //文档地址 |
| 1367 | + if (_data.docList && _data.docList.length > 0) { | ||
| 1368 | + //doc上传地址,随机获取一个 | ||
| 1369 | + let index = parseInt(Math.random() * _data.docList.length); | ||
| 1370 | + loger.log("docServer->", _data.docList[index]); | ||
| 1371 | + GlobalConfig.DOCServerIP = _data.docList[index].ip || ""; | ||
| 1372 | + GlobalConfig.DOCServerPort = _data.docList[index].port || ""; | ||
| 1373 | + loger.log('初始->DOC->.', GlobalConfig.DOCServerIP, GlobalConfig.DOCServerPort); | ||
| 1374 | + } | ||
| 1375 | + | ||
| 1376 | + //record | ||
| 1377 | + if (_data.recordList && _data.recordList.length > 0) { | ||
| 1378 | + let index = parseInt(Math.random() * _data.recordList.length); | ||
| 1379 | + GlobalConfig.RecordServerIP = _data.recordList[index].ip || ""; | ||
| 1380 | + GlobalConfig.RecordServerPort = _data.recordList[index].port || ""; | ||
| 1381 | + loger.log('初始->RECORD->.', GlobalConfig.RecordServerIP, GlobalConfig.RecordServerPort); | ||
| 1404 | } | 1382 | } |
| 1405 | - } | ||
| 1406 | - //ChatApe | ||
| 1407 | - // 发送聊天消息 | ||
| 1408 | - _sendChatMsg(_messageInfo) { | ||
| 1409 | - if (!_mcu.connected) { | ||
| 1410 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1411 | - return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1412 | - } | ||
| 1413 | - if (_messageInfo === null || EngineUtils.isEmptyObject(_messageInfo)) { | ||
| 1414 | - loger.log('发送聊天消息失败->参数错误', _messageInfo); | ||
| 1415 | - return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1416 | - } | ||
| 1417 | - if (_chat_ape) { | ||
| 1418 | - _chat_ape.sendChatMsg(_messageInfo); | ||
| 1419 | - } | ||
| 1420 | - } | ||
| 1421 | 1383 | ||
| 1422 | - //监听摄像头麦克风状态 | ||
| 1423 | - userDeviecStatusChange(_data) { | ||
| 1424 | - /* nodeId:GlobalConfig.nodeId, | ||
| 1425 | - userRole:GlobalConfig.userRole, | ||
| 1426 | - userName:GlobalConfig.userName, | ||
| 1427 | - userId:GlobalConfig.userId, | ||
| 1428 | - openCamera:GlobalConfig.openCamera, | ||
| 1429 | - openMicrophones:GlobalConfig.openMicrophones*/ | ||
| 1430 | - if (_confer_ape) { | ||
| 1431 | - _confer_ape.updaterUserDeviecStatusChange(_data); | ||
| 1432 | } | 1384 | } |
| 1433 | - } | 1385 | + //这里需要考虑是否加延迟处理,课堂信息刚获取完成,客户端需要根据数据创建界面UI,等创建完成后再加入课堂是最合适的(目前没有加延迟) |
| 1386 | + this._emit(MessageTypes.CLASS_GET_INFO_SUCCESS, GlobalConfig.getClassInfo()); | ||
| 1434 | 1387 | ||
| 1435 | - //屏幕共享 | ||
| 1436 | - //开始屏幕共享 | ||
| 1437 | - _publishScreenShare(_param) { | ||
| 1438 | - if (_video_ape) { | ||
| 1439 | - _video_ape.publishScreenShare(_param); | 1388 | + if (_data.currentInfo) { |
| 1389 | + //根据从Sass获取的数据信息,同步最后一次保存的课堂状态信息 | ||
| 1390 | + loger.log("本地同步最后一次保存过的课堂状态信息"); | ||
| 1391 | + try { | ||
| 1392 | + GlobalConfig.setClassStatusInfo(JSON.parse(_data.currentInfo)); | ||
| 1393 | + } catch (err) { | ||
| 1394 | + GlobalConfig.setClassStatusInfo(_data.currentInfo); | ||
| 1440 | } | 1395 | } |
| 1396 | + loger.log(GlobalConfig.classStatusInfo); | ||
| 1397 | + } else { | ||
| 1398 | + loger.log("还没有保存过课堂状信息"); | ||
| 1441 | } | 1399 | } |
| 1442 | - //停止屏幕共享 | ||
| 1443 | - _stopPublishScreenShare(_param) { | ||
| 1444 | - if (_video_ape) { | ||
| 1445 | - _video_ape.stopPublishScreenShare(_param); | 1400 | + |
| 1401 | + //录制回放不需要获取ip信息和选点 | ||
| 1402 | + if (GlobalConfig.isRecordPlayBack) { | ||
| 1403 | + if (_recordPlayback) { | ||
| 1404 | + //开启录制回放流程 | ||
| 1405 | + loger.log("开启录制回放流程"); | ||
| 1406 | + _recordPlayback.readyRecordPlay(); | ||
| 1407 | + } else { | ||
| 1408 | + loger.warn("开启录制回放流程失败->还未创建模块"); | ||
| 1446 | } | 1409 | } |
| 1410 | + } else { | ||
| 1411 | + //根据用户的userIp获取信息,选点 | ||
| 1412 | + this.getUserIpInfo(); | ||
| 1447 | } | 1413 | } |
| 1448 | - //VidoeApe | ||
| 1449 | - videoUpdate(_data) { | ||
| 1450 | - //视频同步的消息发送改变,需要通知ferApe模块中的用户更新状态 | ||
| 1451 | - if (_confer_ape) { | ||
| 1452 | - _confer_ape.updaterRosterStatus(_data); | ||
| 1453 | - } | ||
| 1454 | } | 1414 | } |
| 1415 | + //ChatApe | ||
| 1416 | + // 发送聊天消息 | ||
| 1417 | + _sendChatMsg(_messageInfo) { | ||
| 1418 | + if (!_mcu.connected) { | ||
| 1419 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1420 | + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1421 | + } | ||
| 1422 | + if (_messageInfo === null || EngineUtils.isEmptyObject(_messageInfo)) { | ||
| 1423 | + loger.log('发送聊天消息失败->参数错误', _messageInfo); | ||
| 1424 | + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1425 | + } | ||
| 1426 | + if (_chat_ape) { | ||
| 1427 | + _chat_ape.sendChatMsg(_messageInfo); | ||
| 1428 | + } | ||
| 1429 | + } | ||
| 1455 | 1430 | ||
| 1456 | - _sendVideoBroadcastMsg(_param) { | ||
| 1457 | - if (!_mcu.connected) { | ||
| 1458 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1459 | - return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1460 | - } | ||
| 1461 | - if (_video_ape) { | ||
| 1462 | - return _video_ape.sendVideoBroadcastMsg(_param); | ||
| 1463 | - } | 1431 | + //监听摄像头麦克风状态 |
| 1432 | + userDeviecStatusChange(_data) { | ||
| 1433 | + /* nodeId:GlobalConfig.nodeId, | ||
| 1434 | + userRole:GlobalConfig.userRole, | ||
| 1435 | + userName:GlobalConfig.userName, | ||
| 1436 | + userId:GlobalConfig.userId, | ||
| 1437 | + openCamera:GlobalConfig.openCamera, | ||
| 1438 | + openMicrophones:GlobalConfig.openMicrophones*/ | ||
| 1439 | + if (_confer_ape) { | ||
| 1440 | + _confer_ape.updaterUserDeviecStatusChange(_data); | ||
| 1464 | } | 1441 | } |
| 1442 | + } | ||
| 1465 | 1443 | ||
| 1466 | - _getVideoPlayPath(_param) { | 1444 | + //屏幕共享 |
| 1445 | + //开始屏幕共享 | ||
| 1446 | + _publishScreenShare(_param) { | ||
| 1467 | if (_video_ape) { | 1447 | if (_video_ape) { |
| 1468 | - return _video_ape.getPlayVideoPath(_param); | 1448 | + _video_ape.publishScreenShare(_param); |
| 1469 | } | 1449 | } |
| 1470 | } | 1450 | } |
| 1471 | - | ||
| 1472 | - _getVideoPublishPath(_param) { | 1451 | + //停止屏幕共享 |
| 1452 | + _stopPublishScreenShare(_param) { | ||
| 1473 | if (_video_ape) { | 1453 | if (_video_ape) { |
| 1474 | - return _video_ape.getPublishVideoPath(_param); | 1454 | + _video_ape.stopPublishScreenShare(_param); |
| 1475 | } | 1455 | } |
| 1476 | } | 1456 | } |
| 1457 | + //VidoeApe | ||
| 1458 | + videoUpdate(_data) { | ||
| 1459 | + //视频同步的消息发送改变,需要通知ferApe模块中的用户更新状态 | ||
| 1460 | + if (_confer_ape) { | ||
| 1461 | + _confer_ape.updaterRosterStatus(_data); | ||
| 1462 | + } | ||
| 1463 | + } | ||
| 1477 | 1464 | ||
| 1478 | - _getVideoAllChannelInfo(_param) { | ||
| 1479 | - if (_video_ape) { | ||
| 1480 | - return _video_ape.getAllChannelInfo(_param); | ||
| 1481 | - } | 1465 | + _sendVideoBroadcastMsg(_param) { |
| 1466 | + if (!_mcu.connected) { | ||
| 1467 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1468 | + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1469 | + } | ||
| 1470 | + if (_video_ape) { | ||
| 1471 | + return _video_ape.sendVideoBroadcastMsg(_param); | ||
| 1482 | } | 1472 | } |
| 1473 | + } | ||
| 1483 | 1474 | ||
| 1484 | - _publishVideo(_param) { | ||
| 1485 | - if (!_mcu.connected) { | ||
| 1486 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1487 | - return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1488 | - } | ||
| 1489 | - if (_video_ape) { | ||
| 1490 | - return _video_ape.publishVideo(_param); | ||
| 1491 | - } | 1475 | + _getVideoPlayPath(_param) { |
| 1476 | + if (_video_ape) { | ||
| 1477 | + return _video_ape.getPlayVideoPath(_param); | ||
| 1492 | } | 1478 | } |
| 1479 | + } | ||
| 1493 | 1480 | ||
| 1494 | - _stopPublishVideo(_param) { | ||
| 1495 | - if (!_mcu.connected) { | ||
| 1496 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1497 | - return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1498 | - } | ||
| 1499 | - if (_video_ape) { | ||
| 1500 | - return _video_ape.stopPublishVideo(_param); | ||
| 1501 | - } | 1481 | + _getVideoPublishPath(_param) { |
| 1482 | + if (_video_ape) { | ||
| 1483 | + return _video_ape.getPublishVideoPath(_param); | ||
| 1502 | } | 1484 | } |
| 1485 | + } | ||
| 1503 | 1486 | ||
| 1504 | - //AudioApe | ||
| 1505 | - audioUpdate(_data) { | ||
| 1506 | - //音频同步的消息发送改变,需要通知ferApe模块中的用户更新状态 | ||
| 1507 | - if (_confer_ape) { | ||
| 1508 | - _confer_ape.updaterRosterStatus(_data); | ||
| 1509 | - } | 1487 | + _getVideoAllChannelInfo(_param) { |
| 1488 | + if (_video_ape) { | ||
| 1489 | + return _video_ape.getAllChannelInfo(_param); | ||
| 1510 | } | 1490 | } |
| 1491 | + } | ||
| 1511 | 1492 | ||
| 1512 | - sendAudioCommandMsg(_param) { | ||
| 1513 | - if (!_mcu.connected) { | ||
| 1514 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1515 | - return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1516 | - } | ||
| 1517 | - if (_audio_ape) { | ||
| 1518 | - return _audio_ape.sendAudioBroadcastMsg(_param); | ||
| 1519 | - } | 1493 | + _publishVideo(_param) { |
| 1494 | + if (!_mcu.connected) { | ||
| 1495 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1496 | + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1497 | + } | ||
| 1498 | + if (_video_ape) { | ||
| 1499 | + return _video_ape.publishVideo(_param); | ||
| 1520 | } | 1500 | } |
| 1501 | + } | ||
| 1521 | 1502 | ||
| 1522 | - _getPlayAudioPath(_param) { | ||
| 1523 | - if (_audio_ape) { | ||
| 1524 | - return _audio_ape.getAudioPlayPath(_param); | ||
| 1525 | - } | 1503 | + _stopPublishVideo(_param) { |
| 1504 | + if (!_mcu.connected) { | ||
| 1505 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1506 | + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1507 | + } | ||
| 1508 | + if (_video_ape) { | ||
| 1509 | + return _video_ape.stopPublishVideo(_param); | ||
| 1526 | } | 1510 | } |
| 1511 | + } | ||
| 1527 | 1512 | ||
| 1528 | - _getPublishAudioPath(_param) { | ||
| 1529 | - if (_audio_ape) { | ||
| 1530 | - return _audio_ape.getAudioPublishPath(_param); | ||
| 1531 | - } | 1513 | + //AudioApe |
| 1514 | + audioUpdate(_data) { | ||
| 1515 | + //音频同步的消息发送改变,需要通知ferApe模块中的用户更新状态 | ||
| 1516 | + if (_confer_ape) { | ||
| 1517 | + _confer_ape.updaterRosterStatus(_data); | ||
| 1532 | } | 1518 | } |
| 1519 | + } | ||
| 1533 | 1520 | ||
| 1534 | - _getAudioAllChannelInfo(_param) { | ||
| 1535 | - if (_audio_ape) { | ||
| 1536 | - return _audio_ape.getAllChannelInfo(_param); | ||
| 1537 | - } | 1521 | + sendAudioCommandMsg(_param) { |
| 1522 | + if (!_mcu.connected) { | ||
| 1523 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1524 | + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1525 | + } | ||
| 1526 | + if (_audio_ape) { | ||
| 1527 | + return _audio_ape.sendAudioBroadcastMsg(_param); | ||
| 1538 | } | 1528 | } |
| 1529 | + } | ||
| 1539 | 1530 | ||
| 1540 | - _publishAudio(_param) { | ||
| 1541 | - if (!_mcu.connected) { | ||
| 1542 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1543 | - return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1544 | - } | ||
| 1545 | - if (_audio_ape) { | ||
| 1546 | - return _audio_ape.publishAudio(_param); | ||
| 1547 | - } | 1531 | + _getPlayAudioPath(_param) { |
| 1532 | + if (_audio_ape) { | ||
| 1533 | + return _audio_ape.getAudioPlayPath(_param); | ||
| 1548 | } | 1534 | } |
| 1535 | + } | ||
| 1549 | 1536 | ||
| 1550 | - _stopPublishAudio(_param) { | ||
| 1551 | - if (!_mcu.connected) { | ||
| 1552 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1553 | - return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1554 | - } | ||
| 1555 | - if (_audio_ape) { | ||
| 1556 | - return _audio_ape.stopPublishAudio(_param); | ||
| 1557 | - } | 1537 | + _getPublishAudioPath(_param) { |
| 1538 | + if (_audio_ape) { | ||
| 1539 | + return _audio_ape.getAudioPublishPath(_param); | ||
| 1558 | } | 1540 | } |
| 1541 | + } | ||
| 1559 | 1542 | ||
| 1560 | - //WhiteBoardApe | ||
| 1561 | - // 添加标注,发送信息 | ||
| 1562 | - _sendInsertAnnotaion(_param) { | ||
| 1563 | - if (!_mcu.connected) { | ||
| 1564 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1565 | - return; | ||
| 1566 | - } | ||
| 1567 | - if (_whiteboard_ape) { | ||
| 1568 | - _whiteboard_ape.sendInsetAnnotaion(_param); | ||
| 1569 | - } | 1543 | + _getAudioAllChannelInfo(_param) { |
| 1544 | + if (_audio_ape) { | ||
| 1545 | + return _audio_ape.getAllChannelInfo(_param); | ||
| 1570 | } | 1546 | } |
| 1547 | + } | ||
| 1571 | 1548 | ||
| 1572 | - //CursorApe | ||
| 1573 | - // 添加鼠标同步 | ||
| 1574 | - _sendInsertCursor(_param) { | ||
| 1575 | - if (!_mcu.connected) { | ||
| 1576 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1577 | - return; | ||
| 1578 | - } | ||
| 1579 | - if (_cursor_ape) { | ||
| 1580 | - _cursor_ape.sendInsertCursor(_param); | ||
| 1581 | - } | 1549 | + _publishAudio(_param) { |
| 1550 | + if (!_mcu.connected) { | ||
| 1551 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1552 | + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1582 | } | 1553 | } |
| 1554 | + if (_audio_ape) { | ||
| 1555 | + return _audio_ape.publishAudio(_param); | ||
| 1556 | + } | ||
| 1557 | + } | ||
| 1583 | 1558 | ||
| 1584 | - //删除当前页面上的所有标注 | ||
| 1585 | - _sendDeleteCurPageAnnotation(_param) { | ||
| 1586 | - if (!_mcu.connected) { | ||
| 1587 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1588 | - return; | ||
| 1589 | - } | ||
| 1590 | - if (_whiteboard_ape) { | ||
| 1591 | - _whiteboard_ape.sendDeleteCurPageAnnotation(_param); | ||
| 1592 | - } | 1559 | + _stopPublishAudio(_param) { |
| 1560 | + if (!_mcu.connected) { | ||
| 1561 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1562 | + return { "code": ApeConsts.RETURN_FAILED, "data": "" }; | ||
| 1593 | } | 1563 | } |
| 1564 | + if (_audio_ape) { | ||
| 1565 | + return _audio_ape.stopPublishAudio(_param); | ||
| 1566 | + } | ||
| 1567 | + } | ||
| 1594 | 1568 | ||
| 1595 | - //删除所有标注 | ||
| 1596 | - _sendDeleteAllAnnotation(_param) { | ||
| 1597 | - if (!_mcu.connected) { | ||
| 1598 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1599 | - return; | ||
| 1600 | - } | ||
| 1601 | - if (_whiteboard_ape) { | ||
| 1602 | - _whiteboard_ape.sendDeleteAllAnnotation(_param); | ||
| 1603 | - } | 1569 | + //WhiteBoardApe |
| 1570 | + // 添加标注,发送信息 | ||
| 1571 | + _sendInsertAnnotaion(_param) { | ||
| 1572 | + if (!_mcu.connected) { | ||
| 1573 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1574 | + return; | ||
| 1604 | } | 1575 | } |
| 1576 | + if (_whiteboard_ape) { | ||
| 1577 | + _whiteboard_ape.sendInsetAnnotaion(_param); | ||
| 1578 | + } | ||
| 1579 | + } | ||
| 1605 | 1580 | ||
| 1606 | - //返回上一步标注 | ||
| 1607 | - _sendGotoPrev(_param) { | ||
| 1608 | - if (_whiteboard_ape) { | ||
| 1609 | - _whiteboard_ape.sendGotoPrev(_param); | ||
| 1610 | - } | 1581 | + //CursorApe |
| 1582 | + // 添加鼠标同步 | ||
| 1583 | + _sendInsertCursor(_param) { | ||
| 1584 | + if (!_mcu.connected) { | ||
| 1585 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1586 | + return; | ||
| 1587 | + } | ||
| 1588 | + if (_cursor_ape) { | ||
| 1589 | + _cursor_ape.sendInsertCursor(_param); | ||
| 1611 | } | 1590 | } |
| 1591 | + } | ||
| 1612 | 1592 | ||
| 1613 | - //DocApe | ||
| 1614 | - //获取文档的所有资源地址 | ||
| 1615 | - _getDocFullAddress(_param) { | ||
| 1616 | - if (_doc_ape) { | ||
| 1617 | - return _doc_ape.getDocFullAddress(_param); | ||
| 1618 | - } else { | ||
| 1619 | - loger.error("文档模块还没有创建无法获取"); | ||
| 1620 | - return { "code": ApeConsts.RETURN_FAILED, "data": "文档模块还没有创建无法获取" }; | ||
| 1621 | - } | 1593 | + //删除当前页面上的所有标注 |
| 1594 | + _sendDeleteCurPageAnnotation(_param) { | ||
| 1595 | + if (!_mcu.connected) { | ||
| 1596 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1597 | + return; | ||
| 1622 | } | 1598 | } |
| 1599 | + if (_whiteboard_ape) { | ||
| 1600 | + _whiteboard_ape.sendDeleteCurPageAnnotation(_param); | ||
| 1601 | + } | ||
| 1602 | + } | ||
| 1623 | 1603 | ||
| 1624 | - //获取文档完整路径 | ||
| 1625 | - _getDocImageFullPath(_param) { | ||
| 1626 | - if (_doc_ape) { | ||
| 1627 | - return _doc_ape.getDocImageFullPath(_param); | ||
| 1628 | - } else { | ||
| 1629 | - loger.error("文档模块还没有创建无法获取"); | ||
| 1630 | - return []; | ||
| 1631 | - } | 1604 | + //删除所有标注 |
| 1605 | + _sendDeleteAllAnnotation(_param) { | ||
| 1606 | + if (!_mcu.connected) { | ||
| 1607 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1608 | + return; | ||
| 1632 | } | 1609 | } |
| 1610 | + if (_whiteboard_ape) { | ||
| 1611 | + _whiteboard_ape.sendDeleteAllAnnotation(_param); | ||
| 1612 | + } | ||
| 1613 | + } | ||
| 1633 | 1614 | ||
| 1634 | - _getDocPDFFullPath(_param) { | ||
| 1635 | - if (_doc_ape) { | ||
| 1636 | - return _doc_ape.getDocPDFFullPath(_param); | ||
| 1637 | - } else { | ||
| 1638 | - loger.error("文档模块还没有创建,无法获取"); | ||
| 1639 | - return []; | ||
| 1640 | - } | 1615 | + //返回上一步标注 |
| 1616 | + _sendGotoPrev(_param) { | ||
| 1617 | + if (_whiteboard_ape) { | ||
| 1618 | + _whiteboard_ape.sendGotoPrev(_param); | ||
| 1619 | + } | ||
| 1620 | + } | ||
| 1621 | + | ||
| 1622 | + //DocApe | ||
| 1623 | + //获取文档的所有资源地址 | ||
| 1624 | + _getDocFullAddress(_param) { | ||
| 1625 | + if (_doc_ape) { | ||
| 1626 | + return _doc_ape.getDocFullAddress(_param); | ||
| 1627 | + } else { | ||
| 1628 | + loger.error("文档模块还没有创建无法获取"); | ||
| 1629 | + return { "code": ApeConsts.RETURN_FAILED, "data": "文档模块还没有创建无法获取" }; | ||
| 1630 | + } | ||
| 1631 | + } | ||
| 1632 | + | ||
| 1633 | + //获取文档完整路径 | ||
| 1634 | + _getDocImageFullPath(_param) { | ||
| 1635 | + if (_doc_ape) { | ||
| 1636 | + return _doc_ape.getDocImageFullPath(_param); | ||
| 1637 | + } else { | ||
| 1638 | + loger.error("文档模块还没有创建无法获取"); | ||
| 1639 | + return []; | ||
| 1640 | + } | ||
| 1641 | + } | ||
| 1642 | + | ||
| 1643 | + _getDocPDFFullPath(_param) { | ||
| 1644 | + if (_doc_ape) { | ||
| 1645 | + return _doc_ape.getDocPDFFullPath(_param); | ||
| 1646 | + } else { | ||
| 1647 | + loger.error("文档模块还没有创建,无法获取"); | ||
| 1648 | + return []; | ||
| 1649 | + } | ||
| 1650 | + } | ||
| 1651 | + | ||
| 1652 | + //上传文档 | ||
| 1653 | + _sendDocumentUpload(_param) { | ||
| 1654 | + if (!_mcu.connected) { | ||
| 1655 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1656 | + return; | ||
| 1657 | + } | ||
| 1658 | + if (_doc_ape) { | ||
| 1659 | + _doc_ape.documentUpload(_param); | ||
| 1641 | } | 1660 | } |
| 1661 | + } | ||
| 1662 | + | ||
| 1663 | + //切换文档 | ||
| 1664 | + _sendDocumentSwitchDoc(_param) { | ||
| 1665 | + if (!_mcu.connected) { | ||
| 1666 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1667 | + return; | ||
| 1668 | + } | ||
| 1669 | + if (_doc_ape) { | ||
| 1670 | + _doc_ape.documentSwitchDoc(_param); | ||
| 1671 | + } | ||
| 1672 | + } | ||
| 1642 | 1673 | ||
| 1643 | - //上传文档 | ||
| 1644 | - _sendDocumentUpload(_param) { | 1674 | + //操作文档(翻页) |
| 1675 | + _sendDocumentSwitchPage(_param) { | ||
| 1645 | if (!_mcu.connected) { | 1676 | if (!_mcu.connected) { |
| 1646 | loger.warn(GlobalConfig.getCurrentStatus()); | 1677 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 1647 | return; | 1678 | return; |
| 1648 | } | 1679 | } |
| 1649 | if (_doc_ape) { | 1680 | if (_doc_ape) { |
| 1650 | - _doc_ape.documentUpload(_param); | 1681 | + _doc_ape.documentSwitchPage(_param); |
| 1651 | } | 1682 | } |
| 1652 | } | 1683 | } |
| 1653 | - | ||
| 1654 | - //切换文档 | ||
| 1655 | - _sendDocumentSwitchDoc(_param) { | 1684 | + //操作文档(页码上的动画步骤操作) |
| 1685 | + _sendDocumentSwitchAnimation(_param) { | ||
| 1656 | if (!_mcu.connected) { | 1686 | if (!_mcu.connected) { |
| 1657 | loger.warn(GlobalConfig.getCurrentStatus()); | 1687 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 1658 | return; | 1688 | return; |
| 1659 | } | 1689 | } |
| 1660 | if (_doc_ape) { | 1690 | if (_doc_ape) { |
| 1661 | - _doc_ape.documentSwitchDoc(_param); | 1691 | + _doc_ape.documentSwitchAnimation(_param); |
| 1662 | } | 1692 | } |
| 1663 | } | 1693 | } |
| 1664 | - | ||
| 1665 | - //操作文档(翻页) | ||
| 1666 | - _sendDocumentSwitchPage(_param) { | ||
| 1667 | - if (!_mcu.connected) { | ||
| 1668 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1669 | - return; | ||
| 1670 | - } | ||
| 1671 | - if (_doc_ape) { | ||
| 1672 | - _doc_ape.documentSwitchPage(_param); | ||
| 1673 | - } | ||
| 1674 | - } | ||
| 1675 | - //操作文档(页码上的动画步骤操作) | ||
| 1676 | - _sendDocumentSwitchAnimation(_param) { | ||
| 1677 | - if (!_mcu.connected) { | ||
| 1678 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1679 | - return; | ||
| 1680 | - } | ||
| 1681 | - if (_doc_ape) { | ||
| 1682 | - _doc_ape.documentSwitchAnimation(_param); | ||
| 1683 | - } | ||
| 1684 | - } | ||
| 1685 | - //操作文档(缩放、滚动...) | ||
| 1686 | - _sendDocumentCommand(_param) { | ||
| 1687 | - if (!_mcu.connected) { | ||
| 1688 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1689 | - return; | ||
| 1690 | - } | ||
| 1691 | - if (_doc_ape) { | ||
| 1692 | - _doc_ape.documentCommand(_param); | ||
| 1693 | - } | 1694 | + //操作文档(缩放、滚动...) |
| 1695 | + _sendDocumentCommand(_param) { | ||
| 1696 | + if (!_mcu.connected) { | ||
| 1697 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1698 | + return; | ||
| 1694 | } | 1699 | } |
| 1700 | + if (_doc_ape) { | ||
| 1701 | + _doc_ape.documentCommand(_param); | ||
| 1702 | + } | ||
| 1703 | + } | ||
| 1695 | 1704 | ||
| 1696 | - //删除文档 | ||
| 1697 | - _sendDocumentDelete(_param) { | ||
| 1698 | - if (!_mcu.connected) { | ||
| 1699 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1700 | - return; | ||
| 1701 | - } | ||
| 1702 | - if (_doc_ape) { | ||
| 1703 | - _doc_ape.documentDelete(_param); | ||
| 1704 | - } | 1705 | + //删除文档 |
| 1706 | + _sendDocumentDelete(_param) { | ||
| 1707 | + if (!_mcu.connected) { | ||
| 1708 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1709 | + return; | ||
| 1710 | + } | ||
| 1711 | + if (_doc_ape) { | ||
| 1712 | + _doc_ape.documentDelete(_param); | ||
| 1705 | } | 1713 | } |
| 1714 | + } | ||
| 1706 | 1715 | ||
| 1707 | - //删除所有文档 | ||
| 1708 | - _documentDeleteAll(_param) { | ||
| 1709 | - if (!_mcu.connected) { | ||
| 1710 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1711 | - return; | ||
| 1712 | - } | ||
| 1713 | - if (_doc_ape) { | ||
| 1714 | - _doc_ape.documentDeleteAll(_param); | ||
| 1715 | - } | 1716 | + //删除所有文档 |
| 1717 | + _documentDeleteAll(_param) { | ||
| 1718 | + if (!_mcu.connected) { | ||
| 1719 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1720 | + return; | ||
| 1721 | + } | ||
| 1722 | + if (_doc_ape) { | ||
| 1723 | + _doc_ape.documentDeleteAll(_param); | ||
| 1716 | } | 1724 | } |
| 1725 | + } | ||
| 1717 | 1726 | ||
| 1718 | - //// 文档变更,白板也需要做处理 | ||
| 1719 | - docUpdateHandler(_data) { | ||
| 1720 | - if (!_mcu.connected && !GlobalConfig.isRecordPlayBack) { | ||
| 1721 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1722 | - return; | ||
| 1723 | - } | ||
| 1724 | - //loger.log('Doc UpdateId ->'); | ||
| 1725 | - //loger.log(_data); | ||
| 1726 | - if (_whiteboard_ape) { | ||
| 1727 | - _whiteboard_ape.docUpdateHandler(_data); | ||
| 1728 | - } | 1727 | + //// 文档变更,白板也需要做处理 |
| 1728 | + docUpdateHandler(_data) { | ||
| 1729 | + if (!_mcu.connected && !GlobalConfig.isRecordPlayBack) { | ||
| 1730 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1731 | + return; | ||
| 1732 | + } | ||
| 1733 | + //loger.log('Doc UpdateId ->'); | ||
| 1734 | + //loger.log(_data); | ||
| 1735 | + if (_whiteboard_ape) { | ||
| 1736 | + _whiteboard_ape.docUpdateHandler(_data); | ||
| 1729 | } | 1737 | } |
| 1738 | + } | ||
| 1730 | 1739 | ||
| 1731 | - //文档删除,白板也需要做处理 | ||
| 1732 | - docDeleteHandler(_data) { | ||
| 1733 | - if (_whiteboard_ape) { | ||
| 1734 | - _whiteboard_ape.docDeleteHandler(_data); | ||
| 1735 | - } | 1740 | + //文档删除,白板也需要做处理 |
| 1741 | + docDeleteHandler(_data) { | ||
| 1742 | + if (_whiteboard_ape) { | ||
| 1743 | + _whiteboard_ape.docDeleteHandler(_data); | ||
| 1736 | } | 1744 | } |
| 1745 | + } | ||
| 1737 | 1746 | ||
| 1738 | - //文档加入频道成功,同步到MCU服务器上的数据 | ||
| 1739 | - docJoinChannelSuccess() { | ||
| 1740 | - loger.log("docJoinChannelSuccess->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.docListPrepare.length); | ||
| 1741 | - //loger.log("docJoinChannelSuccess docListPrepare="); | ||
| 1742 | - //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 | ||
| 1743 | - if (GlobalConfig.isHost && GlobalConfig.docListPrepare.length > 0) { | ||
| 1744 | - for (let i = 0; i < GlobalConfig.docListPrepare.length; i++) { | ||
| 1745 | - let value = GlobalConfig.docListPrepare[i]; | ||
| 1746 | - if (value) { | ||
| 1747 | - //loger.log("判断是否需要把提前上传的文档上传到mcu", value); | ||
| 1748 | - let paramInfo = { | ||
| 1749 | - "pageNum": value.pdfSize, | ||
| 1750 | - "fileName": value.name, | ||
| 1751 | - "fileType": value.type, | ||
| 1752 | - "relativeUrl": value.relativeLocation, | ||
| 1753 | - "url": value.absoluteLocation, | ||
| 1754 | - "creatUserId": value.createUserID, | ||
| 1755 | - "docId": value.id, | ||
| 1756 | - "md5": value.MD5, | ||
| 1757 | - "visible": false | ||
| 1758 | - }; | ||
| 1759 | - this._sendDocumentUpload(paramInfo); | ||
| 1760 | - } | 1747 | + //文档加入频道成功,同步到MCU服务器上的数据 |
| 1748 | + docJoinChannelSuccess() { | ||
| 1749 | + loger.log("docJoinChannelSuccess->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.docListPrepare.length); | ||
| 1750 | + //loger.log("docJoinChannelSuccess docListPrepare="); | ||
| 1751 | + //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 | ||
| 1752 | + if (GlobalConfig.isHost && GlobalConfig.docListPrepare.length > 0) { | ||
| 1753 | + for (let i = 0; i < GlobalConfig.docListPrepare.length; i++) { | ||
| 1754 | + let value = GlobalConfig.docListPrepare[i]; | ||
| 1755 | + if (value) { | ||
| 1756 | + //loger.log("判断是否需要把提前上传的文档上传到mcu", value); | ||
| 1757 | + let paramInfo = { | ||
| 1758 | + "pageNum": value.pdfSize, | ||
| 1759 | + "fileName": value.name, | ||
| 1760 | + "fileType": value.type, | ||
| 1761 | + "relativeUrl": value.relativeLocation, | ||
| 1762 | + "url": value.absoluteLocation, | ||
| 1763 | + "creatUserId": value.createUserID, | ||
| 1764 | + "docId": value.id, | ||
| 1765 | + "md5": value.MD5, | ||
| 1766 | + "visible": false | ||
| 1767 | + }; | ||
| 1768 | + this._sendDocumentUpload(paramInfo); | ||
| 1761 | } | 1769 | } |
| 1762 | } | 1770 | } |
| 1763 | } | 1771 | } |
| 1772 | + } | ||
| 1764 | 1773 | ||
| 1765 | - //媒体共享模块的接口 | ||
| 1766 | - //上传 | ||
| 1767 | - _sendMediaSharedUpload(_param) { | ||
| 1768 | - if (!_mcu.connected) { | ||
| 1769 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1770 | - return; | ||
| 1771 | - } | ||
| 1772 | - if (_mediaShareApe) { | ||
| 1773 | - _mediaShareApe.mediaSharedUpload(_param); | ||
| 1774 | - } | ||
| 1775 | - } | ||
| 1776 | - //Sass删除媒体文件数据 | ||
| 1777 | - _sassDeletMediaShare(_param) { | ||
| 1778 | - if (!_mcu.connected) { | ||
| 1779 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1780 | - return; | ||
| 1781 | - } | 1774 | + //媒体共享模块的接口 |
| 1775 | + //上传 | ||
| 1776 | + _sendMediaSharedUpload(_param) { | ||
| 1777 | + if (!_mcu.connected) { | ||
| 1778 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1779 | + return; | ||
| 1780 | + } | ||
| 1781 | + if (_mediaShareApe) { | ||
| 1782 | + _mediaShareApe.mediaSharedUpload(_param); | ||
| 1783 | + } | ||
| 1784 | + } | ||
| 1782 | 1785 | ||
| 1783 | - //判断传入的参数是否存在 | ||
| 1784 | - if (_param == null || EngineUtils.isEmptyObject(_param)) { | ||
| 1785 | - loger.error('删除媒体文件失败->参数错误', _param); | ||
| 1786 | - this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_MEDIASHARE_DELETE_FAILED_PARAM); | ||
| 1787 | - return; | ||
| 1788 | - } | ||
| 1789 | - //判断必要的参数字段值 | ||
| 1790 | - if (_param.itemIdx == null || isNaN(_param.itemIdx) || _param.fileId == null || _param.fileId == "") { | ||
| 1791 | - loger.error('删除媒体文件失败->', _param); | ||
| 1792 | - this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_MEDIASHARE_DELETE_FAILED_PARAM); | ||
| 1793 | - return; | ||
| 1794 | - } | ||
| 1795 | - loger.log('删除媒体文件->', _param); | 1786 | + //音乐共享模块的接口 |
| 1787 | + //上传 | ||
| 1788 | + _sendMusicSharedUpload(_param) { | ||
| 1789 | + if (!_mcu.connected) { | ||
| 1790 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1791 | + return; | ||
| 1792 | + } | ||
| 1793 | + if (_musicShareApe) { | ||
| 1794 | + _musicShareApe.musicSharedUpload(_param); | ||
| 1795 | + } | ||
| 1796 | + } | ||
| 1796 | 1797 | ||
| 1797 | - if (_sass) { | ||
| 1798 | - _sass.sassDeletMediaShare(_param); | ||
| 1799 | - } | ||
| 1800 | - } | ||
| 1801 | - //删除 | ||
| 1802 | - _sendMediaSharedDelete(_param) { | ||
| 1803 | - if (!_mcu.connected) { | ||
| 1804 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1805 | - return; | ||
| 1806 | - } | ||
| 1807 | - if (_mediaShareApe) { | ||
| 1808 | - _mediaShareApe.mediaSharedDelete(_param); | ||
| 1809 | - } | ||
| 1810 | - } | ||
| 1811 | - //更新媒体文件的状态信息 | ||
| 1812 | - _sendMediaSharedUpdate(_param) { | ||
| 1813 | - if (!_mcu.connected) { | ||
| 1814 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1815 | - return; | ||
| 1816 | - } | ||
| 1817 | - if (_mediaShareApe) { | ||
| 1818 | - _mediaShareApe.mediaSharedUpdate(_param); | ||
| 1819 | - } | ||
| 1820 | - } | ||
| 1821 | - //播放 | ||
| 1822 | - _sendMediaSharedPlay(_param) { | ||
| 1823 | - if (!_mcu.connected) { | ||
| 1824 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1825 | - return; | ||
| 1826 | - } | ||
| 1827 | - if (_mediaShareApe) { | ||
| 1828 | - _mediaShareApe.mediaSharedPlay(_param); | ||
| 1829 | - } | ||
| 1830 | - } | ||
| 1831 | - //停止 | ||
| 1832 | - _sendMediaSharedStop(_param) { | 1798 | + //Sass删除媒体文件数据 |
| 1799 | + _sassDeletMediaShare(_param) { | ||
| 1800 | + if (!_mcu.connected) { | ||
| 1801 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1802 | + return; | ||
| 1803 | + } | ||
| 1804 | + | ||
| 1805 | + //判断传入的参数是否存在 | ||
| 1806 | + if (_param == null || EngineUtils.isEmptyObject(_param)) { | ||
| 1807 | + loger.error('删除媒体文件失败->参数错误', _param); | ||
| 1808 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_MEDIASHARE_DELETE_FAILED_PARAM); | ||
| 1809 | + return; | ||
| 1810 | + } | ||
| 1811 | + //判断必要的参数字段值 | ||
| 1812 | + if (_param.itemIdx == null || isNaN(_param.itemIdx) || _param.fileId == null || _param.fileId == "") { | ||
| 1813 | + loger.error('删除媒体文件失败->', _param); | ||
| 1814 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_MEDIASHARE_DELETE_FAILED_PARAM); | ||
| 1815 | + return; | ||
| 1816 | + } | ||
| 1817 | + loger.log('删除媒体文件->', _param); | ||
| 1818 | + | ||
| 1819 | + if (_sass) { | ||
| 1820 | + _sass.sassDeletMediaShare(_param); | ||
| 1821 | + } | ||
| 1822 | + } | ||
| 1823 | + | ||
| 1824 | + //删除 | ||
| 1825 | + _sendMediaSharedDelete(_param) { | ||
| 1826 | + if (!_mcu.connected) { | ||
| 1827 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1828 | + return; | ||
| 1829 | + } | ||
| 1830 | + if (_mediaShareApe) { | ||
| 1831 | + _mediaShareApe.mediaSharedDelete(_param); | ||
| 1832 | + } | ||
| 1833 | + } | ||
| 1834 | + | ||
| 1835 | + //音乐更新 | ||
| 1836 | + _sendMusicSharedUpdate(_param) { | ||
| 1837 | + if (!_mcu.connected) { | ||
| 1838 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1839 | + return; | ||
| 1840 | + } | ||
| 1841 | + if (_musicShareApe) { | ||
| 1842 | + _musicShareApe.musicSharedUpdate(_param); | ||
| 1843 | + } | ||
| 1844 | + } | ||
| 1845 | + | ||
| 1846 | + //音乐播放 | ||
| 1847 | + _sendMusicSharedPlay(_param) { | ||
| 1833 | if (!_mcu.connected) { | 1848 | if (!_mcu.connected) { |
| 1834 | loger.warn(GlobalConfig.getCurrentStatus()); | 1849 | loger.warn(GlobalConfig.getCurrentStatus()); |
| 1835 | return; | 1850 | return; |
| 1836 | } | 1851 | } |
| 1837 | - if (_mediaShareApe) { | ||
| 1838 | - _mediaShareApe.mediaSharedStop(_param); | 1852 | + if (_musicShareApe) { |
| 1853 | + _musicShareApe.musicSharedPlay(_param); | ||
| 1839 | } | 1854 | } |
| 1840 | } | 1855 | } |
| 1856 | + //音乐停止 | ||
| 1857 | + _sendMusicSharedStop(_param) { | ||
| 1858 | + if (!_mcu.connected) { | ||
| 1859 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1860 | + return; | ||
| 1861 | + } | ||
| 1862 | + if (_musicShareApe) { | ||
| 1863 | + _musicShareApe.musicSharedStop(_param); | ||
| 1864 | + } | ||
| 1865 | + } | ||
| 1841 | 1866 | ||
| 1842 | - //媒体共享模块加入频道成功,同步到MCU服务器上的数据 | ||
| 1843 | - mediaShareApeJoinChannelSuccess() { | ||
| 1844 | - loger.log("媒体共享模块加入频道成功->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.sharedMediaList.length); | ||
| 1845 | - console.log("媒体共享模数据->", GlobalConfig.sharedMediaList); | ||
| 1846 | - //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 | ||
| 1847 | - if (GlobalConfig.isHost && GlobalConfig.sharedMediaList.length > 0) { | ||
| 1848 | - for (let i = 0; i < GlobalConfig.sharedMediaList.length; i++) { | ||
| 1849 | - let value = GlobalConfig.sharedMediaList[i]; | ||
| 1850 | - if (value) { | ||
| 1851 | - let paramInfo = { | ||
| 1852 | - "status": 0, | ||
| 1853 | - "creatUserId": value.creatUserId, | ||
| 1854 | - "creatUserName": value.createUserName, | ||
| 1855 | - "url": value.url, | ||
| 1856 | - "fileType": value.type, | ||
| 1857 | - "fileId": "" + value.id, | ||
| 1858 | - "fileName": value.name, | ||
| 1859 | - "seek": 0 | ||
| 1860 | - }; | ||
| 1861 | - this._sendMediaSharedUpload(paramInfo); | ||
| 1862 | - } | ||
| 1863 | - } | ||
| 1864 | - } | 1867 | + //更新媒体文件的状态信息 |
| 1868 | + _sendMediaSharedUpdate(_param) { | ||
| 1869 | + if (!_mcu.connected) { | ||
| 1870 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1871 | + return; | ||
| 1872 | + } | ||
| 1873 | + if (_mediaShareApe) { | ||
| 1874 | + _mediaShareApe.mediaSharedUpdate(_param); | ||
| 1865 | } | 1875 | } |
| 1876 | + } | ||
| 1866 | 1877 | ||
| 1867 | - //录制回放相关的处理------------------------------------------------ | ||
| 1868 | - //录制回放初始化 | ||
| 1869 | - _initRecordPlayback(_param) { | ||
| 1870 | - //{"classId":"1653304953","portal":"112.126.80.182:80","userRole":"normal","userId":0} | ||
| 1871 | - if (_param == null) { | ||
| 1872 | - loger.error('录制回放初始化失败->参数错误'); | ||
| 1873 | - this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_INIT_RECORD_PLAY_BACK_FAILED); | 1878 | + //播放 |
| 1879 | + _sendMediaSharedPlay(_param) { | ||
| 1880 | + if (!_mcu.connected) { | ||
| 1881 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1874 | return; | 1882 | return; |
| 1875 | } | 1883 | } |
| 1876 | - //判断必要的参数字段值 | ||
| 1877 | - if (_param.classId == null || isNaN(_param.classId) || _param.portal == null || _param.portal == "") { | ||
| 1878 | - loger.error('录制回放初始化失败->', _param); | ||
| 1879 | - this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_INIT_RECORD_PLAY_BACK_FAILED); | ||
| 1880 | - return; | 1884 | + if (_mediaShareApe) { |
| 1885 | + _mediaShareApe.mediaSharedPlay(_param); | ||
| 1881 | } | 1886 | } |
| 1882 | - loger.log('录制回放初始化->', _param); | 1887 | + } |
| 1888 | + //停止 | ||
| 1883 | 1889 | ||
| 1884 | - //保存参数 | ||
| 1885 | - GlobalConfig.isRecordPlayBack = true; //设置为录制回放状态 | ||
| 1886 | - GlobalConfig.classId = parseInt(_param.classId); | ||
| 1887 | - GlobalConfig.portal = _param.portal; | ||
| 1888 | - GlobalConfig.userRole = ApeConsts.normal; //*************很重要,录制回放的时候,身份模式是普通人******** | ||
| 1889 | - GlobalConfig.userId = _param.userId || "0"; | ||
| 1890 | - GlobalConfig.userName = _param.userName || ""; | 1890 | + _sendMediaSharedStop(_param) { |
| 1891 | + if (!_mcu.connected) { | ||
| 1892 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 1893 | + return; | ||
| 1894 | + } | ||
| 1895 | + if (_mediaShareApe) { | ||
| 1896 | + _mediaShareApe.mediaSharedStop(_param); | ||
| 1897 | + } | ||
| 1898 | + } | ||
| 1891 | 1899 | ||
| 1892 | - //获取课堂最完整的数据,录制回放需要获取课堂数据 | ||
| 1893 | - if (_sass) { | ||
| 1894 | - _sass.getClassParam(); | 1900 | + //音乐共享模块加入频道成功,同步到MCU服务器上的数据 |
| 1901 | + musicShareApeJoinChannelSuccess() { | ||
| 1902 | + loger.log("媒体共享模块加入频道成功->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.sharedMusicList.length); | ||
| 1903 | + console.log("媒体共享模数据->", GlobalConfig.sharedMusicList); | ||
| 1904 | + //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 | ||
| 1905 | + if (GlobalConfig.isHost && GlobalConfig.sharedMusicList.length > 0) { | ||
| 1906 | + for (let i = 0; i < GlobalConfig.sharedMusicList.length; i++) { | ||
| 1907 | + let value = GlobalConfig.sharedMusicList[i]; | ||
| 1908 | + if (value) { | ||
| 1909 | + let paramInfo = { | ||
| 1910 | + "status": 0, | ||
| 1911 | + "creatUserId": value.creatUserId, | ||
| 1912 | + "creatUserName": value.createUserName, | ||
| 1913 | + "url": value.url, | ||
| 1914 | + "fileType": value.type, | ||
| 1915 | + "fileId": "" + value.id, | ||
| 1916 | + "fileName": value.name, | ||
| 1917 | + "seek": 0 | ||
| 1918 | + }; | ||
| 1919 | + this._sendMusicSharedUpload(paramInfo); | ||
| 1920 | + } | ||
| 1895 | } | 1921 | } |
| 1896 | } | 1922 | } |
| 1923 | + } | ||
| 1897 | 1924 | ||
| 1898 | - //开始录制回放 | ||
| 1899 | - _startRecordPlayback(_param) { | ||
| 1900 | - if (_recordPlayback) { | ||
| 1901 | - _recordPlayback.startRecordPlayback(_param); | 1925 | + //媒体共享模块加入频道成功,同步到MCU服务器上的数据 |
| 1926 | + mediaShareApeJoinChannelSuccess() { | ||
| 1927 | + loger.log("媒体共享模块加入频道成功->isHost=", GlobalConfig.isHost, "length=", GlobalConfig.sharedMediaList.length); | ||
| 1928 | + console.log("媒体共享模数据->", GlobalConfig.sharedMediaList); | ||
| 1929 | + //如果是主持人,那么需要判断一下文档模块同步的数据和从sass获取的文档数据是否相同,如果mcu服务器不存在的,需要上传 | ||
| 1930 | + if (GlobalConfig.isHost && GlobalConfig.sharedMediaList.length > 0) { | ||
| 1931 | + for (let i = 0; i < GlobalConfig.sharedMediaList.length; i++) { | ||
| 1932 | + let value = GlobalConfig.sharedMediaList[i]; | ||
| 1933 | + if (value) { | ||
| 1934 | + let paramInfo = { | ||
| 1935 | + "status": 0, | ||
| 1936 | + "creatUserId": value.creatUserId, | ||
| 1937 | + "creatUserName": value.createUserName, | ||
| 1938 | + "url": value.url, | ||
| 1939 | + "fileType": value.type, | ||
| 1940 | + "fileId": "" + value.id, | ||
| 1941 | + "fileName": value.name, | ||
| 1942 | + "seek": 0 | ||
| 1943 | + }; | ||
| 1944 | + this._sendMediaSharedUpload(paramInfo); | ||
| 1945 | + } | ||
| 1902 | } | 1946 | } |
| 1903 | } | 1947 | } |
| 1948 | + } | ||
| 1904 | 1949 | ||
| 1905 | - //停止录制回放 | ||
| 1906 | - _stopRecordPlayback(_param) { | ||
| 1907 | - if (_recordPlayback) { | ||
| 1908 | - _recordPlayback.stopRecordPlayback(_param); | ||
| 1909 | - } | 1950 | + //录制回放相关的处理------------------------------------------------ |
| 1951 | + //录制回放初始化 | ||
| 1952 | + _initRecordPlayback(_param) { | ||
| 1953 | + //{"classId":"1653304953","portal":"112.126.80.182:80","userRole":"normal","userId":0} | ||
| 1954 | + if (_param == null) { | ||
| 1955 | + loger.error('录制回放初始化失败->参数错误'); | ||
| 1956 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_INIT_RECORD_PLAY_BACK_FAILED); | ||
| 1957 | + return; | ||
| 1910 | } | 1958 | } |
| 1959 | + //判断必要的参数字段值 | ||
| 1960 | + if (_param.classId == null || isNaN(_param.classId) || _param.portal == null || _param.portal == "") { | ||
| 1961 | + loger.error('录制回放初始化失败->', _param); | ||
| 1962 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_INIT_RECORD_PLAY_BACK_FAILED); | ||
| 1963 | + return; | ||
| 1964 | + } | ||
| 1965 | + loger.log('录制回放初始化->', _param); | ||
| 1911 | 1966 | ||
| 1912 | - //暂停录制回放 | ||
| 1913 | - _pauseRecordPlayback(_param) { | ||
| 1914 | - if (_recordPlayback) { | ||
| 1915 | - _recordPlayback.pauseRecordPlayback(_param); | ||
| 1916 | - } | 1967 | + //保存参数 |
| 1968 | + GlobalConfig.isRecordPlayBack = true; //设置为录制回放状态 | ||
| 1969 | + GlobalConfig.classId = parseInt(_param.classId); | ||
| 1970 | + GlobalConfig.portal = _param.portal; | ||
| 1971 | + GlobalConfig.userRole = ApeConsts.normal; //*************很重要,录制回放的时候,身份模式是普通人******** | ||
| 1972 | + GlobalConfig.userId = _param.userId || "0"; | ||
| 1973 | + GlobalConfig.userName = _param.userName || ""; | ||
| 1974 | + | ||
| 1975 | + //获取课堂最完整的数据,录制回放需要获取课堂数据 | ||
| 1976 | + if (_sass) { | ||
| 1977 | + _sass.getClassParam(); | ||
| 1917 | } | 1978 | } |
| 1979 | + } | ||
| 1918 | 1980 | ||
| 1919 | - //seek录制回放 | ||
| 1920 | - _seekRecordPlayback(_param) { | ||
| 1921 | - if (_recordPlayback) { | ||
| 1922 | - _recordPlayback.seekRecordPlayback(_param); | ||
| 1923 | - } | 1981 | + //开始录制回放 |
| 1982 | + _startRecordPlayback(_param) { | ||
| 1983 | + if (_recordPlayback) { | ||
| 1984 | + _recordPlayback.startRecordPlayback(_param); | ||
| 1924 | } | 1985 | } |
| 1986 | + } | ||
| 1925 | 1987 | ||
| 1926 | - //录制回放状态更新 | ||
| 1927 | - _recordPlaybackClearDataHandler(_param) { | ||
| 1928 | - loger.log("录制回放状态更新->") | ||
| 1929 | - if (_doc_ape) { | ||
| 1930 | - _doc_ape.clearData(); | ||
| 1931 | - } | ||
| 1932 | - if (_whiteboard_ape) { | ||
| 1933 | - _whiteboard_ape.clearData(); | ||
| 1934 | - } | ||
| 1935 | - if (_video_ape) { | ||
| 1936 | - _video_ape.clearData(); | ||
| 1937 | - } | 1988 | + //停止录制回放 |
| 1989 | + _stopRecordPlayback(_param) { | ||
| 1990 | + if (_recordPlayback) { | ||
| 1991 | + _recordPlayback.stopRecordPlayback(_param); | ||
| 1938 | } | 1992 | } |
| 1993 | + } | ||
| 1939 | 1994 | ||
| 1940 | - //录制回放加入 课堂成功 | ||
| 1941 | - _joinRecordPlaybackSuccessHandler(_data) { | ||
| 1942 | - loger.log('加入录制回放成功.'); | ||
| 1943 | - GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_2); | ||
| 1944 | - | ||
| 1945 | - //返回给客户端初始化成功的数据 | ||
| 1946 | - let joinClassSuccessCallBackData = {}; | ||
| 1947 | - | ||
| 1948 | - joinClassSuccessCallBackData.isRecordPlayBack = GlobalConfig.isRecordPlayBack; | ||
| 1949 | - | ||
| 1950 | - joinClassSuccessCallBackData.DOCServerIP = GlobalConfig.DOCServerIP; | ||
| 1951 | - joinClassSuccessCallBackData.DOCServerPort = GlobalConfig.DOCServerPort; | ||
| 1952 | - | ||
| 1953 | - joinClassSuccessCallBackData.classStatus = GlobalConfig.classStatus; | ||
| 1954 | - joinClassSuccessCallBackData.classId = GlobalConfig.classId; | ||
| 1955 | - joinClassSuccessCallBackData.className = GlobalConfig.className; | ||
| 1956 | - joinClassSuccessCallBackData.h5Module = GlobalConfig.h5Module; | ||
| 1957 | - joinClassSuccessCallBackData.isHost = GlobalConfig.isHost; // | ||
| 1958 | - joinClassSuccessCallBackData.maxAudioChannels = GlobalConfig.maxAudioChannels; | ||
| 1959 | - joinClassSuccessCallBackData.maxVideoChannels = GlobalConfig.maxVideoChannels; | ||
| 1960 | - joinClassSuccessCallBackData.maxMediaChannels = GlobalConfig.maxMediaChannels; | ||
| 1961 | - | ||
| 1962 | - joinClassSuccessCallBackData.mcuDelay = GlobalConfig.mcuDelay; | ||
| 1963 | - | ||
| 1964 | - joinClassSuccessCallBackData.msType = GlobalConfig.msType; | ||
| 1965 | - joinClassSuccessCallBackData.nodeId = GlobalConfig.nodeId; | ||
| 1966 | - joinClassSuccessCallBackData.password = GlobalConfig.password; | ||
| 1967 | - joinClassSuccessCallBackData.passwordRequired = GlobalConfig.passwordRequired; // 老师的默认是true | ||
| 1968 | - //GlobalConfig.passwordRequired 老师的默认是true | ||
| 1969 | - //GlobalConfig.portal=_data.portal; | ||
| 1970 | - joinClassSuccessCallBackData.role = GlobalConfig.role; | ||
| 1971 | - joinClassSuccessCallBackData.siteId = GlobalConfig.siteId; | ||
| 1972 | - joinClassSuccessCallBackData.topNodeID = GlobalConfig.topNodeID; | ||
| 1973 | - joinClassSuccessCallBackData.userId = GlobalConfig.userId; | ||
| 1974 | - joinClassSuccessCallBackData.userName = GlobalConfig.userName; | ||
| 1975 | - joinClassSuccessCallBackData.userRole = GlobalConfig.userRole; | ||
| 1976 | - joinClassSuccessCallBackData.userType = GlobalConfig.userType; | ||
| 1977 | - | ||
| 1978 | - joinClassSuccessCallBackData.siteId = GlobalConfig.siteId; | ||
| 1979 | - joinClassSuccessCallBackData.classId = GlobalConfig.classId; | ||
| 1980 | - joinClassSuccessCallBackData.userRole = GlobalConfig.userRole; | ||
| 1981 | - joinClassSuccessCallBackData.userId = GlobalConfig.userId; | ||
| 1982 | - joinClassSuccessCallBackData.passwordRequired = GlobalConfig.passwordRequired; | ||
| 1983 | - joinClassSuccessCallBackData.classType = GlobalConfig.classType || ApeConsts.CLASS_TYPE_1; | ||
| 1984 | - | ||
| 1985 | - joinClassSuccessCallBackData.country = GlobalConfig.country; //国家 | ||
| 1986 | - joinClassSuccessCallBackData.city = GlobalConfig.city; //城市 | ||
| 1987 | - joinClassSuccessCallBackData.province = GlobalConfig.province; //服务商 | ||
| 1988 | - joinClassSuccessCallBackData.isp = GlobalConfig.isp; //服务商 | ||
| 1989 | - | ||
| 1990 | - joinClassSuccessCallBackData.classTimestamp = GlobalConfig.classTimestamp; //课堂进行的累积时间 | ||
| 1991 | - joinClassSuccessCallBackData.recordTimestamp = GlobalConfig.recordTimestamp; //录制累积的总时间 | ||
| 1992 | - joinClassSuccessCallBackData.recordPlaybackMaxTime = GlobalConfig.recordPlaybackMaxTime; //录制回放的总时间 | ||
| 1993 | - | ||
| 1994 | - joinClassSuccessCallBackData.fps = GlobalConfig.fps; | ||
| 1995 | - joinClassSuccessCallBackData.gop = GlobalConfig.gop; | ||
| 1996 | - joinClassSuccessCallBackData.videoQuality = GlobalConfig.videoQuality; | ||
| 1997 | - | ||
| 1998 | - joinClassSuccessCallBackData.ssTunnelAppURL = GlobalConfig.ssTunnelAppURL; | ||
| 1999 | - joinClassSuccessCallBackData.currentSceneTableId = GlobalConfig.currentSceneTableId; //文档区域的模块显示 | ||
| 2000 | - loger.log(joinClassSuccessCallBackData); | ||
| 2001 | - //和加入课堂成功使用同样的消息处理 | ||
| 2002 | - this._emit(MessageTypes.CLASS_JOIN_SUCCESS, joinClassSuccessCallBackData); | ||
| 2003 | - } | ||
| 2004 | - | ||
| 2005 | - // //答题卡 | ||
| 2006 | - _creatQuestion(_param) { | ||
| 2007 | - if (!_mcu.connected) { | ||
| 2008 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 2009 | - return; | ||
| 2010 | - } | ||
| 2011 | - if (_questionApe) { | ||
| 2012 | - _questionApe.creatQuestion(_param); | ||
| 2013 | - } | 1995 | + //暂停录制回放 |
| 1996 | + _pauseRecordPlayback(_param) { | ||
| 1997 | + if (_recordPlayback) { | ||
| 1998 | + _recordPlayback.pauseRecordPlayback(_param); | ||
| 2014 | } | 1999 | } |
| 2015 | - _getQuestion(_param) { | ||
| 2016 | - if (!_mcu.connected) { | ||
| 2017 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 2018 | - return; | ||
| 2019 | - } | ||
| 2020 | - if (_questionApe) { | ||
| 2021 | - _questionApe.getQuestion(_param); | ||
| 2022 | - } | 2000 | + } |
| 2001 | + | ||
| 2002 | + //seek录制回放 | ||
| 2003 | + _seekRecordPlayback(_param) { | ||
| 2004 | + if (_recordPlayback) { | ||
| 2005 | + _recordPlayback.seekRecordPlayback(_param); | ||
| 2023 | } | 2006 | } |
| 2024 | - _getQuestionResult(_param) { | ||
| 2025 | - if (!_mcu.connected) { | ||
| 2026 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 2027 | - return; | ||
| 2028 | - } | ||
| 2029 | - if (_questionApe) { | ||
| 2030 | - _questionApe.getQuestionResult(_param); | ||
| 2031 | - } | 2007 | + } |
| 2008 | + | ||
| 2009 | + //录制回放状态更新 | ||
| 2010 | + _recordPlaybackClearDataHandler(_param) { | ||
| 2011 | + loger.log("录制回放状态更新->") | ||
| 2012 | + if (_doc_ape) { | ||
| 2013 | + _doc_ape.clearData(); | ||
| 2032 | } | 2014 | } |
| 2033 | - _stopQuestion(_param) { | ||
| 2034 | - if (!_mcu.connected) { | ||
| 2035 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 2036 | - return; | ||
| 2037 | - } | ||
| 2038 | - if (_questionApe) { | ||
| 2039 | - _questionApe.stopQuestion(_param); | ||
| 2040 | - } | 2015 | + if (_whiteboard_ape) { |
| 2016 | + _whiteboard_ape.clearData(); | ||
| 2041 | } | 2017 | } |
| 2042 | - _sendAnswer(_param) { | ||
| 2043 | - if (!_mcu.connected) { | ||
| 2044 | - loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 2045 | - return; | ||
| 2046 | - } | ||
| 2047 | - if (_questionApe) { | ||
| 2048 | - _questionApe.sendAnswer(_param); | ||
| 2049 | - } | 2018 | + if (_video_ape) { |
| 2019 | + _video_ape.clearData(); | ||
| 2050 | } | 2020 | } |
| 2021 | + } | ||
| 2022 | + | ||
| 2023 | + //录制回放加入 课堂成功 | ||
| 2024 | + _joinRecordPlaybackSuccessHandler(_data) { | ||
| 2025 | + loger.log('加入录制回放成功.'); | ||
| 2026 | + GlobalConfig.setCurrentStatus(GlobalConfig.statusCode_2); | ||
| 2027 | + | ||
| 2028 | + //返回给客户端初始化成功的数据 | ||
| 2029 | + let joinClassSuccessCallBackData = {}; | ||
| 2030 | + | ||
| 2031 | + joinClassSuccessCallBackData.isRecordPlayBack = GlobalConfig.isRecordPlayBack; | ||
| 2032 | + | ||
| 2033 | + joinClassSuccessCallBackData.DOCServerIP = GlobalConfig.DOCServerIP; | ||
| 2034 | + joinClassSuccessCallBackData.DOCServerPort = GlobalConfig.DOCServerPort; | ||
| 2035 | + | ||
| 2036 | + joinClassSuccessCallBackData.classStatus = GlobalConfig.classStatus; | ||
| 2037 | + joinClassSuccessCallBackData.classId = GlobalConfig.classId; | ||
| 2038 | + joinClassSuccessCallBackData.className = GlobalConfig.className; | ||
| 2039 | + joinClassSuccessCallBackData.h5Module = GlobalConfig.h5Module; | ||
| 2040 | + joinClassSuccessCallBackData.isHost = GlobalConfig.isHost; // | ||
| 2041 | + joinClassSuccessCallBackData.maxAudioChannels = GlobalConfig.maxAudioChannels; | ||
| 2042 | + joinClassSuccessCallBackData.maxVideoChannels = GlobalConfig.maxVideoChannels; | ||
| 2043 | + joinClassSuccessCallBackData.maxMediaChannels = GlobalConfig.maxMediaChannels; | ||
| 2044 | + | ||
| 2045 | + joinClassSuccessCallBackData.mcuDelay = GlobalConfig.mcuDelay; | ||
| 2046 | + | ||
| 2047 | + joinClassSuccessCallBackData.msType = GlobalConfig.msType; | ||
| 2048 | + joinClassSuccessCallBackData.nodeId = GlobalConfig.nodeId; | ||
| 2049 | + joinClassSuccessCallBackData.password = GlobalConfig.password; | ||
| 2050 | + joinClassSuccessCallBackData.passwordRequired = GlobalConfig.passwordRequired; // 老师的默认是true | ||
| 2051 | + //GlobalConfig.passwordRequired 老师的默认是true | ||
| 2052 | + //GlobalConfig.portal=_data.portal; | ||
| 2053 | + joinClassSuccessCallBackData.role = GlobalConfig.role; | ||
| 2054 | + joinClassSuccessCallBackData.siteId = GlobalConfig.siteId; | ||
| 2055 | + joinClassSuccessCallBackData.topNodeID = GlobalConfig.topNodeID; | ||
| 2056 | + joinClassSuccessCallBackData.userId = GlobalConfig.userId; | ||
| 2057 | + joinClassSuccessCallBackData.userName = GlobalConfig.userName; | ||
| 2058 | + joinClassSuccessCallBackData.userRole = GlobalConfig.userRole; | ||
| 2059 | + joinClassSuccessCallBackData.userType = GlobalConfig.userType; | ||
| 2060 | + | ||
| 2061 | + joinClassSuccessCallBackData.siteId = GlobalConfig.siteId; | ||
| 2062 | + joinClassSuccessCallBackData.classId = GlobalConfig.classId; | ||
| 2063 | + joinClassSuccessCallBackData.userRole = GlobalConfig.userRole; | ||
| 2064 | + joinClassSuccessCallBackData.userId = GlobalConfig.userId; | ||
| 2065 | + joinClassSuccessCallBackData.passwordRequired = GlobalConfig.passwordRequired; | ||
| 2066 | + joinClassSuccessCallBackData.classType = GlobalConfig.classType || ApeConsts.CLASS_TYPE_1; | ||
| 2067 | + | ||
| 2068 | + joinClassSuccessCallBackData.country = GlobalConfig.country; //国家 | ||
| 2069 | + joinClassSuccessCallBackData.city = GlobalConfig.city; //城市 | ||
| 2070 | + joinClassSuccessCallBackData.province = GlobalConfig.province; //服务商 | ||
| 2071 | + joinClassSuccessCallBackData.isp = GlobalConfig.isp; //服务商 | ||
| 2072 | + | ||
| 2073 | + joinClassSuccessCallBackData.classTimestamp = GlobalConfig.classTimestamp; //课堂进行的累积时间 | ||
| 2074 | + joinClassSuccessCallBackData.recordTimestamp = GlobalConfig.recordTimestamp; //录制累积的总时间 | ||
| 2075 | + joinClassSuccessCallBackData.recordPlaybackMaxTime = GlobalConfig.recordPlaybackMaxTime; //录制回放的总时间 | ||
| 2076 | + | ||
| 2077 | + joinClassSuccessCallBackData.fps = GlobalConfig.fps; | ||
| 2078 | + joinClassSuccessCallBackData.gop = GlobalConfig.gop; | ||
| 2079 | + joinClassSuccessCallBackData.videoQuality = GlobalConfig.videoQuality; | ||
| 2051 | 2080 | ||
| 2081 | + joinClassSuccessCallBackData.ssTunnelAppURL = GlobalConfig.ssTunnelAppURL; | ||
| 2082 | + joinClassSuccessCallBackData.currentSceneTableId = GlobalConfig.currentSceneTableId; //文档区域的模块显示 | ||
| 2083 | + loger.log(joinClassSuccessCallBackData); | ||
| 2084 | + //和加入课堂成功使用同样的消息处理 | ||
| 2085 | + this._emit(MessageTypes.CLASS_JOIN_SUCCESS, joinClassSuccessCallBackData); | ||
| 2086 | + } | ||
| 2087 | + | ||
| 2088 | + // //答题卡 | ||
| 2089 | + _creatQuestion(_param) { | ||
| 2090 | + if (!_mcu.connected) { | ||
| 2091 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 2092 | + return; | ||
| 2093 | + } | ||
| 2094 | + if (_questionApe) { | ||
| 2095 | + _questionApe.creatQuestion(_param); | ||
| 2096 | + } | ||
| 2097 | + } | ||
| 2098 | + _getQuestion(_param) { | ||
| 2099 | + if (!_mcu.connected) { | ||
| 2100 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 2101 | + return; | ||
| 2102 | + } | ||
| 2103 | + if (_questionApe) { | ||
| 2104 | + _questionApe.getQuestion(_param); | ||
| 2105 | + } | ||
| 2106 | + } | ||
| 2107 | + _getQuestionResult(_param) { | ||
| 2108 | + if (!_mcu.connected) { | ||
| 2109 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 2110 | + return; | ||
| 2111 | + } | ||
| 2112 | + if (_questionApe) { | ||
| 2113 | + _questionApe.getQuestionResult(_param); | ||
| 2114 | + } | ||
| 2115 | + } | ||
| 2116 | + _stopQuestion(_param) { | ||
| 2117 | + if (!_mcu.connected) { | ||
| 2118 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 2119 | + return; | ||
| 2120 | + } | ||
| 2121 | + if (_questionApe) { | ||
| 2122 | + _questionApe.stopQuestion(_param); | ||
| 2123 | + } | ||
| 2052 | } | 2124 | } |
| 2125 | + _sendAnswer(_param) { | ||
| 2126 | + if (!_mcu.connected) { | ||
| 2127 | + loger.warn(GlobalConfig.getCurrentStatus()); | ||
| 2128 | + return; | ||
| 2129 | + } | ||
| 2130 | + if (_questionApe) { | ||
| 2131 | + _questionApe.sendAnswer(_param); | ||
| 2132 | + } | ||
| 2133 | + } | ||
| 2134 | + | ||
| 2135 | +} | ||
| 2053 | 2136 |
| @@ -202,6 +202,15 @@ class GlobalConfig { | @@ -202,6 +202,15 @@ class GlobalConfig { | ||
| 202 | return this.sharedMediaList; | 202 | return this.sharedMediaList; |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | + //储存已经提前上传的媒体共享文件列表 | ||
| 206 | + static setMusicShareList(_data) { | ||
| 207 | + if (_data == null) return; | ||
| 208 | + this.sharedMusicList = _data; | ||
| 209 | + } | ||
| 210 | + static getMusicShareList() { | ||
| 211 | + return this.sharedMusicList; | ||
| 212 | + } | ||
| 213 | + | ||
| 205 | //储存录制列表 | 214 | //储存录制列表 |
| 206 | static setRecordList(_data) { | 215 | static setRecordList(_data) { |
| 207 | if (_data == null) return; | 216 | if (_data == null) return; |
| @@ -429,6 +438,7 @@ GlobalConfig.classDetail = {}; //Sass直接返回的当前课堂基本信息 | @@ -429,6 +438,7 @@ GlobalConfig.classDetail = {}; //Sass直接返回的当前课堂基本信息 | ||
| 429 | 438 | ||
| 430 | //从Sass获取的 | 439 | //从Sass获取的 |
| 431 | GlobalConfig.sharedMediaList = []; // 已经提前上传的媒体文件列表,进入课堂后需要自动加载 | 440 | GlobalConfig.sharedMediaList = []; // 已经提前上传的媒体文件列表,进入课堂后需要自动加载 |
| 441 | +GlobalConfig.sharedMusicList = []; // 已经提前上传的音乐文件列表,进入课堂后需要自动加载 | ||
| 432 | GlobalConfig.docListPrepare = []; // 已经提前上传的文档,进入课堂后需要自动加载 | 442 | GlobalConfig.docListPrepare = []; // 已经提前上传的文档,进入课堂后需要自动加载 |
| 433 | GlobalConfig.recordList = []; //录制服务器地址集合 | 443 | GlobalConfig.recordList = []; //录制服务器地址集合 |
| 434 | GlobalConfig.docList = []; //文档服务器地址集合 | 444 | GlobalConfig.docList = []; //文档服务器地址集合 |
| @@ -141,6 +141,7 @@ ApeConsts.SCREENSHARING_SESSION_ID = 20; | @@ -141,6 +141,7 @@ ApeConsts.SCREENSHARING_SESSION_ID = 20; | ||
| 141 | ApeConsts.POLL_SESSION_ID = 21; | 141 | ApeConsts.POLL_SESSION_ID = 21; |
| 142 | ApeConsts.QUESTION_SESSION_ID = 22; | 142 | ApeConsts.QUESTION_SESSION_ID = 22; |
| 143 | ApeConsts.CURSOR_SESSION_ID = 23; | 143 | ApeConsts.CURSOR_SESSION_ID = 23; |
| 144 | +ApeConsts.MUSIC_SESSION_ID = 24; | ||
| 144 | 145 | ||
| 145 | // defs for common channel id | 146 | // defs for common channel id |
| 146 | ApeConsts.BROADCAST_CHANNEL_ID = 0; | 147 | ApeConsts.BROADCAST_CHANNEL_ID = 0; |
| @@ -152,6 +153,7 @@ ApeConsts.DOCSHARING_CHANNEL_ID = ApeConsts.DOCSHARING_SESSION_ID; | @@ -152,6 +153,7 @@ ApeConsts.DOCSHARING_CHANNEL_ID = ApeConsts.DOCSHARING_SESSION_ID; | ||
| 152 | ApeConsts.WHITEBOARD_CHANNEL_ID = ApeConsts.WHITEBOARD_SESSION_ID; | 153 | ApeConsts.WHITEBOARD_CHANNEL_ID = ApeConsts.WHITEBOARD_SESSION_ID; |
| 153 | ApeConsts.CURSOR_CHANNEL_ID = ApeConsts.CURSOR_SESSION_ID; | 154 | ApeConsts.CURSOR_CHANNEL_ID = ApeConsts.CURSOR_SESSION_ID; |
| 154 | ApeConsts.MEDIA_CHANNEL_ID = ApeConsts.MEDIA_SESSION_ID; | 155 | ApeConsts.MEDIA_CHANNEL_ID = ApeConsts.MEDIA_SESSION_ID; |
| 156 | +ApeConsts.MUSIC_CHANNEL_ID = ApeConsts.MUSIC_SESSION_ID; | ||
| 155 | ApeConsts.SCREENSHARING_CHANNEL_ID = ApeConsts.SCREENSHARING_SESSION_ID; | 157 | ApeConsts.SCREENSHARING_CHANNEL_ID = ApeConsts.SCREENSHARING_SESSION_ID; |
| 156 | 158 | ||
| 157 | ApeConsts.QUESTION_CHANNEL_ID = ApeConsts.QUESTION_SESSION_ID; | 159 | ApeConsts.QUESTION_CHANNEL_ID = ApeConsts.QUESTION_SESSION_ID; |
| @@ -167,6 +169,7 @@ ApeConsts.DOCSHARING_SESSION_NAME = "doc sharing app"; | @@ -167,6 +169,7 @@ ApeConsts.DOCSHARING_SESSION_NAME = "doc sharing app"; | ||
| 167 | ApeConsts.WHITEBOARD_SESSION_NAME = "whiteboard app"; | 169 | ApeConsts.WHITEBOARD_SESSION_NAME = "whiteboard app"; |
| 168 | ApeConsts.CURSOR_SESSION_NAME = "cursor app"; | 170 | ApeConsts.CURSOR_SESSION_NAME = "cursor app"; |
| 169 | ApeConsts.MEDIA_SESSION_NAME = "media sharing app"; | 171 | ApeConsts.MEDIA_SESSION_NAME = "media sharing app"; |
| 172 | +ApeConsts.MUSIC_SESSION_NAME = "music sharing app"; | ||
| 170 | ApeConsts.SCREENSHARING_SESSION_NAME = "screen sharing app"; | 173 | ApeConsts.SCREENSHARING_SESSION_NAME = "screen sharing app"; |
| 171 | ApeConsts.QUESTION_SESSION_NAME = "question app"; | 174 | ApeConsts.QUESTION_SESSION_NAME = "question app"; |
| 172 | 175 | ||
| @@ -181,6 +184,7 @@ ApeConsts.DOCSHARING_SESSION_TAG = "doc-tag"; | @@ -181,6 +184,7 @@ ApeConsts.DOCSHARING_SESSION_TAG = "doc-tag"; | ||
| 181 | ApeConsts.WHITEBOARD_SESSION_TAG = "wbd-tag"; | 184 | ApeConsts.WHITEBOARD_SESSION_TAG = "wbd-tag"; |
| 182 | ApeConsts.CURSOR_SESSION_TAG = "cursor-tag"; | 185 | ApeConsts.CURSOR_SESSION_TAG = "cursor-tag"; |
| 183 | ApeConsts.MEDIA_SESSION_TAG = "med-tag"; | 186 | ApeConsts.MEDIA_SESSION_TAG = "med-tag"; |
| 187 | +ApeConsts.MUSIC_SESSION_TAG = "mis-tag"; | ||
| 184 | ApeConsts.SCREENSHARING_SESSION_TAG = "scr-tag"; | 188 | ApeConsts.SCREENSHARING_SESSION_TAG = "scr-tag"; |
| 185 | ApeConsts.QUESTION_SESSION_TAG = "qst-tag"; | 189 | ApeConsts.QUESTION_SESSION_TAG = "qst-tag"; |
| 186 | 190 | ||
| @@ -237,6 +241,11 @@ ApeConsts.MEDIA_OBJ_TABLE_ID = ((ApeConsts.MEDIA_SESSION_ID << 16) + 1); | @@ -237,6 +241,11 @@ ApeConsts.MEDIA_OBJ_TABLE_ID = ((ApeConsts.MEDIA_SESSION_ID << 16) + 1); | ||
| 237 | ApeConsts.MEDIA_OBJ_TABLE_NAME = "med list"; | 241 | ApeConsts.MEDIA_OBJ_TABLE_NAME = "med list"; |
| 238 | ApeConsts.MEDIA_OBJ_TABLE_TAG = "med list tag"; | 242 | ApeConsts.MEDIA_OBJ_TABLE_TAG = "med list tag"; |
| 239 | 243 | ||
| 244 | +// music sharing objects | ||
| 245 | +ApeConsts.MUSIC_OBJ_TABLE_ID = ((ApeConsts.MUSIC_SESSION_ID << 16) + 1); | ||
| 246 | +ApeConsts.MUSIC_OBJ_TABLE_NAME = "mis list"; | ||
| 247 | +ApeConsts.MUSIC_OBJ_TABLE_TAG = "mis list tag"; | ||
| 248 | + | ||
| 240 | // chat sharing objects | 249 | // chat sharing objects |
| 241 | ApeConsts.CHAT_OBJ_TABLE_ID = ((ApeConsts.CHAT_SESSION_ID << 16) + 1); | 250 | ApeConsts.CHAT_OBJ_TABLE_ID = ((ApeConsts.CHAT_SESSION_ID << 16) + 1); |
| 242 | ApeConsts.CHAT_OBJ_TABLE_NAME = "chat list"; | 251 | ApeConsts.CHAT_OBJ_TABLE_NAME = "chat list"; |
| @@ -454,23 +454,24 @@ class ConferApe extends Ape { | @@ -454,23 +454,24 @@ class ConferApe extends Ape { | ||
| 454 | } | 454 | } |
| 455 | //课堂的场景模块发送改变 | 455 | //课堂的场景模块发送改变 |
| 456 | sceneTableChange(_param) { | 456 | sceneTableChange(_param) { |
| 457 | - if (GlobalConfig.isRecordPlayBack) { | ||
| 458 | - return; | ||
| 459 | - } | ||
| 460 | - loger.log('切换文档-媒体-屏幕模块切换->', _param); | ||
| 461 | - //如果是host身份 | ||
| 462 | - if (GlobalConfig.isHost) { | ||
| 463 | - if (_param) { | ||
| 464 | - GlobalConfig.currentSceneTableId = parseInt(_param.currentSceneTableId) || 0; //当前场景显示的模块 0=文档模块、1=屏幕共享、2=媒体共享 | ||
| 465 | - //保存数据到Sass | ||
| 466 | - this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); | ||
| 467 | - //同步消息给其他人 | ||
| 468 | - this.sendUpdaterClassStatusInfo({ "actionType": 1, isStopAllPublishMedia: false }); | ||
| 469 | - } | 457 | + if (GlobalConfig.isRecordPlayBack) { |
| 458 | + return; | ||
| 459 | + } | ||
| 460 | + loger.log('切换文档-媒体-屏幕模块切换->', _param); | ||
| 461 | + //如果是host身份 | ||
| 462 | + if (GlobalConfig.isHost) { | ||
| 463 | + if (_param) { | ||
| 464 | + GlobalConfig.currentSceneTableId = parseInt(_param.currentSceneTableId) || 0; //当前场景显示的模块 0=文档模块、1=屏幕共享、2=媒体共享 | ||
| 465 | + //保存数据到Sass | ||
| 466 | + this._emit(MessageTypes.CLASS_STATUS_INFO_CHANGE); | ||
| 467 | + //同步消息给其他人 | ||
| 468 | + this.sendUpdaterClassStatusInfo({ "actionType": 1, isStopAllPublishMedia: false }); | ||
| 470 | } | 469 | } |
| 471 | - | ||
| 472 | } | 470 | } |
| 473 | - //更新课堂信息 | 471 | + |
| 472 | + } | ||
| 473 | + | ||
| 474 | + //更新课堂信息 | ||
| 474 | sendUpdaterClassStatusInfo(_param) { | 475 | sendUpdaterClassStatusInfo(_param) { |
| 475 | //{"actionType": 1,isStopAllPublishMedia:false} //actionType课堂状态 isStopAllPublishMedia是否停止当前的所有推流 | 476 | //{"actionType": 1,isStopAllPublishMedia:false} //actionType课堂状态 isStopAllPublishMedia是否停止当前的所有推流 |
| 476 | loger.log('发送更新课堂信息->'); | 477 | loger.log('发送更新课堂信息->'); |
src/apes/MusicSharedApe.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// 媒体共享模块 | ||
| 4 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 5 | + | ||
| 6 | +import Ape from './Ape'; | ||
| 7 | +import ApeConsts from './ApeConsts'; | ||
| 8 | +import pdu from 'pdus'; | ||
| 9 | +import Loger from 'Loger'; | ||
| 10 | +import MessageTypes from 'MessageTypes'; | ||
| 11 | +import GlobalConfig from 'GlobalConfig'; | ||
| 12 | +import EngineUtils from 'EngineUtils'; | ||
| 13 | + | ||
| 14 | +let loger = Loger.getLoger('MusicSharedApe'); | ||
| 15 | + | ||
| 16 | +class MusicSharedApe extends Ape { | ||
| 17 | + constructor() { | ||
| 18 | + super( | ||
| 19 | + ApeConsts.MUSIC_SESSION_ID, | ||
| 20 | + ApeConsts.MUSIC_SESSION_NAME, | ||
| 21 | + ApeConsts.MUSIC_SESSION_TAG | ||
| 22 | + ); | ||
| 23 | + | ||
| 24 | + this.musicSharedList = {}; //记录媒体数据 | ||
| 25 | + | ||
| 26 | + // Ape Models | ||
| 27 | + this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); | ||
| 28 | + this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.MUSIC_OBJ_TABLE_ID, ApeConsts.MUSIC_OBJ_TABLE_NAME, ApeConsts.MUSIC_OBJ_TABLE_TAG, 0, new ArrayBuffer); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /////////////发送数据操作////////////////////////////////////////////////////// | ||
| 32 | + //上传媒体文件 | ||
| 33 | + musicSharedUpload(paramInfo) { | ||
| 34 | + if (paramInfo == null || EngineUtils.isEmptyObject(paramInfo)) { | ||
| 35 | + loger.warn('上传媒体文件->失败->参数错误->', paramInfo); | ||
| 36 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 37 | + return; | ||
| 38 | + } | ||
| 39 | + //判断媒体文件是否已经存在,每个媒体文件都有唯一的fileId,如果已经同步的媒体文件中存在相同的fileId就不需要再同步 | ||
| 40 | + if (this.checkMusicSharedId(paramInfo.fileId)) { | ||
| 41 | + //媒体文件已经存在相同的fileId,不需要同步上传 | ||
| 42 | + loger.warn('上传媒体文件->失败->媒体文件档的fileId无效或已经存在相同的fileId不需要上传'); | ||
| 43 | + return; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + let itemIdx = EngineUtils.creatSoleNumberFromTimestamp(); // | ||
| 47 | + let pduDataModel = this.packPdu(paramInfo, itemIdx); | ||
| 48 | + if (pduDataModel == null) { | ||
| 49 | + loger.log('上传媒体文件->失败->数据无效'); | ||
| 50 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 51 | + return; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + let tableItemPdu = new pdu['RCRegistryTableItemPdu']; | ||
| 55 | + tableItemPdu.itemIdx = itemIdx; //直接用时间戳作为id | ||
| 56 | + tableItemPdu.registerObjId = ApeConsts.MUSIC_OBJ_TABLE_ID; | ||
| 57 | + tableItemPdu.owner = 0; //收到flash的是这个值,不清楚先写固定 | ||
| 58 | + tableItemPdu.itemData = pduDataModel.toArrayBuffer(); | ||
| 59 | + | ||
| 60 | + //insert | ||
| 61 | + let tableInsertItemPdu = new pdu['RCRegistryTableInsertItemPdu']; | ||
| 62 | + //optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_UPDATE_PDU]; | ||
| 63 | + //repeated RCRegistryTableItemPdu items = 2; | ||
| 64 | + tableInsertItemPdu.type = pdu.RCPDU_REG_TABLE_INSERT_PDU; // | ||
| 65 | + tableInsertItemPdu.items.push(tableItemPdu); | ||
| 66 | + | ||
| 67 | + let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; | ||
| 68 | + updateObjPdu.objId = ApeConsts.MUSIC_OBJ_TABLE_ID; | ||
| 69 | + updateObjPdu.subType = tableInsertItemPdu.type; | ||
| 70 | + updateObjPdu.userData = tableInsertItemPdu.toArrayBuffer(); | ||
| 71 | + | ||
| 72 | + //同步 | ||
| 73 | + let adapterItemPdu = new pdu['RCAdapterItemPdu']; | ||
| 74 | + adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ; | ||
| 75 | + adapterItemPdu.itemData = updateObjPdu.toArrayBuffer(); | ||
| 76 | + | ||
| 77 | + let adapterPdu = new pdu['RCAdapterPdu']; | ||
| 78 | + adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | ||
| 79 | + adapterPdu.item.push(adapterItemPdu); | ||
| 80 | + | ||
| 81 | + loger.log("上传媒体文件->发送->itemIdx=" + tableItemPdu.itemIdx); | ||
| 82 | + this.sendUniform(adapterPdu, true); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + //删除媒体文件 | ||
| 86 | + musicSharedDelete(paramInfo) { | ||
| 87 | + let tableDeleteItemPdu = new pdu['RCRegistryTableDeleteItemPdu']; | ||
| 88 | + tableDeleteItemPdu.type = pdu.RCPDU_REG_TABLE_DELETE_PDU; // | ||
| 89 | + tableDeleteItemPdu.itemIdx = parseInt(paramInfo.itemIdx); //这里需要设置要删除的数据的itemIdx,每条数据的这个id都不一样 | ||
| 90 | + | ||
| 91 | + let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; | ||
| 92 | + updateObjPdu.objId = ApeConsts.MUSIC_OBJ_TABLE_ID; | ||
| 93 | + updateObjPdu.subType = tableDeleteItemPdu.type; | ||
| 94 | + updateObjPdu.userData = tableDeleteItemPdu.toArrayBuffer(); | ||
| 95 | + | ||
| 96 | + //同步 | ||
| 97 | + let adapterItemPdu = new pdu['RCAdapterItemPdu']; | ||
| 98 | + adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ; | ||
| 99 | + adapterItemPdu.itemData = updateObjPdu.toArrayBuffer(); | ||
| 100 | + | ||
| 101 | + let adapterPdu = new pdu['RCAdapterPdu']; | ||
| 102 | + adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | ||
| 103 | + adapterPdu.item.push(adapterItemPdu); | ||
| 104 | + | ||
| 105 | + loger.log("媒体文件发送删除数据=============>" + tableDeleteItemPdu.itemIdx); | ||
| 106 | + this.sendUniform(adapterPdu, true); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + //更新 | ||
| 110 | + updaterMusicShared(_pduDataModel, _itemIdx) { | ||
| 111 | + //验证坐标点集合数组是否合法 | ||
| 112 | + if (_pduDataModel == null || _itemIdx == null) { | ||
| 113 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 114 | + return null; | ||
| 115 | + } | ||
| 116 | + loger.log("媒体文件->更新 ", _pduDataModel); | ||
| 117 | + | ||
| 118 | + let pduDataModel = this.packPdu(_pduDataModel, _itemIdx); | ||
| 119 | + let tableItemPdu = new pdu['RCRegistryTableItemPdu']; | ||
| 120 | + tableItemPdu.itemIdx = _itemIdx; //直接用时间戳作为id | ||
| 121 | + tableItemPdu.owner = 0; //收到flash的是这个值,不清楚先写固定 | ||
| 122 | + tableItemPdu.itemData = pduDataModel.toArrayBuffer(); | ||
| 123 | + | ||
| 124 | + //insert | ||
| 125 | + let tableInsertItemPdu = new pdu['RCRegistryTableUpdateItemPdu']; | ||
| 126 | + //optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_UPDATE_PDU]; | ||
| 127 | + //repeated RCRegistryTableItemPdu items = 2; | ||
| 128 | + tableInsertItemPdu.type = pdu.RCPDU_REG_TABLE_UPDATE_PDU; // | ||
| 129 | + tableInsertItemPdu.items.push(tableItemPdu); | ||
| 130 | + | ||
| 131 | + let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; | ||
| 132 | + updateObjPdu.objId = ApeConsts.MUSIC_OBJ_TABLE_ID; | ||
| 133 | + updateObjPdu.subType = tableInsertItemPdu.type; | ||
| 134 | + updateObjPdu.userData = tableInsertItemPdu.toArrayBuffer(); | ||
| 135 | + | ||
| 136 | + //同步 | ||
| 137 | + let adapterItemPdu = new pdu['RCAdapterItemPdu']; | ||
| 138 | + adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ; | ||
| 139 | + adapterItemPdu.itemData = updateObjPdu.toArrayBuffer(); | ||
| 140 | + | ||
| 141 | + let adapterPdu = new pdu['RCAdapterPdu']; | ||
| 142 | + adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | ||
| 143 | + adapterPdu.item.push(adapterItemPdu); | ||
| 144 | + | ||
| 145 | + loger.log("发送更新媒体文件.itemIdx=" + tableItemPdu.itemIdx); | ||
| 146 | + this.sendUniform(adapterPdu, true); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + //组织完整的媒体文件信息,包含上传时的信息和转换后的完整地址信息 | ||
| 150 | + _musicSharedPackFullInfo(_itemDataInfo) { | ||
| 151 | + let itemDataInfo = _itemDataInfo; | ||
| 152 | + if (!itemDataInfo.seek) { | ||
| 153 | + itemDataInfo.seek = 1; | ||
| 154 | + } | ||
| 155 | + loger.log('musicPackFullInfo->', itemDataInfo); | ||
| 156 | + return itemDataInfo; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + //更新媒体文件模块的录制信息,每次开启录制的时候需要把当前媒体文件的信息更新一次 | ||
| 160 | + updaterRecordApeStatus(_param) { | ||
| 161 | + loger.warn("录制状态发送改变->更新当前的媒体文件数据->fileId:", GlobalConfig.activeMusicId, 'page:', GlobalConfig.activeMusicSeek); | ||
| 162 | + this.musicSharedSeek({ | ||
| 163 | + "itemIdx": GlobalConfig.activeMusicId, | ||
| 164 | + "seek": GlobalConfig.activeMusicSeek | ||
| 165 | + }); | ||
| 166 | + } | ||
| 167 | + //清除当前媒体文件模块的数据 | ||
| 168 | + clearData() { | ||
| 169 | + loger.log("clearData->") | ||
| 170 | + this.musicSharedList = {}; | ||
| 171 | + GlobalConfig.activeMusicId = 0; | ||
| 172 | + GlobalConfig.activeMusicSeek = 1; | ||
| 173 | + | ||
| 174 | + } | ||
| 175 | + //更新媒体文件(播放,暂停,停止,seek) | ||
| 176 | + musicSharedUpdate(_param) { | ||
| 177 | + if (_param == null || _param.itemIdx == null) { | ||
| 178 | + loger.warn('媒体文件更新失败->参数错误', _param); | ||
| 179 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 180 | + return; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + //获取已经存在的数据 | ||
| 184 | + let pduDataModel = this.musicSharedList[_param.itemIdx]; | ||
| 185 | + if (pduDataModel == null) { | ||
| 186 | + loger.warn('更新媒体文件->媒体文件不存在', _param); | ||
| 187 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 188 | + return; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + //更新当前选择的媒体文件数据的字段 | ||
| 192 | + pduDataModel.status = parseInt(_param.status) || 0; //默认是0 | ||
| 193 | + pduDataModel.seek = parseInt(_param.seek) || 1; | ||
| 194 | + pduDataModel.musicVolume = parseInt(_param.musicVolume) || 0; | ||
| 195 | + //更新当前选择的媒体文件 | ||
| 196 | + this.updaterMusicShared(pduDataModel, pduDataModel.itemIdx); | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + //播放媒体文件 | ||
| 200 | + musicSharedPlay(paramInfo) { | ||
| 201 | + loger.log('切换媒体文件->', paramInfo); | ||
| 202 | + if (GlobalConfig.isRecordPlayBack) { | ||
| 203 | + loger.warn('录制回放状态不允许切换媒体文件'); | ||
| 204 | + return; | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + if (paramInfo == null || paramInfo.itemIdx == null) { | ||
| 208 | + loger.warn('切换媒体文件失败,参数错误', paramInfo); | ||
| 209 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 210 | + return; | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + /* if (paramInfo.itemIdx == GlobalConfig.activeMusicId && GlobalConfig.activeMusicId != 0) { | ||
| 214 | + loger.warn('媒体文件已经显示', paramInfo.itemIdx, GlobalConfig.activeMusicId); | ||
| 215 | + return; | ||
| 216 | + }*/ | ||
| 217 | + | ||
| 218 | + //更新切换之前的媒体文件的数据,要显示当前切换的媒体文件,上一个媒体文件需要隐藏 | ||
| 219 | + let oldPduDataModel; | ||
| 220 | + if (GlobalConfig.activeMusicId != 0) { | ||
| 221 | + oldPduDataModel = this.musicSharedList[GlobalConfig.activeMusicId]; | ||
| 222 | + if (oldPduDataModel) { | ||
| 223 | + oldPduDataModel.status = 0; //停止状态 | ||
| 224 | + //oldPduDataModel.seek=0; | ||
| 225 | + } | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + //获取已经存在的数据 | ||
| 229 | + let pduDataModel = this.musicSharedList[paramInfo.itemIdx]; | ||
| 230 | + if (pduDataModel == null) { | ||
| 231 | + loger.warn('切换媒体文件失败,媒体文件不存在', paramInfo); | ||
| 232 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 233 | + return; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + //更新当前选择的媒体文件数据的字段 | ||
| 237 | + pduDataModel.status = paramInfo.status || 0; //默认是0 | ||
| 238 | + pduDataModel.seek = paramInfo.seek || 1; | ||
| 239 | + pduDataModel.musicVolume = parseInt(paramInfo.musicVolume) || 0; | ||
| 240 | + //loger.log('切换媒体文件,当前媒体文件和上一个显示的媒体文件都需要更新状态'); | ||
| 241 | + loger.log({ "oldDoc": oldPduDataModel, "nowDoc": pduDataModel }); | ||
| 242 | + //更新当前选择的媒体文件 | ||
| 243 | + this.updaterMusicShared(pduDataModel, pduDataModel.itemIdx); | ||
| 244 | + | ||
| 245 | + //更新上一个媒体文件 隐藏 | ||
| 246 | + if (oldPduDataModel && oldPduDataModel.itemIdx != pduDataModel.itemIdx) { | ||
| 247 | + this.updaterMusicShared(oldPduDataModel, oldPduDataModel.itemIdx); | ||
| 248 | + } | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + //停止媒体文件 | ||
| 252 | + musicSharedStop(paramInfo) { | ||
| 253 | + loger.log('停止媒体文件->', paramInfo); | ||
| 254 | + if (GlobalConfig.isRecordPlayBack) { | ||
| 255 | + loger.warn('录制回放状态不允许停止媒体文件'); | ||
| 256 | + return; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + if (paramInfo == null || paramInfo.itemIdx == null) { | ||
| 260 | + loger.warn('停止媒体文件,参数错误', paramInfo); | ||
| 261 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 262 | + return; | ||
| 263 | + } | ||
| 264 | + | ||
| 265 | + //获取已经存在的数据 | ||
| 266 | + let pduDataModel = this.musicSharedList[paramInfo.itemIdx]; | ||
| 267 | + if (pduDataModel == null) { | ||
| 268 | + loger.warn('停止媒体文件,媒体文件不存在', paramInfo); | ||
| 269 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 270 | + return; | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + //更新当前选择的媒体文件数据的字段 | ||
| 274 | + pduDataModel.status = 0; //默认是0 | ||
| 275 | + pduDataModel.seek = 0; | ||
| 276 | + pduDataModel.musicVolume = 60; | ||
| 277 | + //更新当前选择的媒体文件 | ||
| 278 | + this.updaterMusicShared(pduDataModel, pduDataModel.itemIdx); | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + //暂停媒体文件 | ||
| 282 | + musicSharedPause(paramInfo) { | ||
| 283 | + loger.log('暂停媒体文件->', paramInfo); | ||
| 284 | + if (GlobalConfig.isRecordPlayBack) { | ||
| 285 | + loger.warn('录制回放-》暂停媒体文件'); | ||
| 286 | + return; | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + if (paramInfo == null || paramInfo.itemIdx == null) { | ||
| 290 | + loger.warn('暂停媒体文件,参数错误', paramInfo); | ||
| 291 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 292 | + return; | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + //获取已经存在的数据 | ||
| 296 | + let pduDataModel = this.musicSharedList[paramInfo.itemIdx]; | ||
| 297 | + if (pduDataModel == null) { | ||
| 298 | + loger.warn('暂停媒体文件,媒体文件不存在', paramInfo); | ||
| 299 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 300 | + return; | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + //更新当前选择的媒体文件数据的字段 | ||
| 304 | + pduDataModel.status = 2; //默认是0 | ||
| 305 | + //更新当前选择的媒体文件 | ||
| 306 | + this.updaterMusicShared(pduDataModel, pduDataModel.itemIdx); | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + //媒体文件SEEK | ||
| 310 | + musicSharedSeek(paramInfo) { | ||
| 311 | + loger.log('媒体文件SEEK->', paramInfo); | ||
| 312 | + //获取已经存在的数据 | ||
| 313 | + let pduDataModel = this.musicSharedList[paramInfo.itemIdx]; | ||
| 314 | + if (pduDataModel == null) { | ||
| 315 | + loger.log('媒体文件SEEK->媒体文件不存在', paramInfo); | ||
| 316 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 317 | + return; | ||
| 318 | + } | ||
| 319 | + //更新数据的字段 | ||
| 320 | + pduDataModel.seek = parseInt(paramInfo.seek) || 1; | ||
| 321 | + if (pduDataModel.seek < 1) { | ||
| 322 | + pduDataModel.seek = 1; //默认值最小是1 | ||
| 323 | + } | ||
| 324 | + this.updaterMusicShared(pduDataModel, pduDataModel.itemIdx); | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + /////收到消息处理///////////////////////////////////////////////////////////////////////////////// | ||
| 328 | + tableInsertHandler(owner, itemIdx, itemData) { | ||
| 329 | + | ||
| 330 | + } | ||
| 331 | + | ||
| 332 | + //添加媒体文件 | ||
| 333 | + tableInsertApeHandler(_tableUpdateItems, _seekTime) { | ||
| 334 | + let tableInsertItems = _tableUpdateItems; | ||
| 335 | + let tableInsertItemsLen = tableInsertItems.length; | ||
| 336 | + loger.log('添加媒体文件->_seekTime:' + _seekTime, "activeMusicId->", GlobalConfig.activeMusicId, "tableUpdateItemsLen->", tableInsertItemsLen); | ||
| 337 | + for (let i = 0; i < tableInsertItemsLen; ++i) { | ||
| 338 | + let insertItem = tableInsertItems[i]; | ||
| 339 | + //this.tableInsertHandler(insertItem.owner, insertItem.itemIdx, insertItem.itemData); | ||
| 340 | + let itemDataInfo = this.unPackPdu(insertItem.owner, insertItem.itemIdx, insertItem.itemData); | ||
| 341 | + if (itemDataInfo) { | ||
| 342 | + itemDataInfo.seek = itemDataInfo.seek + parseInt(_seekTime); //seek是媒体文件自己的,_seekTime是录制回放时进度条换算的 | ||
| 343 | + this.musicSharedList[insertItem.itemIdx] = itemDataInfo; | ||
| 344 | + if (itemDataInfo.status == 1) { | ||
| 345 | + GlobalConfig.activeMusicId = itemDataInfo.itemIdx; //当前激活的媒体文件ID | ||
| 346 | + GlobalConfig.activeMusicSeek = itemDataInfo.seek; | ||
| 347 | + loger.log('添加媒体文件->设置当前激活的媒体文件id'); | ||
| 348 | + } | ||
| 349 | + let getMusicPackFullInfo = this._musicSharedPackFullInfo(itemDataInfo); | ||
| 350 | + this._emit(MessageTypes.MEDIA_SHARED_UPDATE, getMusicPackFullInfo); | ||
| 351 | + } | ||
| 352 | + } | ||
| 353 | + //媒体文件数据更新完毕,如果当前没有显示的媒体文件,默认选择一个显示 | ||
| 354 | + this._showDefaultMeida(); | ||
| 355 | + } | ||
| 356 | + tableDeleteHandler(object_id, tableDeleteData) { | ||
| 357 | + loger.log('删除媒体文件数据->', object_id, tableDeleteData); //["tableDeleteHandler",1179649,{"type":231,"itemIdx":[1486301768]}] | ||
| 358 | + if (tableDeleteData && tableDeleteData.itemIdx) { | ||
| 359 | + let len = tableDeleteData.itemIdx.length; | ||
| 360 | + let itemIdxs = tableDeleteData.itemIdx; | ||
| 361 | + for (let i = 0; i < len; i++) { | ||
| 362 | + if (this.musicSharedList[itemIdxs[i]]) { | ||
| 363 | + loger.log("删除媒体文件数据:", itemIdxs[i]); | ||
| 364 | + let itemDataInfo = this.musicSharedList[itemIdxs[i]]; | ||
| 365 | + if (itemDataInfo && itemDataInfo.status == 1) { | ||
| 366 | + GlobalConfig.activeMusicId = 0; //当前激活的媒体文件ID | ||
| 367 | + GlobalConfig.activeMusicSeek = 1; //当前激活的媒体文件的当前页 | ||
| 368 | + loger.log('删除媒体文件数据->清除当前显示的媒体文件'); | ||
| 369 | + } | ||
| 370 | + this._emit(MessageTypes.MEDIA_SHARED_DELETE, { "itemIdx": itemIdxs[i] }); | ||
| 371 | + delete this.musicSharedList[itemIdxs[i]]; | ||
| 372 | + } | ||
| 373 | + } | ||
| 374 | + } | ||
| 375 | + } | ||
| 376 | + | ||
| 377 | + tableUpdateHandler(owner, itemIdx, itemData) { | ||
| 378 | + | ||
| 379 | + } | ||
| 380 | + | ||
| 381 | + tableUpdateApeHandler(_tableUpdateItems, _seekTime) { | ||
| 382 | + let tableUpdateItemsLen = _tableUpdateItems.length; | ||
| 383 | + loger.log('更新媒体文件->_seekTime:' + _seekTime, "activeDocId->", GlobalConfig.activeMusicId, "更新的数量->", tableUpdateItemsLen); | ||
| 384 | + for (let i = 0; i < tableUpdateItemsLen; ++i) { | ||
| 385 | + let tableItem = _tableUpdateItems[i]; | ||
| 386 | + let itemDataInfo = this.unPackPdu(tableItem.owner, tableItem.itemIdx, tableItem.itemData); | ||
| 387 | + if (itemDataInfo != null) { | ||
| 388 | + itemDataInfo.seek = itemDataInfo.seek + parseInt(_seekTime); | ||
| 389 | + this.musicSharedList[tableItem.itemIdx] = itemDataInfo; | ||
| 390 | + if (itemDataInfo && itemDataInfo.status == 1) { | ||
| 391 | + GlobalConfig.activeMusicId = itemDataInfo.itemIdx; //当前激活的媒体文件ID | ||
| 392 | + GlobalConfig.activeMusicSeek = itemDataInfo.seek; | ||
| 393 | + loger.log('更新媒体文件->设置当前激活的媒体文件id->', GlobalConfig.activeMusicId, "curPageNum->", GlobalConfig.activeMusicSeek); | ||
| 394 | + } | ||
| 395 | + let getMusicPackFullInfo = this._musicSharedPackFullInfo(itemDataInfo); | ||
| 396 | + this._emit(MessageTypes.MEDIA_SHARED_UPDATE, getMusicPackFullInfo); | ||
| 397 | + } else { | ||
| 398 | + loger.log('更新媒体文件-> 数据无效--> itemIdx', itemIdx); | ||
| 399 | + } | ||
| 400 | + } | ||
| 401 | + this._showDefaultMeida(); | ||
| 402 | + } | ||
| 403 | + | ||
| 404 | + //果当前没有显示的媒体文件,默认选择一个显示媒体文件 | ||
| 405 | + _showDefaultMeida() { | ||
| 406 | + //显示默认媒体文件条件->1.非录制回放状态下 2.只有host有权限操作 3.当前激活的媒体文件id不为0 | ||
| 407 | + if (GlobalConfig.isRecordPlayBack || !GlobalConfig.isHost || GlobalConfig.activeMusicId > 0) { | ||
| 408 | + return; | ||
| 409 | + } | ||
| 410 | + /* | ||
| 411 | + let tempDocItemIdx;//临时记录媒体文件数据,用于显示默认媒体文件 | ||
| 412 | + for (let key in this.musicSharedList) { | ||
| 413 | + tempDocItemIdx= this.musicSharedList[key]; | ||
| 414 | + if (tempDocItemIdx) { | ||
| 415 | + loger.log("选择一个媒体文件作为默认媒体文件显示->", tempDocItemIdx); | ||
| 416 | + let paramInfo = { | ||
| 417 | + "itemIdx": tempDocItemIdx.itemIdx, | ||
| 418 | + "status": 1 | ||
| 419 | + }; | ||
| 420 | + this.musicSharedPlay(paramInfo); | ||
| 421 | + //选择完成就跳出循环 | ||
| 422 | + return; | ||
| 423 | + } | ||
| 424 | + }*/ | ||
| 425 | + } | ||
| 426 | + | ||
| 427 | + onJoinChannelHandlerSuccess() { | ||
| 428 | + loger.log(this._session_name + ' 媒体共享加入频道成功'); | ||
| 429 | + if (this._apeDelayed) { | ||
| 430 | + setTimeout(() => { | ||
| 431 | + this._emit(MusicSharedApe.MEDIASHARED_JOIN_CHANNEL_SUCCESS); | ||
| 432 | + }, (GlobalConfig.mcuDelay + GlobalConfig.docDelay) || 12000 + GlobalConfig.docDelay); | ||
| 433 | + } else { | ||
| 434 | + setTimeout(() => { | ||
| 435 | + this._emit(MusicSharedApe.MEDIASHARED_JOIN_CHANNEL_SUCCESS); | ||
| 436 | + }, GlobalConfig.docDelay); | ||
| 437 | + } | ||
| 438 | + } | ||
| 439 | + | ||
| 440 | + //检查媒体文件是否已经存在,如果存在 返回true,否则返回false | ||
| 441 | + checkMusicSharedId(_fileId) { | ||
| 442 | + if (_fileId == null) { | ||
| 443 | + loger.warn('查找媒体文件->失败->参数为null'); | ||
| 444 | + return true; | ||
| 445 | + } | ||
| 446 | + //遍历查找 | ||
| 447 | + for (let key in this.musicSharedList) { | ||
| 448 | + let item = this.musicSharedList[key]; | ||
| 449 | + if (item && item.fileId == _fileId) { | ||
| 450 | + loger.log('查找媒体文件->已经存在->', _fileId); | ||
| 451 | + return true; | ||
| 452 | + } | ||
| 453 | + } | ||
| 454 | + loger.log('查找媒体文件->没有查找到媒体文件->', _fileId); | ||
| 455 | + //储存的数据中没有查找到 | ||
| 456 | + return false; | ||
| 457 | + } | ||
| 458 | + | ||
| 459 | + ///////数据的封包和解包///////////////////////////////////////// | ||
| 460 | + packPdu(_param, _itemIdx) { | ||
| 461 | + loger.log("媒体文件->packPdu"); | ||
| 462 | + //验证坐标点集合数组是否合法 | ||
| 463 | + if (_param == null || _itemIdx == null) { | ||
| 464 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 465 | + return null; | ||
| 466 | + } | ||
| 467 | + /* optional uint32 item_idx=1;//唯一标识 | ||
| 468 | + optional uint32 owner=2; | ||
| 469 | + optional uint32 from=3; | ||
| 470 | + optional string file_type=4; | ||
| 471 | + optional string creat_user_id=5;//创建文件userid | ||
| 472 | + optional string url =6;//文件地址 | ||
| 473 | + optional uint32 status=7;//状态0停止 1播放 2暂停 | ||
| 474 | + optional string fileId=8;//文件在服务器数据库中的唯一id | ||
| 475 | + optional string file_name=9;//文件的名字 | ||
| 476 | + optional uint32 seek=10;//seek*/ | ||
| 477 | + | ||
| 478 | + //判断type类型,根据type设置不同的参数 | ||
| 479 | + let pduDataModel = new pdu['RCMusicSharedSendDataModelPdu']; | ||
| 480 | + pduDataModel.itemIdx = _itemIdx; | ||
| 481 | + pduDataModel.owner = GlobalConfig.nodeId; | ||
| 482 | + pduDataModel.from = GlobalConfig.nodeId; | ||
| 483 | + pduDataModel.fileType = _param.fileType || ""; | ||
| 484 | + pduDataModel.creatUserId = _param.creatUserId || "0"; | ||
| 485 | + pduDataModel.url = _param.url || ""; //这个地址没用到,数据太长占用资源 暂停使用//"http://101.200.150.192/DocSharing/data/h5test/20170206-171100025/7e9c4178cac1133e0dd9d5b583439122.jpg"; | ||
| 486 | + pduDataModel.status = _param.status || 0; | ||
| 487 | + pduDataModel.fileId = _param.fileId || ""; //媒体文件在服务器数据库中的唯一id,必须有 | ||
| 488 | + pduDataModel.fileName = _param.fileName || "music_" + _itemIdx; //媒体文件的名字 | ||
| 489 | + pduDataModel.seek = parseInt(_param.seek) || 1; | ||
| 490 | + pduDataModel.musicVolume = parseInt(_param.musicVolume); | ||
| 491 | + if (!pduDataModel.musicVolume) { | ||
| 492 | + pduDataModel.musicVolume = 60; | ||
| 493 | + } | ||
| 494 | + return pduDataModel; | ||
| 495 | + } | ||
| 496 | + | ||
| 497 | + unPackPdu(owner, itemIdx, itemData) { | ||
| 498 | + if (owner == null || itemIdx == null || itemData == null) { | ||
| 499 | + this._emit(MessageTypes.MCU_ERROR, MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 500 | + return null; | ||
| 501 | + } | ||
| 502 | + try { | ||
| 503 | + let pduDataModel = pdu['RCMusicSharedSendDataModelPdu'].decode(itemData); | ||
| 504 | + loger.log("媒体文件===>unPackPdu"); | ||
| 505 | + return pduDataModel; | ||
| 506 | + } catch (err) { | ||
| 507 | + loger.log("媒体文件===>unPackPdu->Pdu解析错误->itemIdx=" + itemIdx + "->err:" + err.message); | ||
| 508 | + } | ||
| 509 | + return null; | ||
| 510 | + } | ||
| 511 | + | ||
| 512 | +} | ||
| 513 | +MusicSharedApe.prototype.MEDIASHARED_JOIN_CHANNEL_SUCCESS = MusicSharedApe.MEDIASHARED_JOIN_CHANNEL_SUCCESS = 'musicShared_join_channel_success'; | ||
| 514 | +export default MusicSharedApe; | ||
| 515 | + |
| @@ -758,6 +758,20 @@ message RCMediaSharedSendDataModelPdu { | @@ -758,6 +758,20 @@ message RCMediaSharedSendDataModelPdu { | ||
| 758 | optional uint32 mediaVolume=11;//音量 | 758 | optional uint32 mediaVolume=11;//音量 |
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | +message RCMusicSharedSendDataModelPdu { | ||
| 762 | + optional uint32 item_idx=1;//唯一标识 | ||
| 763 | + optional uint32 owner=2; | ||
| 764 | + optional uint32 from=3; | ||
| 765 | + optional string file_type=4; | ||
| 766 | + optional string creat_user_id=5;//创建文件userid | ||
| 767 | + optional string url =6;//文件地址 | ||
| 768 | + optional uint32 status=7;//状态0停止 1播放 2暂停 | ||
| 769 | + optional string fileId=8;//文件在服务器数据库中的唯一id | ||
| 770 | + optional string file_name=9;//文件的名字 | ||
| 771 | + optional uint32 seek=10;//seek | ||
| 772 | + optional uint32 mediaVolume=11;//音量 | ||
| 773 | +} | ||
| 774 | + | ||
| 761 | message RCDocBroadcastDataRequestPdu { | 775 | message RCDocBroadcastDataRequestPdu { |
| 762 | optional uint32 from_node_id = 1;//发起人 | 776 | optional uint32 from_node_id = 1;//发起人 |
| 763 | optional uint32 to_node_id = 2;//接收人,如果是0就是所有人都接收 | 777 | optional uint32 to_node_id = 2;//接收人,如果是0就是所有人都接收 |
-
请 注册 或 登录 后发表评论