李勇

修复回放视频数据匹配

@@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter { @@ -63,7 +63,7 @@ export default class MessageEntrance extends Emiter {
63 super(); 63 super();
64 this.lastClassActiveTime=0;//最后一次课堂激活的时间戳 64 this.lastClassActiveTime=0;//最后一次课堂激活的时间戳
65 //sdk 信息 65 //sdk 信息
66 - GlobalConfig.sdkVersion = "v2.30.2.20171117"; 66 + GlobalConfig.sdkVersion = "v2.30.5.20171117";
67 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion); 67 loger.warn("sdkVersion:" + GlobalConfig.sdkVersion);
68 console.log("sdkVersion:" + GlobalConfig.sdkVersion); 68 console.log("sdkVersion:" + GlobalConfig.sdkVersion);
69 //设置 69 //设置
@@ -33,6 +33,11 @@ class RecordInfoMatch extends Emiter { @@ -33,6 +33,11 @@ class RecordInfoMatch extends Emiter {
33 this.filePath=this.filePath.replace(":8080",""); 33 this.filePath=this.filePath.replace(":8080","");
34 } 34 }
35 35
  36 + if (!_recordMessagesList||_recordMessagesList.length<1) {
  37 + console.log("没有视频消息", _recordMessagesList);
  38 + this.matchRecordFile(this.recordMessages, this.m3u8jsonDataList);
  39 + }
  40 +
36 //this.getRecordInfo(()=> { 41 //this.getRecordInfo(()=> {
37 this.parseRecordMessage(_recordMessagesList,()=> { 42 this.parseRecordMessage(_recordMessagesList,()=> {
38 console.log("JSON数据列表",this.jsonPathList); 43 console.log("JSON数据列表",this.jsonPathList);
@@ -65,7 +70,7 @@ class RecordInfoMatch extends Emiter { @@ -65,7 +70,7 @@ class RecordInfoMatch extends Emiter {
65 creatDate: i, 70 creatDate: i,
66 folder: k, 71 folder: k,
67 stream: j, 72 stream: j,
68 - createTimeUTC: stream 73 + creatTimeUTC: stream
69 }; 74 };
70 } 75 }
71 76
@@ -118,11 +123,11 @@ class RecordInfoMatch extends Emiter { @@ -118,11 +123,11 @@ class RecordInfoMatch extends Emiter {
118 //console.log(JSON.stringify(item)); 123 //console.log(JSON.stringify(item));
119 delete item.appId; 124 delete item.appId;
120 delete item.id; 125 delete item.id;
121 - let time = parseInt(item.createTime); 126 + let time = parseInt(item.creatTime);
122 let timeInfo = this.timestampToUTCTime(time); 127 let timeInfo = this.timestampToUTCTime(time);
123 //return {yymmddhhmmss:yymmddhhmmss,yymmdd:yymmdd} 128 //return {yymmddhhmmss:yymmddhhmmss,yymmdd:yymmdd}
124 item.seek = 0; 129 item.seek = 0;
125 - item.createTimeUTC = timeInfo.yymmddhhmmss; 130 + item.creatTimeUTC = timeInfo.yymmddhhmmss;
126 item.creatDate = timeInfo.yymmdd; 131 item.creatDate = timeInfo.yymmdd;
127 this.jsonPathList [timeInfo.yymmdd] = this.filePath + "/" + timeInfo.yymmdd + "/json/" + item.channel + ".json"; 132 this.jsonPathList [timeInfo.yymmdd] = this.filePath + "/" + timeInfo.yymmdd + "/json/" + item.channel + ".json";
128 item.stream_id = item.channel + "_" + item.userId + "_" + item.timestamp; 133 item.stream_id = item.channel + "_" + item.userId + "_" + item.timestamp;
@@ -157,19 +162,19 @@ class RecordInfoMatch extends Emiter { @@ -157,19 +162,19 @@ class RecordInfoMatch extends Emiter {
157 //console.log(JSON.stringify(item)); 162 //console.log(JSON.stringify(item));
158 delete item.appId; 163 delete item.appId;
159 delete item.id; 164 delete item.id;
160 - let time = parseInt(item.createTime); 165 + let time = parseInt(item.creatTime);
161 let timeInfo = this.timestampToUTCTime(time); 166 let timeInfo = this.timestampToUTCTime(time);
162 //return {yymmddhhmmss:yymmddhhmmss,yymmdd:yymmdd} 167 //return {yymmddhhmmss:yymmddhhmmss,yymmdd:yymmdd}
163 item.seek = 0; 168 item.seek = 0;
164 - item.createTimeUTC = timeInfo.yymmddhhmmss; 169 + item.creatTimeUTC = timeInfo.yymmddhhmmss;
165 item.creatDate = timeInfo.yymmdd; 170 item.creatDate = timeInfo.yymmdd;
166 this.jsonPathList [timeInfo.yymmdd] = this.filePath + "/samples/" + timeInfo.yymmdd + "/json/" + item.channel + ".json"; 171 this.jsonPathList [timeInfo.yymmdd] = this.filePath + "/samples/" + timeInfo.yymmdd + "/json/" + item.channel + ".json";
167 - item.stream_id = item.channel + "_" + item.userId + "_" + item.timestamp; 172 + item.stream_id = item.channel + "_" + item.userId + "_" + item.creatTime;
168 173
169 if (!this.recordMessages[item.uid]) { 174 if (!this.recordMessages[item.uid]) {
170 this.recordMessages[item.uid] = {}; 175 this.recordMessages[item.uid] = {};
171 } 176 }
172 - this.recordMessages[item.uid][item.timestamp] = item; 177 + this.recordMessages[item.uid][item.creatTime] = item;
173 } 178 }
174 } 179 }
175 if (_callback) { 180 if (_callback) {
@@ -260,10 +265,10 @@ class RecordInfoMatch extends Emiter { @@ -260,10 +265,10 @@ class RecordInfoMatch extends Emiter {
260 let uidRecordInfoArr = Object.values(uidRecordInfo); 265 let uidRecordInfoArr = Object.values(uidRecordInfo);
261 let uidRecordFileArr = Object.values(uidRecordFile); 266 let uidRecordFileArr = Object.values(uidRecordFile);
262 uidRecordInfoArr = uidRecordInfoArr.sort(function (a, b) { 267 uidRecordInfoArr = uidRecordInfoArr.sort(function (a, b) {
263 - return parseInt(a.createTimeUTC) - parseInt(b.createTimeUTC); 268 + return parseInt(a.creatTimeUTC) - parseInt(b.creatTimeUTC);
264 }); 269 });
265 uidRecordFileArr = uidRecordFileArr.sort(function (a, b) { 270 uidRecordFileArr = uidRecordFileArr.sort(function (a, b) {
266 - return parseInt(a.createTimeUTC) - parseInt(b.createTimeUTC); 271 + return parseInt(a.creatTimeUTC) - parseInt(b.creatTimeUTC);
267 }); 272 });
268 273
269 if (uidRecordInfoArr.length == uidRecordFileArr.length && uidRecordFileArr.length > 0) { 274 if (uidRecordInfoArr.length == uidRecordFileArr.length && uidRecordFileArr.length > 0) {
@@ -278,7 +283,7 @@ class RecordInfoMatch extends Emiter { @@ -278,7 +283,7 @@ class RecordInfoMatch extends Emiter {
278 } else { 283 } else {
279 //2.通过时间戳匹配 284 //2.通过时间戳匹配
280 for (let f in uidRecordInfo) { 285 for (let f in uidRecordInfo) {
281 - let time = parseInt(uidRecordInfo[f].createTimeUTC); 286 + let time = parseInt(uidRecordInfo[f].creatTimeUTC);
282 let video_url = ""; 287 let video_url = "";
283 let video_urlObj = uidRecordFile[k + "_" + time]; 288 let video_urlObj = uidRecordFile[k + "_" + time];
284 if (video_urlObj && video_urlObj.video_url) { 289 if (video_urlObj && video_urlObj.video_url) {
@@ -327,7 +332,7 @@ class RecordInfoMatch extends Emiter { @@ -327,7 +332,7 @@ class RecordInfoMatch extends Emiter {
327 } else { 332 } else {
328 if (lastFileItem) { 333 if (lastFileItem) {
329 infoItem.video_url = lastFileItem.video_url; 334 infoItem.video_url = lastFileItem.video_url;
330 - infoItem.seek = parseInt(infoItem.createTimeUTC) - parseInt(lastFileItem.createTimeUTC); 335 + infoItem.seek = parseInt(infoItem.creatTimeUTC) - parseInt(lastFileItem.creatTimeUTC);
331 if (!this.matchStreams[infoItem.stream_id]) { 336 if (!this.matchStreams[infoItem.stream_id]) {
332 this.matchStreams[infoItem.stream_id] = infoItem; 337 this.matchStreams[infoItem.stream_id] = infoItem;
333 } 338 }
@@ -350,7 +355,7 @@ class RecordInfoMatch extends Emiter { @@ -350,7 +355,7 @@ class RecordInfoMatch extends Emiter {
350 for (let h in uidRecordInfo) { 355 for (let h in uidRecordInfo) {
351 item2 = uidRecordInfo[h]; 356 item2 = uidRecordInfo[h];
352 if (item2 && item2.video_url) { 357 if (item2 && item2.video_url) {
353 - let interval = parseInt((item.createTime) * 0.001 - parseInt(item2.createTime) * 0.001); 358 + let interval = parseInt((item.creatTime) * 0.001 - parseInt(item2.creatTime) * 0.001);
354 if (minInterval > interval) { 359 if (minInterval > interval) {
355 nearItem = item2; 360 nearItem = item2;
356 minInterval = interval; 361 minInterval = interval;
@@ -1086,10 +1086,10 @@ class RecordPlayBackParse extends Emiter { @@ -1086,10 +1086,10 @@ class RecordPlayBackParse extends Emiter {
1086 timestamp: timestamp 1086 timestamp: timestamp
1087 }; 1087 };
1088 //this._videoApeBroadcastMssages[timestamp]={parseData:videoReceivePdu,byteData:data,timestamp: timestamp}; 1088 //this._videoApeBroadcastMssages[timestamp]={parseData:videoReceivePdu,byteData:data,timestamp: timestamp};
1089 - if(videoReceivePdu&&videoReceivePdu.data){ 1089 + /* if(videoReceivePdu&&videoReceivePdu.data){
1090 videoReceivePdu.data.createTime=videoReceivePdu.data.timestamp; 1090 videoReceivePdu.data.createTime=videoReceivePdu.data.timestamp;
1091 } 1091 }
1092 - this.videoPublishMessages.push(videoReceivePdu.data); 1092 + this.videoPublishMessages.push(videoReceivePdu.data);*/
1093 } 1093 }
1094 1094
1095 } catch (err) { 1095 } catch (err) {
@@ -1228,6 +1228,19 @@ class RecordPlayBackParse extends Emiter { @@ -1228,6 +1228,19 @@ class RecordPlayBackParse extends Emiter {
1228 statusStr = "开"; 1228 statusStr = "开";
1229 this.allStreams[videoChannelInfo.streamId] = videoChannelInfo; 1229 this.allStreams[videoChannelInfo.streamId] = videoChannelInfo;
1230 console.log("视频流" + videoChannelInfo.streamId); 1230 console.log("视频流" + videoChannelInfo.streamId);
  1231 + if(videoChannelInfo){
  1232 + videoChannelInfo.channel=videoChannelInfo.siteId+"_"+videoChannelInfo.classId;
  1233 + videoChannelInfo.uid=videoChannelInfo.fromNodeId;
  1234 + let streamInfo=videoChannelInfo.streamId.split("_");
  1235 + //kaifangwebrtc_1092942818_S8908_1510741823354
  1236 + if(streamInfo&&streamInfo.length>1){
  1237 + videoChannelInfo.creatTime=streamInfo[streamInfo.length-1];//获取最后的毫秒时间戳
  1238 + }else {
  1239 + videoChannelInfo.creatTime=parseInt(videoChannelInfo.timestamp)*1000;//秒转换为毫秒
  1240 + }
  1241 +
  1242 + }
  1243 + this.videoPublishMessages.push(videoChannelInfo);
1231 } 1244 }
1232 this.mediaChannleList[videoChannelInfo.channelId][timestamp] = { 1245 this.mediaChannleList[videoChannelInfo.channelId][timestamp] = {
1233 parseData: videoChannelInfo, 1246 parseData: videoChannelInfo,