declare class DHAlarmWeb {
  localStream: MediaStream | null;
  pc: RTCPeerConnection | null;
  webrtcWs: WebSocket | null;
  alarmWs: WebSocket | null;
  audioWs: { [key: number]: WebSocket };
  deviceAudioWs: { [key: number]: WebSocket };
  started: boolean;
  webrtcSocketOpened: boolean;
  alarmSocketOpened: number;
  clientid: string | null;
  roomid: string | null;
  onStreamCallBack: ((stream: MediaStream) => void) | null;
  alarmUrl: string | null;
  webrtcUrl: string | null;
  onAlarmMessage: ((message: string) => void) | null;
  onLoging: ((status: any) => void) | null;
  onDeviceList: ((deviceList: any) => void) | null;
  onNotify: ((notification: any) => void) | null;
  onPlayRT: ((params: any) => void) | null;
  onPlayRTState: ((state: any) => void) | null;
  onDeviceRemove: ((device: any) => void) | null;
  onParseMsgError: ((error: any) => void) | null;
  uname: string | null;
  pwd: string | null;
  isLogin: boolean;
  loginHandle: number | null;
  deviceId: number | null;
  context: AudioContext | null;
  recorder: ScriptProcessorNode | null;
  audioInput: MediaStreamAudioSourceNode | null;
  wfs: { [key: number]: any };
  player: { [key: number]: any };
  bufferPool: { [key: number]: any };
  isDeviceAudioPlay: { [key: number]: boolean };
  onAlarmServerClosed: (() => void) | null;
  keepAliveInterval: NodeJS.Timeout | null;
  onDeviceAudioData: ((data: any, deviceId: number) => void) | null;
  onLocalAudioData: ((data: any) => void) | null;
  onDeviceVideoData: ((frame: any, deviceId: number) => void) | null;
  onDHAlarmWebError: ((error: any) => void) | null;
  hasDeviceList: boolean;
  loginState: number;
  loginTimer: NodeJS.Timeout | null;
  deviceListTimer: NodeJS.Timeout | null;
  loginInterval: number;
  talkDeviceIds: number[];
  multiTalkDeviceIds: number[];
  notStartBCWsDids: number[];
  multiTalkFilePath: string | null;
  multiFileTalkIntv: number;
  multiTalkType: number;
  sendIds: number[];
  bufferFileArr_8k: ArrayBuffer[];
  bufferFileArr_16k: ArrayBuffer[];
  broadcastType: number;
  remainFileBuffer_8k: number;
  remainFileBuffer_16k: number;
  bcPlayState: string;
  uploadFilePath: string | null;
  audioFileStream: any | null;
  audioUploadWs: WebSocket | null;
  uploadFileArr: ArrayBuffer[];
  totalUploadFileArr: ArrayBuffer[];
  overInter: NodeJS.Timeout | number;
  tunnelDataId: number;
  tunnelQueue: any[];
  tunnelReqTimeout: number;
  pbAudioWs: { [key: number]: WebSocket };
  pbWfs: { [key: number]: any };
  pbPlayer: { [key: number]: any };
  pbBufferPool: { [key: number]: any };
  dataWsPort: number;
  mediaWsPort: number;
  onGroupList: ((groupList: any) => void) | null;
  onAddGroup: ((group: any) => void) | null;
  onEditGroup: ((group: any) => void) | null;
  onDelGroup: ((groupId: number) => void) | null;
  onUserList: ((userList: any) => void) | null;
  onUserGroups: ((userGroups: any) => void) | null;
  onAddUser: ((user: any) => void) | null;
  onEditPassword: ((userId: number, newPassword: string) => void) | null;
  onDelUser: ((userId: number) => void) | null;
  onAuthorizeGroup: ((groupId: number, userId: number) => void) | null;
  onEditDevice: ((deviceId: number, params: any) => void) | null;
  onMoveDevice: ((deviceId: number, groupId: number) => void) | null;
  onGetWebPush: ((webPush: any) => void) | null;
  onEditWebPush: ((webPushId: number, params: any) => void) | null;
  onPlayAudioFileEnd: (() => void) | null;
  onAlarmMultiTalkStopped: ((deviceId: number) => void) | null;
  onMultiTalkStartFinished: (() => void) | null;
  onMultiTalkCountLimit: (() => void) | null;
  onMultiTalkClosedError: ((deviceId: number, isLast: boolean) => void) | null;
  onStartBroadcast: ((params: any) => void) | null;
  onBroadcastWsClosed: (() => void) | null;
  onUploadAudioFile: ((uploadInfo: any) => void) | null;
  onDeleteAudioFile: ((fileId: number) => void) | null;
  onDecodeAudioError: ((error: any) => void) | null;
  onUploadAudioFileEnd: (() => void) | null;
  onGetAudioFileList: ((fileList: any) => void) | null;
  onGetBCTaskList: ((taskList: any) => void) | null;
  onUploadBCTask: ((task: any) => void) | null;
  onEditBCTask: ((taskId: number, params: any) => void) | null;
  onDeleteBCTask: ((taskId: number) => void) | null;
  onConfigTunnel: ((tunnelConfig: any) => void) | null;
  onGetDeviceExtra: ((extraInfo: any) => void) | null;
  onSetDeviceExtra: ((deviceId: number, extraParams: any) => void) | null;
  onGetRecordList: ((recordList: any) => void) | null;

  constructor();

  openAlarmSocket(): void;
  onAlarmSocketOpened(): void;
  registerAlarm(): void;
  onAlarmSocketMessage(event: MessageEvent): void;
  onAlarmSocketError(event: Event): void;
  onAlarmSocketClosed(): void;
  sendAlarmMessage(message: any): void;
  sendAlarmMessageCallBack(message: any, callback: () => void): void;
  processAlarmMessage(data: string): void;
  setWebsocketPort(ports: { dataWsPort: number, mediaWsPort: number }): void;
  login(username: string, password: string, serverAddress: string): void;
  logout(loginHandle: number): void;
  playRT(elementId: string, deviceId: number, loginHandle: number, preview?: boolean): void;
  stopRT(deviceId: number, loginHandle: number): void;
  doControl(deviceId: number, loginHandle: number, index: number): void;
  playVideo(elementId: string, deviceId: number, loginHandle: number): void;
  onVideoFrame(frame: any, deviceId: number): void;
  startTalk(deviceId: number): void;
  stopTalk(deviceId: number): void;
  registerTalk(deviceId: number): void;
  openAudio(loginHandle: number, deviceId: number, startBroadcast?: boolean, sendAudio?: boolean): void;
  onAudioSocketOpened(deviceId: number): void;
  onAudioSocketMessage(event: MessageEvent, deviceId: number, startBroadcast?: boolean, sendAudio?: boolean): void;
  onAudioSocketError(event: Event, deviceId: number): void;
  onAudioSocketClosed(deviceId: number, sendAudio?: boolean): void;
  sendAudio(deviceId?: number): void;
}
