export declare function getRTCInstance(token: string, extraInfo?: string): IOmniRTC;
export default getRTCInstance;

declare class OmniRTCError extends Error {
    readonly code: OmniRTCErrorCode;
    readonly message: string;
    readonly data?: any;
    readonly name: string;
    constructor(code: OmniRTCErrorCode, message?: string, data?: any);
    toString(): string;
    print(level?: "error" | "warning"): OmniRTCError;
    throw(): never;
}

declare enum OmniRTCErrorCode {
    UNEXPECTED_ERROR = "UNEXPECTED_ERROR",
    UNEXPECTED_RESPONSE = "UNEXPECTED_RESPONSE",
    TIMEOUT = "TIMEOUT",
    INVALID_PARAMS = "INVALID_PARAMS",
    NOT_READABLE = "NOT_READABLE",
    NOT_SUPPORTED = "NOT_SUPPORTED",
    INVALID_OPERATION = "INVALID_OPERATION",
    OPERATION_ABORTED = "OPERATION_ABORTED",
    WEB_SECURITY_RESTRICT = "WEB_SECURITY_RESTRICT",
    EXCHANGE_SDP_FAILED = "EXCHANGE_SDP_FAILED",
    NETWORK_ERROR = "NETWORK_ERROR",
    NETWORK_TIMEOUT = "NETWORK_TIMEOUT",
    NETWORK_RESPONSE_ERROR = "NETWORK_RESPONSE_ERROR",
    API_INVOKE_TIMEOUT = "API_INVOKE_TIMEOUT",
    ENUMERATE_DEVICES_FAILED = "ENUMERATE_DEVICES_FAILED",
    DEVICE_NOT_FOUND = "DEVICE_NOT_FOUND",
    ELECTRON_IS_NULL = "ELECTRON_IS_NULL",
    ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR = "ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",
    CHROME_PLUGIN_NO_RESPONSE = "CHROME_PLUGIN_NO_RESPONSE",
    CHROME_PLUGIN_NOT_INSTALL = "CHROME_PLUGIN_NOT_INSTALL",
    MEDIA_OPTION_INVALID = "MEDIA_OPTION_INVALID",
    PERMISSION_DENIED = "PERMISSION_DENIED",
    CONSTRAINT_NOT_SATISFIED = "CONSTRAINT_NOT_SATISFIED",
    TRACK_IS_DISABLED = "TRACK_IS_DISABLED",
    GET_VIDEO_ELEMENT_VISIBLE_ERROR = "GET_VIDEO_ELEMENT_VISIBLE_ERROR",
    SHARE_AUDIO_NOT_ALLOWED = "SHARE_AUDIO_NOT_ALLOWED",
    LOW_STREAM_ENCODING_ERROR = "LOW_STREAM_ENCODING_ERROR",
    SET_ENCODING_PARAMETER_ERROR = "SET_ENCODING_PARAMETER_ERROR",
    TRACK_STATE_UNREACHABLE = "TRACK_STATE_UNREACHABLE",
    INVALID_UINT_UID_FROM_STRING_UID = "INVALID_UINT_UID_FROM_STRING_UID",
    CAN_NOT_GET_PROXY_SERVER = "CAN_NOT_GET_PROXY_SERVER",
    CAN_NOT_GET_GATEWAY_SERVER = "CAN_NOT_GET_GATEWAY_SERVER",
    VOID_GATEWAY_ADDRESS = "VOID_GATEWAY_ADDRESS",
    UID_CONFLICT = "UID_CONFLICT",
    MULTI_UNILBS_RESPONSE_ERROR = "MULTI_UNILBS_RESPONSE_ERROR",
    UPDATE_TICKET_FAILED = "UPDATE_TICKET_FAILED",
    INVALID_LOCAL_TRACK = "INVALID_LOCAL_TRACK",
    INVALID_TRACK = "INVALID_TRACK",
    SENDER_NOT_FOUND = "SENDER_NOT_FOUND",
    CREATE_OFFER_FAILED = "CREATE_OFFER_FAILED",
    SET_ANSWER_FAILED = "SET_ANSWER_FAILED",
    ICE_FAILED = "ICE_FAILED",
    PC_CLOSED = "PC_CLOSED",
    SENDER_REPLACE_FAILED = "SENDER_REPLACE_FAILED",
    GET_LOCAL_CAPABILITIES_FAILED = "GET_LOCAL_CAPABILITIES_FAILED",
    GET_LOCAL_CONNECTION_PARAMS_FAILED = "GET_LOCAL_CONNECTION_PARAMS_FAILED",
    SUBSCRIBE_FAILED = "SUBSCRIBE_FAILED",
    UNSUBSCRIBE_FAILED = "UNSUBSCRIBE_FAILED",
    GATEWAY_P2P_LOST = "GATEWAY_P2P_LOST",
    NO_ICE_CANDIDATE = "NO_ICE_CANDIDATE",
    CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS = "CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",
    EXIST_DISABLED_VIDEO_TRACK = "EXIST_DISABLED_VIDEO_TRACK",
    INVALID_REMOTE_USER = "INVALID_REMOTE_USER",
    REMOTE_USER_IS_NOT_PUBLISHED = "REMOTE_USER_IS_NOT_PUBLISHED",
    CUSTOM_REPORT_SEND_FAILED = "CUSTOM_REPORT_SEND_FAILED",
    CUSTOM_REPORT_FREQUENCY_TOO_HIGH = "CUSTOM_REPORT_FREQUENCY_TOO_HIGH",
    FETCH_AUDIO_FILE_FAILED = "FETCH_AUDIO_FILE_FAILED",
    READ_LOCAL_AUDIO_FILE_ERROR = "READ_LOCAL_AUDIO_FILE_ERROR",
    DECODE_AUDIO_FILE_FAILED = "DECODE_AUDIO_FILE_FAILED",
    WS_ABORT = "WS_ABORT",
    WS_DISCONNECT = "WS_DISCONNECT",
    WS_ERR = "WS_ERR",
    LIVE_STREAMING_TASK_CONFLICT = "LIVE_STREAMING_TASK_CONFLICT",
    LIVE_STREAMING_INVALID_ARGUMENT = "LIVE_STREAMING_INVALID_ARGUMENT",
    LIVE_STREAMING_INTERNAL_SERVER_ERROR = "LIVE_STREAMING_INTERNAL_SERVER_ERROR",
    LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED = "LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",
    LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED = "LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",
    LIVE_STREAMING_CDN_ERROR = "LIVE_STREAMING_CDN_ERROR",
    LIVE_STREAMING_INVALID_RAW_STREAM = "LIVE_STREAMING_INVALID_RAW_STREAM",
    LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT = "LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",
    LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE = "LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",
    LIVE_STREAMING_WARN_FREQUENT_REQUEST = "LIVE_STREAMING_WARN_FREQUENT_REQUEST",
    WEBGL_INTERNAL_ERROR = "WEBGL_INTERNAL_ERROR",
    BEAUTY_PROCESSOR_INTERNAL_ERROR = "BEAUTY_PROCESSOR_INTERNAL_ERROR",
    CROSS_CHANNEL_WAIT_STATUS_ERROR = "CROSS_CHANNEL_WAIT_STATUS_ERROR",
    CROSS_CHANNEL_FAILED_JOIN_SRC = "CROSS_CHANNEL_FAILED_JOIN_SEC",
    CROSS_CHANNEL_FAILED_JOIN_DEST = "CROSS_CHANNEL_FAILED_JOIN_DEST",
    CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST = "CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",
    CROSS_CHANNEL_SERVER_ERROR_RESPONSE = "CROSS_CHANNEL_SERVER_ERROR_RESPONSE",
    METADATA_OUT_OF_RANGE = "METADATA_OUT_OF_RANGE",
    LOCAL_AEC_ERROR = "LOCAL_AEC_ERROR",
    INVALID_PLUGIN = "INVALID_PLUGIN",
    DISCONNECT_P2P = "DISCONNECT_P2P",
    INIT_WEBSOCKET_TIMEOUT = "INIT_WEBSOCKET_TIMEOUT"
}

