@ezuikit/utils-collect
Version:
collect utils
57 lines (56 loc) • 1.44 kB
TypeScript
export interface ReportParam {
/** 协议 必填 */
protocol?: 'flv' | 'hls' | 'mp4' | 'ezopen' | 'openlive' | 'webrtc' | string;
/** 播放地址 可选 */
url?: string;
/** 时间(时间戳)可选 */
st?: number;
/** 版本号 可选*/
v?: string;
/** 设备序列号 可选 */
serial?: string;
/** 设备通道号 可选 */
no?: string;
/** 行为 可选 */
action?: number | string;
/** 日志信息 */
logInfo?: object;
/** 环境 (ezopen) */
env?: string;
/** 播放类型 */
type?: 'rec' | 'live' | string;
/** 扩展字段 不一定会入库 */
[key: string]: any;
}
export interface CollectOptions {
/** 上报地址 */
url: string;
/** 统一扩展信息 */
extendsInfo?: ReportParam;
/** 是否禁用 */
forbidden?: boolean;
}
declare class Collect {
extendsInfo: ReportParam;
clientInfo: string;
options: CollectOptions;
constructor(options: CollectOptions);
changeUrl(url: string): void;
/**
* 记录信息
*/
send(params: ReportParam): this;
setForbidden(forbidden: boolean): void;
updateExtendsInfo(params?: ReportParam): void;
private _handleRecordError;
private _handleErrorInfo;
/**
* 获取扩展信息
*/
private _getExtendsInfo;
/**
* 获取设备信息
*/
private _getDeviceInfo;
}
export default Collect;