简化metadata解析

This commit is contained in:
Harvey Zack committed 2018-12-20 20:17:29 +08:00
1 parent 42eb35571d
commit 94aaf29da8
4 files changed
+62 -317

No files matched your search

+34 -134
View File
@@ -687,140 +687,38 @@
amf2.type = _readMetaData4[0];
amf2.size = getUint8Sum(readMetaData(4));
amf2.metaData = Object.create(null);
console.log(scripTag.body.slice(13));
var nameLength = getUint8Sum(readMetaData(2));
var name = bin2String(readMetaData(nameLength));
var type = readMetaData(1)[0];
var valueLength = getUint8Sum(readMetaData(2));
var value = bin2String(readMetaData(valueLength));
console.log(type, name, value);
var nameLength2 = getUint8Sum(readMetaData(2));
var name2 = bin2String(readMetaData(nameLength2));
var type2 = readMetaData(1)[0];
var valueLength2 = getUint8Sum(readMetaData(2));
var value2 = bin2String(readMetaData(valueLength2));
console.log(type2, name2, value2);
var nameLength3 = getUint8Sum(readMetaData(2));
var name3 = bin2String(readMetaData(nameLength3));
var type3 = readMetaData(1)[0];
var value3 = bin2Boolean(readMetaData(1)[0]);
console.log(type3, name3, value3);
var nameLength4 = getUint8Sum(readMetaData(2));
var name4 = bin2String(readMetaData(nameLength4));
var type4 = readMetaData(1)[0];
var value4 = bin2Boolean(readMetaData(1)[0]);
console.log(type4, name4, value4);
var nameLength5 = getUint8Sum(readMetaData(2));
var name5 = bin2String(readMetaData(nameLength5));
var type5 = readMetaData(1)[0];
var value5 = bin2Boolean(readMetaData(1)[0]);
console.log(type5, name5, value5);
var nameLength6 = getUint8Sum(readMetaData(2));
var name6 = bin2String(readMetaData(nameLength6));
var type6 = readMetaData(1)[0];
var value6 = bin2Boolean(readMetaData(1)[0]);
console.log(type6, name6, value6);
var nameLength7 = getUint8Sum(readMetaData(2));
var name7 = bin2String(readMetaData(nameLength7));
var type7 = readMetaData(1)[0];
var value7 = bin2Boolean(readMetaData(1)[0]);
console.log(type7, name7, value7);
var nameLength8 = getUint8Sum(readMetaData(2));
var name8 = bin2String(readMetaData(nameLength8));
var type8 = readMetaData(1)[0];
var value8 = bin2Float(readMetaData(8));
console.log(type8, name8, value8);
var nameLength9 = getUint8Sum(readMetaData(2));
var name9 = bin2String(readMetaData(nameLength9));
var type9 = readMetaData(1)[0];
var value9 = bin2Float(readMetaData(8));
console.log(type9, name9, value9);
var nameLength10 = getUint8Sum(readMetaData(2));
var name10 = bin2String(readMetaData(nameLength10));
var type10 = readMetaData(1)[0];
var value10 = bin2Float(readMetaData(8));
console.log(type10, name10, value10);
var nameLength11 = getUint8Sum(readMetaData(2));
var name11 = bin2String(readMetaData(nameLength11));
var type11 = readMetaData(1)[0];
var value11 = bin2Float(readMetaData(8));
console.log(type11, name11, value11);
var nameLength12 = getUint8Sum(readMetaData(2));
var name12 = bin2String(readMetaData(nameLength12));
var type12 = readMetaData(1)[0];
var value12 = bin2Float(readMetaData(8));
console.log(type12, name12, value12);
var nameLength13 = getUint8Sum(readMetaData(2));
var name13 = bin2String(readMetaData(nameLength13));
var type13 = readMetaData(1)[0];
var value13 = bin2Float(readMetaData(8));
console.log(type13, name13, value13);
var nameLength14 = getUint8Sum(readMetaData(2));
var name14 = bin2String(readMetaData(nameLength14));
var type14 = readMetaData(1)[0];
var value14 = bin2Float(readMetaData(8));
console.log(type14, name14, value14);
var nameLength15 = getUint8Sum(readMetaData(2));
var name15 = bin2String(readMetaData(nameLength15));
var type15 = readMetaData(1)[0];
var value15 = bin2Float(readMetaData(8));
console.log(type15, name15, value15);
var nameLength16 = getUint8Sum(readMetaData(2));
var name16 = bin2String(readMetaData(nameLength16));
var type16 = readMetaData(1)[0];
var value16 = bin2Float(readMetaData(8));
console.log(type16, name16, value16);
var nameLength17 = getUint8Sum(readMetaData(2));
var name17 = bin2String(readMetaData(nameLength17));
var type17 = readMetaData(1)[0];
var value17 = bin2Float(readMetaData(8));
console.log(type17, name17, value17);
var nameLength18 = getUint8Sum(readMetaData(2));
var name18 = bin2String(readMetaData(nameLength18));
var type18 = readMetaData(1)[0];
var value18 = bin2Float(readMetaData(8));
console.log(type18, name18, value18);
var nameLength19 = getUint8Sum(readMetaData(2));
var name19 = bin2String(readMetaData(nameLength19));
var type19 = readMetaData(1)[0];
var value19 = bin2Float(readMetaData(8));
console.log(type19, name19, value19);
var nameLength20 = getUint8Sum(readMetaData(2));
var name20 = bin2String(readMetaData(nameLength20));
var type20 = readMetaData(1)[0];
var value20 = bin2Float(readMetaData(8));
console.log(type20, name20, value20);
var nameLength21 = getUint8Sum(readMetaData(2));
var name21 = bin2String(readMetaData(nameLength21));
var type21 = readMetaData(1)[0];
var value21 = bin2Boolean(readMetaData(1)[0]);
console.log(type21, name21, value21);
var nameLength22 = getUint8Sum(readMetaData(2));
var name22 = bin2String(readMetaData(nameLength22));
var type22 = readMetaData(1)[0];
var value22 = bin2Float(readMetaData(8));
console.log(type22, name22, value22);
var nameLength23 = getUint8Sum(readMetaData(2));
var name23 = bin2String(readMetaData(nameLength23));
var type23 = readMetaData(1)[0];
var value23 = bin2Float(readMetaData(8));
console.log(type23, name23, value23);
var nameLength24 = getUint8Sum(readMetaData(2));
var name24 = bin2String(readMetaData(nameLength24));
var type24 = readMetaData(1)[0];
var value24 = bin2Float(readMetaData(8));
console.log(type24, name24, value24);
var nameLength25 = getUint8Sum(readMetaData(2));
var name25 = bin2String(readMetaData(nameLength25));
var type25 = readMetaData(1)[0];
var value25 = bin2Float(readMetaData(8));
console.log(type25, name25, value25);
var nameLength26 = getUint8Sum(readMetaData(2));
var name26 = bin2String(readMetaData(nameLength26));
var type26 = readMetaData(1)[0];
console.log(scripTag.body.slice(readMetaData.index));
console.log(type26, name26); // while (readMetaData.index < scripTag.body.length) {
// }
while (readMetaData.index < scripTag.body.length) {
var nameLength = getUint8Sum(readMetaData(2));
var name = bin2String(readMetaData(nameLength));
var type = readMetaData(1)[0];
switch (type) {
case 0:
amf2.metaData[name] = bin2Float(readMetaData(8));
break;
case 1:
amf2.metaData[name] = bin2Boolean(readMetaData(1)[0]);
break;
case 2:
{
var valueLength = getUint8Sum(readMetaData(2));
amf2.metaData[name] = bin2String(readMetaData(valueLength));
break;
}
case 3:
amf2.metaData[name] = Object.create(null);
readMetaData(scripTag.body.length - readMetaData.index);
break;
default:
errorHandle(false, "AMF: Unknown metaData type: ".concat(type));
break;
}
}
metadata.amf1 = amf1;
metadata.amf2 = amf2;
@@ -870,6 +768,8 @@
_this.parse();
}
flv.emit('parseDone');
_this.verify();
});
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"artplayer-plugin-flv.js","sources":["../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../packages/artplayer-plugin-flv/node_modules/tiny-emitter/index.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../node_modules/@babel/runtime/helpers/isNativeFunction.js","../../node_modules/@babel/runtime/helpers/construct.js","../../node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../packages/artplayer-plugin-flv/src/utils/index.js","../../packages/artplayer-plugin-flv/src/utils/checkSupport.js","../../packages/artplayer-plugin-flv/src/eventProxy.js","../../packages/artplayer-plugin-flv/src/creatWorker.js","../../packages/artplayer-plugin-flv/src/config.js","../../packages/artplayer-plugin-flv/src/creatMediaSource.js","../../packages/artplayer-plugin-flv/src/flvParse/fetchStream.js","../../packages/artplayer-plugin-flv/src/flvParse/readFile.js","../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","../../packages/artplayer-plugin-flv/src/flvParse/getMetaData.js","../../packages/artplayer-plugin-flv/src/flvParse/index.js","../../packages/artplayer-plugin-flv/src/index.js"],"sourcesContent":["function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expLine truncated
{"version":3,"file":"artplayer-plugin-flv.js","sources":["../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../node_modules/@babel/runtime/helpers/createClass.js","../../node_modules/@babel/runtime/helpers/typeof.js","../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../node_modules/@babel/runtime/helpers/inherits.js","../../packages/artplayer-plugin-flv/node_modules/tiny-emitter/index.js","../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../node_modules/@babel/runtime/helpers/isNativeFunction.js","../../node_modules/@babel/runtime/helpers/construct.js","../../node_modules/@babel/runtime/helpers/wrapNativeSuper.js","../../packages/artplayer-plugin-flv/src/utils/index.js","../../packages/artplayer-plugin-flv/src/utils/checkSupport.js","../../packages/artplayer-plugin-flv/src/eventProxy.js","../../packages/artplayer-plugin-flv/src/creatWorker.js","../../packages/artplayer-plugin-flv/src/config.js","../../packages/artplayer-plugin-flv/src/creatMediaSource.js","../../packages/artplayer-plugin-flv/src/flvParse/fetchStream.js","../../packages/artplayer-plugin-flv/src/flvParse/readFile.js","../../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../../node_modules/@babel/runtime/helpers/nonIterableRest.js","../../node_modules/@babel/runtime/helpers/slicedToArray.js","../../packages/artplayer-plugin-flv/src/flvParse/getMetaData.js","../../packages/artplayer-plugin-flv/src/flvParse/index.js","../../packages/artplayer-plugin-flv/src/index.js"],"sourcesContent":["function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","function _typeof2(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\nfunction _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized;","var _typeof = require(\"../helpers/typeof\");\n\nvar assertThisInitialized = require(\"./assertThisInitialized\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn;","function _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf;","function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf;","var setPrototypeOf = require(\"./setPrototypeOf\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expLine truncated
@@ -1,22 +1,4 @@
import { getUint8Sum, readUint8, bin2String, bin2Boolean, bin2Float } from '../utils';
function getValueLength(type) {
return {
0: 8, // Number
1: 1, // Boolean
2: 200, // String
3: 1, // Object
4: 1, // MovieClip
5: 1, // Null
6: 1, // Undefined
7: 1, // Reference
8: 1, // ECMA array
9: 1, // Object end marker
10: 4, // Strict array
11: 8, // Date
12: 4, // Long string
}[type];
}
import { getUint8Sum, readUint8, bin2String, bin2Boolean, bin2Float, errorHandle } from '../utils';
export default function getMetaData(scripTag) {
const readMetaData = readUint8(scripTag.body);
@@ -30,169 +12,31 @@ export default function getMetaData(scripTag) {
amf2.size = getUint8Sum(readMetaData(4));
amf2.metaData = Object.create(null);
console.log(scripTag.body.slice(13));
const nameLength = getUint8Sum(readMetaData(2));
const name = bin2String(readMetaData(nameLength));
const type = readMetaData(1)[0];
const valueLength = getUint8Sum(readMetaData(2));
const value = bin2String(readMetaData(valueLength));
console.log(type, name, value);
const nameLength2 = getUint8Sum(readMetaData(2));
const name2 = bin2String(readMetaData(nameLength2));
const type2 = readMetaData(1)[0];
const valueLength2 = getUint8Sum(readMetaData(2));
const value2 = bin2String(readMetaData(valueLength2));
console.log(type2, name2, value2);
const nameLength3 = getUint8Sum(readMetaData(2));
const name3 = bin2String(readMetaData(nameLength3));
const type3 = readMetaData(1)[0];
const value3 = bin2Boolean(readMetaData(1)[0]);
console.log(type3, name3, value3);
const nameLength4 = getUint8Sum(readMetaData(2));
const name4 = bin2String(readMetaData(nameLength4));
const type4 = readMetaData(1)[0];
const value4 = bin2Boolean(readMetaData(1)[0]);
console.log(type4, name4, value4);
const nameLength5 = getUint8Sum(readMetaData(2));
const name5 = bin2String(readMetaData(nameLength5));
const type5 = readMetaData(1)[0];
const value5 = bin2Boolean(readMetaData(1)[0]);
console.log(type5, name5, value5);
const nameLength6 = getUint8Sum(readMetaData(2));
const name6 = bin2String(readMetaData(nameLength6));
const type6 = readMetaData(1)[0];
const value6 = bin2Boolean(readMetaData(1)[0]);
console.log(type6, name6, value6);
const nameLength7 = getUint8Sum(readMetaData(2));
const name7 = bin2String(readMetaData(nameLength7));
const type7 = readMetaData(1)[0];
const value7 = bin2Boolean(readMetaData(1)[0]);
console.log(type7, name7, value7);
const nameLength8 = getUint8Sum(readMetaData(2));
const name8 = bin2String(readMetaData(nameLength8));
const type8 = readMetaData(1)[0];
const value8 = bin2Float(readMetaData(8));
console.log(type8, name8, value8);
const nameLength9 = getUint8Sum(readMetaData(2));
const name9 = bin2String(readMetaData(nameLength9));
const type9 = readMetaData(1)[0];
const value9 = bin2Float(readMetaData(8));
console.log(type9, name9, value9);
const nameLength10 = getUint8Sum(readMetaData(2));
const name10 = bin2String(readMetaData(nameLength10));
const type10 = readMetaData(1)[0];
const value10 = bin2Float(readMetaData(8));
console.log(type10, name10, value10);
const nameLength11 = getUint8Sum(readMetaData(2));
const name11 = bin2String(readMetaData(nameLength11));
const type11 = readMetaData(1)[0];
const value11 = bin2Float(readMetaData(8));
console.log(type11, name11, value11);
const nameLength12 = getUint8Sum(readMetaData(2));
const name12 = bin2String(readMetaData(nameLength12));
const type12 = readMetaData(1)[0];
const value12 = bin2Float(readMetaData(8));
console.log(type12, name12, value12);
const nameLength13 = getUint8Sum(readMetaData(2));
const name13 = bin2String(readMetaData(nameLength13));
const type13 = readMetaData(1)[0];
const value13 = bin2Float(readMetaData(8));
console.log(type13, name13, value13);
const nameLength14 = getUint8Sum(readMetaData(2));
const name14 = bin2String(readMetaData(nameLength14));
const type14 = readMetaData(1)[0];
const value14 = bin2Float(readMetaData(8));
console.log(type14, name14, value14);
const nameLength15 = getUint8Sum(readMetaData(2));
const name15 = bin2String(readMetaData(nameLength15));
const type15 = readMetaData(1)[0];
const value15 = bin2Float(readMetaData(8));
console.log(type15, name15, value15);
const nameLength16 = getUint8Sum(readMetaData(2));
const name16 = bin2String(readMetaData(nameLength16));
const type16 = readMetaData(1)[0];
const value16 = bin2Float(readMetaData(8));
console.log(type16, name16, value16);
const nameLength17 = getUint8Sum(readMetaData(2));
const name17 = bin2String(readMetaData(nameLength17));
const type17 = readMetaData(1)[0];
const value17 = bin2Float(readMetaData(8));
console.log(type17, name17, value17);
const nameLength18 = getUint8Sum(readMetaData(2));
const name18 = bin2String(readMetaData(nameLength18));
const type18 = readMetaData(1)[0];
const value18 = bin2Float(readMetaData(8));
console.log(type18, name18, value18);
const nameLength19 = getUint8Sum(readMetaData(2));
const name19 = bin2String(readMetaData(nameLength19));
const type19 = readMetaData(1)[0];
const value19 = bin2Float(readMetaData(8));
console.log(type19, name19, value19);
const nameLength20 = getUint8Sum(readMetaData(2));
const name20 = bin2String(readMetaData(nameLength20));
const type20 = readMetaData(1)[0];
const value20 = bin2Float(readMetaData(8));
console.log(type20, name20, value20);
const nameLength21 = getUint8Sum(readMetaData(2));
const name21 = bin2String(readMetaData(nameLength21));
const type21 = readMetaData(1)[0];
const value21 = bin2Boolean(readMetaData(1)[0]);
console.log(type21, name21, value21);
const nameLength22 = getUint8Sum(readMetaData(2));
const name22 = bin2String(readMetaData(nameLength22));
const type22 = readMetaData(1)[0];
const value22 = bin2Float(readMetaData(8));
console.log(type22, name22, value22);
const nameLength23 = getUint8Sum(readMetaData(2));
const name23 = bin2String(readMetaData(nameLength23));
const type23 = readMetaData(1)[0];
const value23 = bin2Float(readMetaData(8));
console.log(type23, name23, value23);
const nameLength24 = getUint8Sum(readMetaData(2));
const name24 = bin2String(readMetaData(nameLength24));
const type24 = readMetaData(1)[0];
const value24 = bin2Float(readMetaData(8));
console.log(type24, name24, value24);
const nameLength25 = getUint8Sum(readMetaData(2));
const name25 = bin2String(readMetaData(nameLength25));
const type25 = readMetaData(1)[0];
const value25 = bin2Float(readMetaData(8));
console.log(type25, name25, value25);
const nameLength26 = getUint8Sum(readMetaData(2));
const name26 = bin2String(readMetaData(nameLength26));
const type26 = readMetaData(1)[0];
console.log(scripTag.body.slice(readMetaData.index));
console.log(type26, name26);
// while (readMetaData.index < scripTag.body.length) {
// }
while (readMetaData.index < scripTag.body.length) {
const nameLength = getUint8Sum(readMetaData(2));
const name = bin2String(readMetaData(nameLength));
const type = readMetaData(1)[0];
switch (type) {
case 0:
amf2.metaData[name] = bin2Float(readMetaData(8));
break;
case 1:
amf2.metaData[name] = bin2Boolean(readMetaData(1)[0]);
break;
case 2: {
const valueLength = getUint8Sum(readMetaData(2));
amf2.metaData[name] = bin2String(readMetaData(valueLength));
break;
}
case 3:
amf2.metaData[name] = Object.create(null);
readMetaData(scripTag.body.length - readMetaData.index);
break;
default:
errorHandle(false, `AMF: Unknown metaData type: ${type}`);
break;
}
}
metadata.amf1 = amf1;
metadata.amf2 = amf2;
@@ -41,6 +41,7 @@ export default class FlvParse {
this.tags = [];
this.parse();
}
flv.emit('parseDone');
this.verify();
});