export declare interface OmniRTCStats {
    Duration: number;
    RecvBitrate: number;
    RecvBytes: number;
    SendBitrate: number;
    SendBytes: number;
    UserCount: number;
    RTT: number;
    OutgoingAvailableBandwidth: number;
}

export declare enum AREAS {
    CHINA = "CHINA",
    ASIA = "ASIA",
    NORTH_AMERICA = "NORTH_AMERICA",
    EUROPE = "EUROPE",
    JAPAN = "JAPAN",
    INDIA = "INDIA",
    KOREA = "KOREA",
    HKMC = "HKMC",
    US = "US",
    OCEANIA = "OCEANIA",
    SOUTH_AMERICA = "SOUTH_AMERICA",
    AFRICA = "AFRICA",
    OVERSEA = "OVERSEA",
    GLOBAL = "GLOBAL"
}


export declare enum AudienceLatencyLevelType {

    AUDIENCE_LEVEL_LOW_LATENCY = 1,

    AUDIENCE_LEVEL_ULTRA_LOW_LATENCY = 2,

    AUDIENCE_LEVEL_SYNC_LATENCY = 3
}


declare const AUDIO_ENCODER_CONFIG_SETTINGS: {
    speech_low_quality: AudioEncoderConfiguration;
    speech_standard: AudioEncoderConfiguration;
    music_standard: AudioEncoderConfiguration;
    standard_stereo: AudioEncoderConfiguration;
    high_quality: AudioEncoderConfiguration;
    high_quality_stereo: AudioEncoderConfiguration;
};

export declare interface AudioEncoderConfiguration {

    sampleRate?: number;

    sampleSize?: number;

    stereo?: boolean;

    bitrate?: number;
}


export declare type AudioEncoderConfigurationPreset = keyof typeof AUDIO_ENCODER_CONFIG_SETTINGS;


export declare interface AudioSourceOptions {

    cycle?: number;

    loop?: boolean;

    startPlayTime?: number;
}


export declare type AudioSourceState = "stopped" | "playing" | "paused";


export declare interface BeautyEffectOptions {

    smoothnessLevel?: number;

    lighteningLevel?: number;

    rednessLevel?: number;

    lighteningContrastLevel?: 0 | 1 | 2;
}


export declare interface BufferSourceAudioTrackInitConfig {

    source: File | string | AudioBuffer;

    cacheOnlineFile?: boolean;

    encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
}


export declare interface CameraVideoTrackInitConfig {

    encoderConfig?: VideoEncoderConfiguration | VideoEncoderConfigurationPreset;

    facingMode?: "user" | "environment";

    cameraId?: string;

    optimizationMode?: "motion" | "detail";

    scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
}


export declare enum ChannelMediaRelayError {

    RELAY_OK = "RELAY_OK",

