添加标签验证

This commit is contained in:
Harvey Zack committed 2018-12-19 18:24:54 +08:00
1 parent 39f8c157ac
commit 765402662f
3 files changed
+29 -5

No files matched your search

@@ -5,7 +5,7 @@ import { mergeTypedArrays } from '../utils';
export default class FlvParse {
constructor(flv) {
this.flv = flv;
this.uint8 = new Int8Array(0);
this.uint8 = new Uint8Array(0);
this.index = 0;
this.header = null;
this.tags = [];
@@ -23,7 +23,7 @@ export default class FlvParse {
});
flv.on('flvFetching', value => {
this.uint8 = mergeTypedArrays(this.uint8, value);
this.uint8 = mergeTypedArrays(this.uint8, new Uint8Array(value));
console.log(this.uint8.length);
this.parseHeader();
});
@@ -32,6 +32,9 @@ export default class FlvParse {
console.log('flvFetchEnd');
if (value) {
this.uint8 = value;
this.index = 0;
this.header = null;
this.tags = [];
this.parseHeader();
// this.parseTags();
}
@@ -80,6 +83,15 @@ export default class FlvParse {
return tempUint8;
}
verifyTags() {
const state = this.tags.some(item => {
const tagType = item.tagType[0];
return ![18, 9, 8].includes(tagType);
});
console.log(state ? '验证不通过' : '验证通过');
}
static getBodySum(arr) {
return arr[0] * 256 ** 2 + arr[1] * 256 + arr[2];
}