/** 海康 WebSDK 通用异步回调。 */ interface HikvisionSdkCallbacks { success?: (xmlDoc?: Document) => void error?: (status?: number, xmlDoc?: Document) => void } /** 海康 WebSDK 初始化参数。 */ interface HikvisionPluginOptions { bWndFull: boolean iPackageType: number iWndowType: number bNoPlugin: boolean cbInitPluginComplete: () => void cbPluginErrorHandler: (windowIndex: number, errorCode: number, error?: unknown) => void cbPerformanceLack: () => void cbSecretKeyError: (windowIndex: number) => void } /** 海康实时预览参数。 */ interface HikvisionRealPlayOptions extends HikvisionSdkCallbacks { iWndIndex: number iRtspPort: number iStreamType: number iChannelID: number iWSPort?: number bZeroChannel: boolean bProxy: boolean } /** 海康 WebSDK 暴露到 window 的控制器。 */ interface HikvisionWebVideoCtrl { I_SupportNoPlugin: () => boolean I_InitPlugin: (width: string, height: string, options: HikvisionPluginOptions) => void I_InsertOBJECTPlugin: (containerId: string) => number I_Login: ( host: string, protocol: number, port: string, username: string, password: string, callbacks: HikvisionSdkCallbacks ) => number | void I_Logout: (deviceIdentify: string) => number I_StartRealPlay: (deviceIdentify: string, options: HikvisionRealPlayOptions) => void I_GetWindowStatus: (windowIndex: number) => { szDeviceIdentify?: string } | null I_Stop: (options: HikvisionSdkCallbacks & { iIndex?: number }) => void I_StopAll: () => Promise | void I_Resize: (width: number, height: number) => void I_DestroyWorker: () => void I_SetSecretKey: (secretKey: string, windowIndex: number) => Promise } interface Window { WebVideoCtrl?: HikvisionWebVideoCtrl }