    SERVER_CONNECTION_LOST = "SERVER_CONNECTION_LOST",

    SRC_TOKEN_EXPIRED = "SRC_TOKEN_EXPIRED",

    DEST_TOKEN_EXPIRED = "DEST_TOKEN_EXPIRED"
}


export declare enum ChannelMediaRelayEvent {

    NETWORK_DISCONNECTED = "NETWORK_DISCONNECTED",

    NETWORK_CONNECTED = "NETWORK_CONNECTED",

    PACKET_JOINED_SRC_CHANNEL = "PACKET_JOINED_SRC_CHANNEL",

    PACKET_JOINED_DEST_CHANNEL = "PACKET_JOINED_DEST_CHANNEL",

    PACKET_SENT_TO_DEST_CHANNEL = "PACKET_SENT_TO_DEST_CHANNEL",

    PACKET_RECEIVED_VIDEO_FROM_SRC = "PACKET_RECEIVED_VIDEO_FROM_SRC",

    PACKET_RECEIVED_AUDIO_FROM_SRC = "PACKET_RECEIVED_AUDIO_FROM_SRC",

    PACKET_UPDATE_DEST_CHANNEL = "PACKET_UPDATE_DEST_CHANNEL",

    PACKET_UPDATE_DEST_CHANNEL_REFUSED = "PACKET_UPDATE_DEST_CHANNEL_REFUSED",

    PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE = "PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE"
}


export declare interface ChannelMediaRelayInfo {

    channelName: string;

    token?: string;

    uid: number;
}


export declare enum ChannelMediaRelayState {

    RELAY_STATE_IDLE = "RELAY_STATE_IDLE",

    RELAY_STATE_CONNECTING = "RELAY_STATE_CONNECTING",

    RELAY_STATE_RUNNING = "RELAY_STATE_RUNNING",

    RELAY_STATE_FAILURE = "RELAY_STATE_FAILURE"
}


declare type CheckVideoVisibleResult = CheckVisibleResult;


declare type CheckVisibleResult = VisibleResultInner | VisibleHiddenResult;


export declare interface ClientConfig {

    codec: SDK_CODEC;

    audioCodec?: SDK_AUDIO_CODEC;

    mode: SDK_MODE;

    role?: ClientRole;

    clientRoleOptions?: ClientRoleOptions;

    proxyServer?: string;

    turnServer?: TurnServerConfig;

    httpRetryConfig?: RetryConfiguration;

    websocketRetryConfig?: RetryConfiguration;
}


export declare type ClientRole = "audience" | "host";


export declare interface ClientRoleOptions {

    level: AudienceLatencyLevelType;
}


export declare enum ConnectionDisconnectedReason {

    LEAVE = "LEAVE",

    NETWORK_ERROR = "NETWORK_ERROR",

    SERVER_ERROR = "SERVER_ERROR",

    UID_BANNED = "UID_BANNED",

    IP_BANNED = "IP_BANNED",

    CHANNEL_BANNED = "CHANNEL_BANNED",
    FALLBACK = "FALLBACK"
}

export declare type ConnectionState = "DISCONNECTED" | "CONNECTING" | "RECONNECTING" | "CONNECTED" | "DISCONNECTING";


export declare interface ConstrainLong {

    min?: number;

    max?: number;

    ideal?: number;

    exact?: number;
}


export declare interface CustomAudioTrackInitConfig {

    mediaStreamTrack: MediaStreamTrack;

    encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;
}


export declare interface CustomVideoTrackInitConfig {

    mediaStreamTrack: MediaStreamTrack;

    bitrateMin?: number;

    bitrateMax?: number;

    optimizationMode?: "motion" | "detail";

    scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;
}


export declare interface DeviceInfo {

    updateAt: number;

    initAt: number;

    state: DeviceState;

    device: MediaDeviceInfo;
}


export declare type DeviceState = "ACTIVE" | "INACTIVE";


export declare interface ElectronDesktopCapturerSource {

    id: string;

    name: string;

    thumbnail: IElectronNativeImage;
}


export declare type EncryptionMode = "aes-128-xts" | "aes-256-xts" | "aes-128-ecb" | "sm4-128-ecb" | "aes-128-gcm" | "aes-256-gcm" | "aes-128-gcm2" | "aes-256-gcm2" | "none";


export declare function event_beauty_effect_overload(): void;


export declare function event_channel_media_relay_event(event: ChannelMediaRelayEvent): void;


export declare function event_channel_media_relay_state(state: ChannelMediaRelayState, code: ChannelMediaRelayError): void;


export declare function event_connection_state_change(curState: ConnectionState, revState: ConnectionState, reason?: ConnectionDisconnectedReason): void;


export declare function event_crypt_error(): void;


export declare function event_exception(event: {

    code: number;

    msg: string;

    uid: UID;
}): void;


export declare function event_first_frame_decoded(): void;


export declare function event_is_using_cloud_proxy(isUsingProxy: boolean): void;


export declare function event_join_fallback_to_proxy(proxyServer: string): void;


export declare function event_live_streaming_error(url: string, err: OmniRTCError): void;


export declare function event_live_streaming_warning(url: string, warning: OmniRTCError): void;


export declare function event_media_reconnect_end(uid: UID): void;


export declare function event_media_reconnect_start(uid: UID): void;


export declare function event_network_quality(stats: NetworkQuality): void;


export declare function event_source_state_change(currentState: AudioSourceState): void;


