Files
ArtPlayer/packages/artplayer-plugin-flv/src/utils/index.js
T
2018-12-19 15:16:53 +08:00

20 lines
506 B
JavaScript

export class FlvError extends Error {
constructor(message, context) {
super(message);
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, context || this.constructor);
}
this.name = 'FlvError';
}
}
export function errorHandle(condition, msg) {
if (!condition) {
throw new FlvError(msg);
}
}
export function getTagBodySize(dataSize) {
return dataSize[0] * 256 ** 2 + dataSize[1] * 256 + dataSize[2];
}