export declare function event_stream_fallback(uid: UID, isFallbackOrRecover: "fallback" | "recover"): void;


export declare function event_stream_inject_status(status: InjectStreamEventStatus, uid: UID, url: string): void;


export declare function event_stream_type_changed(uid: UID, streamType: RemoteStreamType): void;


export declare function event_token_privilege_did_expire(): void;


export declare function event_token_privilege_will_expire(): void;


export declare function event_stream_message(uid: UID, payload: Uint8Array): void;


export declare function event_track_ended(): void;


export declare function event_user_info_updated(uid: UID, msg: "mute-audio" | "mute-video" | "enable-local-video" | "unmute-audio" | "unmute-video" | "disable-local-video"): void;


export declare function event_user_joined(user: IOmniRTCRemoteUser): void;


export declare function event_user_left(user: IOmniRTCRemoteUser, reason: string): void;


export declare function event_user_published(user: IOmniRTCRemoteUser, mediaType: "audio" | "video" | "screen"): void;


export declare function event_user_unpublished(user: IOmniRTCRemoteUser, mediaType: "audio" | "video" | "screen"): void;


export declare function event_video_element_visible_status(data?: CheckVideoVisibleResult): void;


export declare function event_video_element_visible_status_2(data?: CheckVideoVisibleResult): void;


export declare function event_volume_indicator(result: {

    level: number;

    uid: UID;
}[]): void;


export declare interface EventCustomReportParams {

    reportId: string;

    category: string;

    event: string;

    label: string;

    value: number;
}


declare class EventEmitter {
    // private _events;

    getListeners(event: string): Function[];

    on(event: string, listener: Function): void;

    once(event: string, listener: Function): void;

    off(event: string, listener: Function): void;

    removeAllListeners(event?: string): void;
    // private _indexOfListener;
}


export declare interface IOmniRTC {

    VERSION: string;

    getSupportedCodec(): Promise<{
        video: string[];
        audio: string[];
    }>;

    checkSystemRequirements(): boolean;

    createClient(config: ClientConfig): IOmniRTCClient;

    createCustomAudioTrack(config: CustomAudioTrackInitConfig): ILocalAudioTrack;

    createMicrophoneAudioTrack(config?: MicrophoneAudioTrackInitConfig): Promise<IMicrophoneAudioTrack>;

    createBufferSourceAudioTrack(config: BufferSourceAudioTrackInitConfig): Promise<IBufferSourceAudioTrack>;

    createCustomVideoTrack(config: CustomVideoTrackInitConfig): ILocalVideoTrack;

    createCameraVideoTrack(config?: CameraVideoTrackInitConfig): Promise<ICameraVideoTrack>;

    createMicrophoneAndCameraTracks(audioConfig?: MicrophoneAudioTrackInitConfig, videoConfig?: CameraVideoTrackInitConfig): Promise<[IMicrophoneAudioTrack, ICameraVideoTrack]>;

    createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio: "enable"): Promise<[ILocalVideoTrack, ILocalAudioTrack]>;
    createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio: "disable"): Promise<ILocalVideoTrack>;
    createScreenVideoTrack(config: ScreenVideoTrackInitConfig, withAudio?: "enable" | "disable" | "auto"): Promise<[ILocalVideoTrack, ILocalAudioTrack] | ILocalVideoTrack>;

    getDevices(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;

    getMicrophones(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;

    getCameras(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;

    getPlaybackDevices(skipPermissionCheck?: boolean): Promise<MediaDeviceInfo[]>;

    // getElectronScreenSources(type?: ScreenSourceType): Promise<ElectronDesktopCapturerSource[]>;

    setLogLevel(level: number): void;

    enableLogUpload(): void;

    disableLogUpload(): void;

    checkVideoTrackIsActive(track: ILocalVideoTrack | IRemoteVideoTrack, timeout?: number): Promise<boolean>;

    checkAudioTrackIsActive(track: ILocalAudioTrack | IRemoteAudioTrack, timeout?: number): Promise<boolean>;

    onCameraChanged?: (deviceInfo: DeviceInfo) => void;

    onMicrophoneChanged?: (deviceInfo: DeviceInfo) => void;

    onPlaybackDeviceChanged?: (deviceInfo: DeviceInfo) => void;

    onAudioAutoplayFailed?: () => void;

    onAutoplayFailed?: () => void;

    setArea(area: AREAS[] | {
        areaCode: AREAS[];
        excludedArea?: AREAS;
    }): void;

    processExternalMediaAEC(element: HTMLMediaElement): void;
}


export declare interface IOmniRTCClient extends EventEmitter {

    readonly connectionState: ConnectionState;

    readonly remoteUsers: IOmniRTCRemoteUser[];

    readonly localTracks: ILocalTrack[];

    readonly uid?: UID;

    readonly channelName?: string;
    on(event: "connection-state-change", listener: typeof event_connection_state_change): void;
    on(event: "user-joined", listener: typeof event_user_joined): void;
    on(event: "user-left", listener: typeof event_user_left): void;
    on(event: "user-published", listener: typeof event_user_published): void;
    on(event: "user-unpublished", listener: typeof event_user_unpublished): void;
    on(event: "user-info-updated", listener: typeof event_user_info_updated): void;
    on(event: "media-reconnect-start", listener: typeof event_media_reconnect_start): void;
    on(event: "media-reconnect-end", listener: typeof event_media_reconnect_end): void;
    // on(event: "stream-type-changed", listener: typeof event_stream_type_changed): void;
    // on(event: "stream-fallback", listener: typeof event_stream_fallback): void;
    // on(event: "channel-media-relay-state", listener: typeof event_channel_media_relay_state): void;
    // on(event: "channel-media-relay-event", listener: typeof event_channel_media_relay_event): void;
    on(event: "volume-indicator", listener: typeof event_volume_indicator): void;
    // on(event: "crypt-error", listener: typeof event_crypt_error): void;
    on(event: "token-privilege-will-expire", listener: typeof event_token_privilege_will_expire): void;
    on(event: "token-privilege-did-expire", listener: typeof event_token_privilege_did_expire): void;
    // on(event: "network-quality", listener: typeof event_network_quality): void;
    // on(event: "live-streaming-error", listener: typeof event_live_streaming_error): void;
    // on(event: "live-streaming-warning", listener: typeof event_live_streaming_warning): void;
    // on(event: "stream-inject-status", listener: typeof event_stream_inject_status): void;
    on(event: "stream-message", listener: typeof event_stream_message): void;
    on(event: "exception", listener: typeof event_exception): void;
    // on(event: "is-using-cloud-proxy", listener: typeof event_is_using_cloud_proxy): void;
    // on(event: "join-fallback-to-proxy", listener: typeof event_join_fallback_to_proxy): void;
    on(event: string, listener: Function): void;

    join(): Promise<UID>;

    leave(): Promise<void>;

    publish(tracks: ILocalTrack | ILocalTrack[]): Promise<void>;

    unpublish(tracks?: ILocalTrack | ILocalTrack[]): Promise<void>;

    subscribe(user: IOmniRTCRemoteUser, mediaType: "video"): Promise<IRemoteVideoTrack>;

    subscribe(user: IOmniRTCRemoteUser, mediaType: "audio"): Promise<IRemoteAudioTrack>;

    subscribe(user: IOmniRTCRemoteUser, mediaType: "screen"): Promise<IRemoteVideoTrack>;

    subscribe(user: IOmniRTCRemoteUser, mediaType: "video" | "audio" | "screen"): Promise<IRemoteTrack>;
    // massSubscribe(subscribeList: {
    //     user: IOmniRTCRemoteUser;
    //     mediaType: "audio" | "video";
    // }[]): Promise<{
    //     user: IOmniRTCRemoteUser;
    //     mediaType: "audio" | "video";
    //     track?: IRemoteTrack;
    //     error?: OmniRTCError;
    // }[]>;

    unsubscribe(user: IOmniRTCRemoteUser, mediaType?: "video" | "audio" | "screen"): Promise<void>;
    // massUnsubscribe(unsubscribeList: {
    //     user: IOmniRTCRemoteUser;
    //     mediaType?: "audio" | "video";
    // }[]): Promise<void>;

    // setLowStreamParameter(streamParameter: LowStreamParameter): void;

    // enableDualStream(): Promise<void>;

    // disableDualStream(): Promise<void>;

    setClientRole(role: ClientRole, options?: ClientRoleOptions): Promise<void>;

    // setProxyServer(proxyServer: string): void;

    // setTurnServer(turnServer: TurnServerConfig): void;

    // startProxyServer(mode?: number): void;

    // stopProxyServer(): void;

    // setRemoteVideoStreamType(uid: UID, streamType: RemoteStreamType): Promise<void>;

    // setRemoteDefaultVideoStreamType(streamType: RemoteStreamType): Promise<void>;

    // pickSVCLayer(uid: UID, layerOptions: {
    //     spatialLayer: 0 | 1 | 2 | 3;
    //     temporalLayer: 0 | 1 | 2 | 3;
    // }): Promise<void>;

    // setStreamFallbackOption(uid: UID, fallbackType: RemoteStreamFallbackType): Promise<void>;

    // setEncryptionConfig(encryptionMode: EncryptionMode, secret: string, salt?: Uint8Array): void;
    sendRoomBinaryMessage(message: Uint8Array): Promise<number>;

    renewToken(token: string): Promise<void>;

    enableAudioVolumeIndicator(): void;

    getRTCStats(): OmniRTCStats;

    // setLiveTranscoding(config: LiveStreamingTranscodingConfig): Promise<void>;

    // startLiveStreaming(url: string, transcodingEnabled?: boolean): Promise<void>;

    // stopLiveStreaming(url: string): Promise<void>;

    // addInjectStreamUrl(url: string, config: InjectStreamConfig): Promise<void>;

    // removeInjectStreamUrl(): Promise<void>;

    // startChannelMediaRelay(config: IChannelMediaRelayConfiguration): Promise<void>;

    // updateChannelMediaRelay(config: IChannelMediaRelayConfiguration): Promise<void>;

    // stopChannelMediaRelay(): Promise<void>;

    // sendCustomReportMessage(reports: EventCustomReportParams[] | EventCustomReportParams): Promise<void>;

    getLocalAudioStats(): LocalAudioTrackStats;

    getRemoteAudioStats(): {
        [uid: string]: RemoteAudioTrackStats;
    };

    getRemoteNetworkQuality(): {
        [uid: string]: NetworkQuality;
    };

    getLocalVideoStats(): LocalVideoTrackStats;

    getRemoteVideoStats(): {
        [uid: string]: RemoteVideoTrackStats;
    };
}


export declare interface IOmniRTCRemoteUser {

    uid: UID;

    audioTrack?: IRemoteAudioTrack;

    videoTrack?: IRemoteVideoTrack;

    screenTrack?: IRemoteVideoTrack;

    hasAudio: boolean;

    hasVideo: boolean;

    hasScreen: boolean;
}


export declare interface IBufferSourceAudioTrack extends ILocalAudioTrack {

    source: string | File | AudioBuffer;

    currentState: AudioSourceState;

    duration: number;
    on(event: "source-state-change", listener: typeof event_source_state_change): void;
    on(event: string, listener: Function): void;

    getCurrentTime(): number;

    startProcessAudioBuffer(options?: AudioSourceOptions): void;

    pauseProcessAudioBuffer(): void;

    seekAudioBuffer(time: number): void;

    resumeProcessAudioBuffer(): void;

    stopProcessAudioBuffer(): void;
}


export declare interface ICameraVideoTrack extends ILocalVideoTrack {

    setDevice(deviceId: string): Promise<void>;

    setEnabled(enabled: boolean): Promise<void>;

    setEncoderConfiguration(config: VideoEncoderConfiguration | VideoEncoderConfigurationPreset): Promise<void>;
}


export declare interface IChannelMediaRelayConfiguration {

    setSrcChannelInfo(info: ChannelMediaRelayInfo): void;

    addDestChannelInfo(info: ChannelMediaRelayInfo): void;

    removeDestChannelInfo(channelName: string): void;
}


declare interface IElectronNativeImage {
    toDataURL(): string;
    getSize(): {
        width: number;
        height: number;
    };
    resize(options: {
        width: number;
    }): IElectronNativeImage;
}


export declare interface ILocalAudioTrack extends ILocalTrack {

    setVolume(volume: number): void;

    getVolumeLevel(): number;

    // setAudioFrameCallback(audioFrameCallback: null | ((buffer: AudioBuffer) => void), frameSize?: number): void;

    play(): void;

    setPlaybackDevice(deviceId: string): Promise<void>;

    // getStats(): LocalAudioTrackStats;
}


export declare interface ILocalTrack extends ITrack {
    on(event: "track-ended", listener: typeof event_track_ended): void;

    setEnabled(enabled: boolean): Promise<void>;

    // getStats(): LocalVideoTrackStats | LocalAudioTrackStats;

    getTrackLabel(): string;

    setMuted(muted: boolean): Promise<void>;

    close(): void;
    muted: boolean;
    enabled: boolean;
}


export declare interface ILocalVideoTrack extends ILocalTrack {
    // on(event: "beauty-effect-overload", listener: typeof event_beauty_effect_overload): void;
    on(event: "track-ended", listener: typeof event_track_ended): void;
    // on(event: "video-element-visible-status", listener: typeof event_video_element_visible_status_2): void;

    play(element: string | HTMLElement, config?: VideoPlayerConfig): void;

    // getStats(): LocalVideoTrackStats;

    // setBeautyEffect(enabled: boolean, options?: BeautyEffectOptions): Promise<void>;

    getCurrentFrameData(): ImageData;

    // setOptimizationMode(mode: "balanced" | "motion" | "detail"): Promise<void>;

    // getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
}


export declare interface IMicrophoneAudioTrack extends ILocalAudioTrack {

    setDevice(deviceId: string): Promise<void>;

    setEnabled(enabled: boolean): Promise<void>;
}


export declare interface InjectStreamConfig {
    audioVolume?: number;

    audioBitrate?: number;

    audioChannels?: number;

    audioSampleRate?: number;

    height?: number;

    width?: number;

    videoBitrate?: number;

    videoFramerate?: number;
    videoGop?: number;
}


declare enum InjectStreamEventStatus {

    INJECT_STREAM_STATUS_START_SUCCESS = 0,

    INJECT_STREAM_STATUS_START_ALREADY_EXISTS = 1,

    INJECT_STREAM_STATUS_START_UNAUTHORIZED = 2,

    INJECT_STREAM_STATUS_START_TIMEOUT = 3,

    INJECT_STREAM_STATUS_START_FAILED = 4,

    INJECT_STREAM_STATUS_STOP_SUCCESS = 5,

    INJECT_STREAM_STATUS_STOP_NOT_FOUND = 6,

    INJECT_STREAM_STATUS_STOP_UNAUTHORIZED = 7,

    INJECT_STREAM_STATUS_STOP_TIMEOUT = 8,
    INJECT_STREAM_STATUS_STOP_FAILED = 9,

    INJECT_STREAM_STATUS_BROKEN = 10
}


export declare interface IRemoteAudioTrack extends IRemoteTrack {

    // getStats(): RemoteAudioTrackStats;
    /**
     * @ignore
     */
    consumer?: any;

    /**
     * @ignore
     */
    volume?: any;

    play(): void;

    setPlaybackDevice(deviceId: string): Promise<void>;

    // setAudioFrameCallback(audioFrameCallback: null | ((buffer: AudioBuffer) => void), frameSize?: number): void;

    setVolume(volume: number): void;

    getVolumeLevel(): number;
}


export declare interface IRemoteTrack extends ITrack {
    on(event: "first-frame-decoded", listener: typeof event_first_frame_decoded): void;

    getUserId(): UID;

    // getStats(): RemoteAudioTrackStats | RemoteVideoTrackStats;
}


export declare interface IRemoteVideoTrack extends IRemoteTrack {
    on(event: "first-frame-decoded", listener: typeof event_first_frame_decoded): void;
    // on(event: "video-element-visible-status", listener: typeof event_video_element_visible_status): void;

    // getStats(): RemoteVideoTrackStats;

    play(element: string | HTMLElement, config?: VideoPlayerConfig): void;

    getCurrentFrameData(): ImageData;

    // getVideoElementVisibleStatus(): CheckVideoVisibleResult | undefined;
}

export declare interface ITrack extends EventEmitter {

    trackMediaType: "audio" | "video";

    track?: MediaStreamTrack;

    isPlaying: boolean;

    getTrackId(): string;

    getMediaStreamTrack(): MediaStreamTrack;

    play(element?: string | HTMLElement): void;

    stop(): void;
}


export declare interface LiveStreamingTranscodingConfig {

    audioBitrate?: number;

    audioChannels?: 1 | 2 | 3 | 4 | 5;

    audioSampleRate?: 32000 | 44100 | 48000;

    backgroundColor?: number;

    height?: number;

    width?: number;

    lowLatency?: boolean;

    videoBitrate?: number;

    videoCodecProfile?: 66 | 77 | 100;

    videoFrameRate?: number;

    videoGop?: number;

    images?: LiveStreamingTranscodingImage[];

    watermark?: LiveStreamingTranscodingImage;

    backgroundImage?: LiveStreamingTranscodingImage;

    transcodingUsers?: LiveStreamingTranscodingUser[];
    userConfigExtraInfo?: string;
}


export declare interface LiveStreamingTranscodingImage {

    url: string;

    x?: number;

    y?: number;

    width?: number;

    height?: number;

    alpha?: number;
}


export declare interface LiveStreamingTranscodingUser {

    alpha?: number;

    height?: number;

    uid: UID;

    width?: number;

    x?: number;

    y?: number;

    zOrder?: number;

    audioChannel?: number;
}


export declare interface LocalAudioTrackStats {

    codecType?: "opus" | "aac" | "PCMU" | "PCMA" | "G722";

    sendVolumeLevel: number;

    sendBitrate: number;

    sendBytes: number;

    sendPackets: number;

    sendPacketsLost: number;

    currentPacketLossRate: number;
}


export declare interface LocalVideoTrackStats {

    codecType?: "H264" | "VP8" | "VP9" | "AV1X" | "AV1";

    sendBytes: number;

    sendFrameRate?: number;

    captureFrameRate?: number;

    sendPackets: number;

    sendPacketsLost: number;

    sendResolutionHeight: number;

    sendResolutionWidth: number;

    captureResolutionHeight: number;

    captureResolutionWidth: number;

    encodeDelay?: number;

    sendBitrate: number;

    targetSendBitrate: number;

    totalDuration: number;

    totalFreezeTime: number;

    currentPacketLossRate: number;
}


export declare interface LowStreamParameter {

    width: ConstrainULong;

    height: ConstrainULong;

    framerate?: ConstrainULong;

    bitrate?: number;
}


export declare interface MicrophoneAudioTrackInitConfig {

    encoderConfig?: AudioEncoderConfiguration | AudioEncoderConfigurationPreset;

    AEC?: boolean;

    AGC?: boolean;

    ANS?: boolean;

    DTX?: boolean;

    microphoneId?: string;

    bypassWebAudio?: boolean;
}


export declare interface NetworkQuality {

    uplinkNetworkQuality: 0 | 1 | 2 | 3 | 4 | 5 | 6;

    downlinkNetworkQuality: 0 | 1 | 2 | 3 | 4 | 5 | 6;
}


export declare interface RemoteAudioTrackStats {

    transportDelay: number;

    codecType?: "opus" | "aac" | "PCMU" | "PCMA" | "G722";

    end2EndDelay: number;

    receiveBitrate: number;

    receiveLevel: number;

    receiveBytes: number;

    receiveDelay: number;

    receivePackets: number;

    receivePacketsLost: number;

    packetLossRate: number;

    currentPacketLossRate: number;

    totalDuration: number;

    totalFreezeTime: number;

    freezeRate: number;
    publishDuration: number;
}


export declare enum RemoteStreamFallbackType {

    DISABLE = 0,

    LOW_STREAM = 1,

    AUDIO_ONLY = 2
}


export declare enum RemoteStreamType {

    HIGH_STREAM = 0,

    LOW_STREAM = 1
}


export declare interface RemoteVideoTrackStats {

    transportDelay: number;

    codecType?: "H264" | "VP8" | "VP9" | "AV1X" | "AV1";

    end2EndDelay: number;

    receiveBitrate: number;

    receiveDelay: number;

    receiveBytes: number;

    decodeFrameRate?: number;

    receiveFrameRate?: number;

    renderFrameRate?: number;

    receivePackets: number;

    receivePacketsLost: number;

    packetLossRate: number;

    currentPacketLossRate: number;

    receiveResolutionHeight: number;

    receiveResolutionWidth: number;

    totalDuration: number;

    totalFreezeTime: number;

    freezeRate: number;
    publishDuration: number;
}


declare interface RetryConfiguration {
    timeout: number;
    timeoutFactor: number;
    maxRetryCount: number;
    maxRetryTimeout: number;
}


export declare type ScreenEncoderConfigurationPreset = keyof typeof SUPPORT_SCREEN_ENCODER_CONFIG_LIST;


export declare type ScreenSourceType = "screen" | "window" | "application";


export declare interface ScreenVideoTrackInitConfig {

    encoderConfig?: VideoEncoderConfiguration | ScreenEncoderConfigurationPreset;

    electronScreenSourceId?: string;

    extensionId?: string;

    screenSourceType?: ScreenSourceType;

    optimizationMode?: "motion" | "detail";

    scalabiltyMode?: SVCConfiguration | SVCConfigurationPreset;

    options?: any;
}


export declare type SDK_AUDIO_CODEC = "opus" | "pcma" | "pcmu" | "g722";


export declare type SDK_CODEC = "h264" | "vp8" | "vp9" | "av1";


export declare type SDK_MODE = "live" | "rtc";


declare const SUPPORT_SCREEN_ENCODER_CONFIG_LIST: {
    "480p": VideoEncoderConfiguration;
    "480p_1": VideoEncoderConfiguration;
    "480p_2": VideoEncoderConfiguration;
    "480p_3": VideoEncoderConfiguration;
    "720p": VideoEncoderConfiguration;
    "720p_1": VideoEncoderConfiguration;
    "720p_2": VideoEncoderConfiguration;
    "720p_3": VideoEncoderConfiguration;
    "1080p": VideoEncoderConfiguration;
    "1080p_1": VideoEncoderConfiguration;
    "1080p_2": VideoEncoderConfiguration;
    "1080p_3": VideoEncoderConfiguration;
};


declare const SUPPORT_SVC_CONFIG_LIST: {
    "1SL1TL": SVCConfiguration;
    "3SL3TL": SVCConfiguration;
    "2SL3TL": SVCConfiguration;
};


declare const SUPPORT_VIDEO_ENCODER_CONFIG_LIST: {
    "90p": VideoEncoderConfiguration;
    "90p_1": VideoEncoderConfiguration;
    "120p": VideoEncoderConfiguration;
    "120p_1": VideoEncoderConfiguration;
    "120p_3": VideoEncoderConfiguration;
    "120p_4": VideoEncoderConfiguration;
    "180p": VideoEncoderConfiguration;
    "180p_1": VideoEncoderConfiguration;
    "180p_3": VideoEncoderConfiguration;
    "180p_4": VideoEncoderConfiguration;
    "240p": VideoEncoderConfiguration;
    "240p_1": VideoEncoderConfiguration;
    "240p_3": VideoEncoderConfiguration;
    "240p_4": VideoEncoderConfiguration;
    "360p": VideoEncoderConfiguration;
    "360p_1": VideoEncoderConfiguration;
    "360p_3": VideoEncoderConfiguration;
    "360p_4": VideoEncoderConfiguration;
    "360p_6": VideoEncoderConfiguration;
    "360p_7": VideoEncoderConfiguration;
    "360p_8": VideoEncoderConfiguration;
    "360p_9": VideoEncoderConfiguration;
    "360p_10": VideoEncoderConfiguration;
    "360p_11": VideoEncoderConfiguration;
    "480p": VideoEncoderConfiguration;
    "480p_1": VideoEncoderConfiguration;
    "480p_2": VideoEncoderConfiguration;
    "480p_3": VideoEncoderConfiguration;
    "480p_4": VideoEncoderConfiguration;
    "480p_6": VideoEncoderConfiguration;
    "480p_8": VideoEncoderConfiguration;
    "480p_9": VideoEncoderConfiguration;
    "480p_10": VideoEncoderConfiguration;
    "720p": VideoEncoderConfiguration;
    "720p_1": VideoEncoderConfiguration;
    "720p_2": VideoEncoderConfiguration;
    "720p_3": VideoEncoderConfiguration;
    "720p_5": VideoEncoderConfiguration;
    "720p_6": VideoEncoderConfiguration;
    "1080p": VideoEncoderConfiguration;
    "1080p_1": VideoEncoderConfiguration;
    "1080p_2": VideoEncoderConfiguration;
    "1080p_3": VideoEncoderConfiguration;
    "1080p_5": VideoEncoderConfiguration;
    "1440p": VideoEncoderConfiguration;
    "1440p_1": VideoEncoderConfiguration;
    "1440p_2": VideoEncoderConfiguration;
    "4k": VideoEncoderConfiguration;
    "4k_1": VideoEncoderConfiguration;
    "4k_3": VideoEncoderConfiguration;
};


export declare interface SVCConfiguration {

    numSpatialLayers: 1 | 2 | 3;

    numTemporalLayers: 1 | 3;
}


export declare type SVCConfigurationPreset = keyof typeof SUPPORT_SVC_CONFIG_LIST;


export declare interface TurnServerConfig {

    turnServerURL: string;

    password: string;

    udpport?: number;

    username: string;

    forceturn?: boolean;

    tcpport?: number;
    security?: boolean;
}


export declare type UID = number | string;


export declare interface VideoEncoderConfiguration {

    width?: number | ConstrainLong;

    height?: number | ConstrainLong;

    frameRate?: number | ConstrainLong;

    bitrateMin?: number;

    bitrateMax?: number;

    scaleResolutionDownBy?: number;
}


export declare type VideoEncoderConfigurationPreset = keyof typeof SUPPORT_VIDEO_ENCODER_CONFIG_LIST;


export declare interface VideoPlayerConfig {

    mirror?: boolean;

    fit?: "cover" | "contain" | "fill";
}


declare enum VisibleHiddenReason {
    COVERED = "COVERED",
    POSITION = "POSITION",
    SIZE = "SIZE",
    STYLE = "STYLE"
}

declare interface VisibleHiddenResult {
    visible: false;
    reason: keyof typeof VisibleHiddenReason;
}


declare interface VisibleResultInner {
    visible: true;
}
