// Copyright © 2022 BytePlusRTC All rights reserved. // SPDX-License-Identifier: MIT import { RTCRoomStats, AVSyncState, UserInfo, StreamRemoveReason, LocalStreamStats, RemoteStreamStats, SubscribeConfig, ForwardStreamStateInfo, ForwardStreamEventInfo, NetworkQualityStats, SetRoomExtraInfoResult, UserVisibilityChangeError, SubtitleState, SubtitleMessage, RTCStream, PlayState, KTVPlayerErrorCode, PlayerState, PlayerError, RemoteStreamKey, RTCEncodedVideoFrame, MusicInfo, HotMusicInfo, DownloadResult, SingScoringRealtimeInfo, FaceDetectionResult, ByteRTCStreamMixingEvent, MixedStreamType, VideoFrame, IAudioFrame, ByteRTCStreamMixingType, StreamIndex, MediaPlayerCustomSourceSeekWhence, SysStats, LocalAudioStreamState, LocalAudioStreamError, RemoteAudioState, RemoteAudioStateChangeReason, LocalVideoStreamState, LocalVideoStreamError, RemoteVideoState, RemoteVideoStateChangeReason, VideoSuperResolutionMode, VideoSuperResolutionModeChangedReason, VideoDenoiseMode, VideoDenoiseModeChangedReason, VideoFrameInfo, AudioRoute, SEIStreamUpdateEvent, NetworkDetectionLinkType, NetworkDetectionStopReason, RemoteStreamSwitch, PerformanceAlarmMode, PerformanceAlarmReason, SourceWantedData, RtcUser, FirstFrameSendState, FirstFramePlayState, AudioDeviceType, VideoDeviceType, RecordingState, RecordingErrorCode, RecordingInfo, RecordingProgress, AudioRecordingState, LocalAudioPropertiesInfo, RemoteAudioPropertiesInfo, SyncInfoStreamType, DataMessageSourceType, EchoTestResult, HardwareEchoDetectionResult, LocalProxyType, LocalProxyState, LocalProxyError, MuteState, AudioPlaybackDevice, AudioMixingState, AudioMixingError, PublishState, PublishStateChangeReason, SubscribeState, SubscribeStateChangeReason } from './keytype'; import { String, int, ByteBuffer, long, JSONObject, double, Bitmap } from './types'; import { SubtitleErrorCode, ByteRTCStreamSinglePushEvent, KTVErrorCode, ByteRTCTranscoderErrorCode, AudioRecordingErrorCode, PublicStreamErrorCode } from './errorcode'; export declare class IRTCRoomEventHandler { onLeaveRoom?(stats: RTCRoomStats): void; onRoomStateChanged?(roomId: String, uid: String, state: int, extraInfo: String): void; onStreamStateChanged?(roomId: String, uid: String, state: int, extraInfo: String): void; onAVSyncStateChange?(state: AVSyncState): void; onRoomStats?(stats: RTCRoomStats): void; onUserJoined?(userInfo: UserInfo, elapsed: int): void; onUserLeave?(uid: String, reason: int): void; onTokenWillExpire?(): void; onPublishPrivilegeTokenWillExpire?(): void; onSubscribePrivilegeTokenWillExpire?(): void; onUserPublishStreamVideo?(roomId: String, uid: String, isPublish: boolean): void; onUserPublishStreamAudio?(roomId: String, uid: String, isPublish: boolean): void; onUserPublishScreenVideo?(roomId: String, uid: String, isPublish: boolean): void; onUserPublishScreenAudio?(roomId: String, uid: String, isPublish: boolean): void; onVideoPublishStateChanged?(roomId: String, uid: String, state: PublishState, reason: PublishStateChangeReason): void; onAudioPublishStateChanged?(roomId: String, uid: String, state: PublishState, reason: PublishStateChangeReason): void; onScreenVideoPublishStateChanged?(roomId: String, uid: String, state: PublishState, reason: PublishStateChangeReason): void; onScreenAudioPublishStateChanged?(roomId: String, uid: String, state: PublishState, reason: PublishStateChangeReason): void; onVideoSubscribeStateChanged?(roomId: String, uid: String, state: SubscribeState, reason: SubscribeStateChangeReason): void; onAudioSubscribeStateChanged?(roomId: String, uid: String, state: SubscribeState, reason: SubscribeStateChangeReason): void; onScreenVideoSubscribeStateChanged?(roomId: String, uid: String, state: SubscribeState, reason: SubscribeStateChangeReason): void; onScreenAudioSubscribeStateChanged?(roomId: String, uid: String, state: SubscribeState, reason: SubscribeStateChangeReason): void; onLocalStreamStats?(stats: LocalStreamStats): void; onRemoteStreamStats?(stats: RemoteStreamStats): void; onStreamSubscribed?(stateCode: int, userId: String, info: SubscribeConfig): void; onRoomMessageReceived?(uid: String, message: String): void; onRoomBinaryMessageReceived?(uid: String, message: ByteBuffer): void; onUserMessageReceived?(uid: String, message: String): void; onUserBinaryMessageReceived?(uid: String, message: ByteBuffer): void; onUserMessageSendResult?(msgid: long, error: int): void; onRoomMessageSendResult?(msgid: long, error: int): void; onVideoStreamBanned?(uid: String, banned: boolean): void; onAudioStreamBanned?(uid: String, banned: boolean): void; onForwardStreamStateChanged?(stateInfos: Array): void; onForwardStreamEvent?(eventInfos: Array): void; onNetworkQuality?(localQuality: NetworkQualityStats, remoteQualities: Array): void; onSetRoomExtraInfoResult?(taskId: long, error: SetRoomExtraInfoResult): void; onRoomExtraInfoUpdate?(key: String, value: String, lastUpdateUserId: String, lastUpdateTimeMs: long): void; onUserVisibilityChanged?(currentUserVisibility: boolean, errorCode: UserVisibilityChangeError): void; onSubtitleStateChanged?(state: SubtitleState, errorCode: SubtitleErrorCode, errorMessage: String): void; onSubtitleMessageReceived?(subtitles: Array): void; onRoomWarning?(warn: int): void; onRoomError?(err: int): void; onStreamRemove?(stream: RTCStream, reason: StreamRemoveReason): void; onStreamAdd?(stream: RTCStream): void; } export declare class IKTVPlayerEventHandler { onPlayProgress?(musicId: String, progress: long): void; onPlayStateChanged?(musicId: String, playState: PlayState, errorCode: KTVPlayerErrorCode): void; } export declare class IAudioEffectPlayerEventHandler { onAudioEffectPlayerStateChanged?(effectId: int, state: PlayerState, error: PlayerError): void; } export declare class IPushSingleStreamToCDNObserver { onStreamPushEvent?(eventType: ByteRTCStreamSinglePushEvent, taskId: String, error: int): void; } export declare class IRemoteEncodedVideoFrameObserver { onRemoteEncodedVideoFrame?(streamKey: RemoteStreamKey, encodedVideoFrame: RTCEncodedVideoFrame): void; } export declare class IKTVManagerEventHandler { onMusicListResult?(musicInfos: Array, totalSize: int, errorCode: KTVErrorCode): void; onSearchMusicResult?(musicInfos: Array, totalSize: int, errorCode: KTVErrorCode): void; onHotMusicResult?(hotMusics: Array, errorCode: KTVErrorCode): void; onMusicDetailResult?(musicInfo: MusicInfo, errorCode: KTVErrorCode): void; onDownloadSuccess?(downloadId: int, result: DownloadResult): void; onDownloadFailed?(downloadId: int, errorCode: KTVErrorCode): void; onDownloadMusicProgress?(downloadId: int, downloadProgress: int): void; onClearCacheResult?(errorCode: KTVErrorCode): void; } export declare class ISingScoringEventHandler { onCurrentScoringInfo?(info: SingScoringRealtimeInfo): void; } export declare class IFaceDetectionObserver { onFaceDetectResult?(result: FaceDetectionResult): void; } export declare class IMixedStreamObserver { isSupportClientPushStream?(): boolean; onMixingEvent?(eventType: ByteRTCStreamMixingEvent, taskId: String, error: ByteRTCTranscoderErrorCode, mixType: MixedStreamType): void; onMixingAudioFrame?(taskId: String, audioFrame: ArrayBuffer, frameNum: int, timeStampMs: long): void; onMixingVideoFrame?(taskId: String, videoFrame: VideoFrame): void; onMixingDataFrame?(taskId: String, dataFrame: ArrayBuffer, time: long): void; } export declare class IMediaPlayerAudioFrameObserver { onFrame?(playerId: int, frame: IAudioFrame): void; } export declare class IAudioFileFrameObserver { onAudioFileFrame?(mixID: int, audioFrame: IAudioFrame): void; } export declare class ILiveTranscodingObserver { isSupportClientPushStream?(): boolean; onStreamMixingEvent?(eventType: ByteRTCStreamMixingEvent, taskId: String, error: ByteRTCTranscoderErrorCode, mixType: ByteRTCStreamMixingType): void; onMixingAudioFrame?(taskId: String, audioFrame: ArrayBuffer, frameNum: int, timeStampMs: long): void; onMixingVideoFrame?(taskId: String, videoFrame: VideoFrame): void; onMixingDataFrame?(taskId: String, dataFrame: ArrayBuffer, time: long): void; } export declare class IRTCASREngineEventHandler { onSuccess?(): void; onMessage?(message: String): void; onError?(errorCode: int, errorMessage: String): void; } export declare class ILocalEncodedVideoFrameObserver { onLocalEncodedVideoFrame?(streamIndex: StreamIndex, encodedVideoFrame: RTCEncodedVideoFrame): void; } export declare class IExternalVideoEncoderEventHandler { onStart?(index: StreamIndex): void; onStop?(index: StreamIndex): void; onRateUpdate?(streamIndex: StreamIndex, videoIndex: int, fps: int, bitrateKbps: int): void; onRequestKeyFrame?(streamIndex: StreamIndex, videoIndex: int): void; onActiveVideoLayer?(streamIndex: StreamIndex, videoIndex: int, active: boolean): void; } export declare class IMediaPlayerEventHandler { onMediaPlayerStateChanged?(playerId: int, state: PlayerState, error: PlayerError): void; onMediaPlayerPlayingProgress?(playerId: int, progress: long): void; } export declare class IAudioFrameObserver { onRecordAudioFrame?(audioFrame: IAudioFrame): void; onPlaybackAudioFrame?(audioFrame: IAudioFrame): void; onRemoteUserAudioFrame?(streamKey: RemoteStreamKey, audioFrame: IAudioFrame): void; onMixedAudioFrame?(audioFrame: IAudioFrame): void; } export declare class IRTCEncryptionHandler { onEncryptData?(data: ArrayBuffer): ArrayBuffer; onDecryptData?(data: ArrayBuffer): ArrayBuffer; } export declare class IMediaPlayerCustomSourceProvider { onReadData?(buffer: ByteBuffer, bufferSize: int): int; onSeek?(offset: long, whence: MediaPlayerCustomSourceSeekWhence): long; } export declare class IRTCVideoEventHandler { onWarning?(warn: int): void; onError?(err: int): void; onExtensionAccessError?(extensionName: String, msg: String): void; onSysStats?(stats: SysStats): void; onNetworkTypeChanged?(type: int): void; onUserStartVideoCapture?(roomId: String, uid: String): void; onUserStopVideoCapture?(roomId: String, uid: String): void; onCreateRoomStateChanged?(roomId: String, errorCode: int): void; onUserStartAudioCapture?(roomId: String, uid: String): void; onUserStopAudioCapture?(roomId: String, uid: String): void; onLocalAudioStateChanged?(state: LocalAudioStreamState, error: LocalAudioStreamError): void; onRemoteAudioStateChanged?(key: RemoteStreamKey, state: RemoteAudioState, reason: RemoteAudioStateChangeReason): void; onLocalVideoStateChanged?(streamIndex: StreamIndex, state: LocalVideoStreamState, error: LocalVideoStreamError): void; onRemoteVideoStateChanged?(streamKey: RemoteStreamKey, videoState: RemoteVideoState, videoStateReason: RemoteVideoStateChangeReason): void; onRemoteVideoSuperResolutionModeChanged?(streamKey: RemoteStreamKey, mode: VideoSuperResolutionMode, reason: VideoSuperResolutionModeChangedReason): void; onVideoDenoiseModeChanged?(mode: VideoDenoiseMode, reason: VideoDenoiseModeChangedReason): void; onFirstRemoteVideoFrameRendered?(remoteStreamKey: RemoteStreamKey, frameInfo: VideoFrameInfo): void; onFirstRemoteVideoFrameDecoded?(remoteStreamKey: RemoteStreamKey, frameInfo: VideoFrameInfo): void; onFirstLocalVideoFrameCaptured?(streamIndex: StreamIndex, frameInfo: VideoFrameInfo): void; onLocalVideoSizeChanged?(streamIndex: StreamIndex, frameInfo: VideoFrameInfo): void; onRemoteVideoSizeChanged?(remoteStreamKey: RemoteStreamKey, frameInfo: VideoFrameInfo): void; onConnectionStateChanged?(state: int, reason: int): void; onAudioRouteChanged?(route: AudioRoute): void; onFirstLocalAudioFrame?(streamIndex: StreamIndex): void; onFirstRemoteAudioFrame?(remoteStreamKey: RemoteStreamKey): void; onLogReport?(logType: String, logContent: JSONObject): void; onSEIMessageReceived?(remoteStreamKey: RemoteStreamKey, message: ByteBuffer): void; onSEIStreamUpdate?(remoteStreamKey: RemoteStreamKey, event: SEIStreamUpdateEvent): void; onLoginResult?(uid: String, errorCode: int, elapsed: int): void; onLogout?(reason: int): void; onServerParamsSetResult?(error: int): void; onGetPeerOnlineStatus?(peerUserId: String, status: int): void; onUserMessageReceivedOutsideRoom?(uid: String, message: String): void; onUserBinaryMessageReceivedOutsideRoom?(uid: String, message: ByteBuffer): void; onUserMessageSendResultOutsideRoom?(msgid: long, error: int): void; onServerMessageSendResult?(msgid: long, error: int, message: ByteBuffer): void; onNetworkDetectionResult?(type: NetworkDetectionLinkType, quality: int, rtt: int, lostRate: double, bitrate: int, jitter: int): void; onNetworkDetectionStopped?(reason: NetworkDetectionStopReason): void; onSimulcastSubscribeFallback?(event: RemoteStreamSwitch): void; onPerformanceAlarms?(mode: PerformanceAlarmMode, roomId: String, reason: PerformanceAlarmReason, data: SourceWantedData): void; onAudioFrameSendStateChanged?(roomId: String, user: RtcUser, state: FirstFrameSendState): void; onVideoFrameSendStateChanged?(roomId: String, user: RtcUser, state: FirstFrameSendState): void; onScreenVideoFrameSendStateChanged?(roomId: String, user: RtcUser, state: FirstFrameSendState): void; onAudioFramePlayStateChanged?(roomId: String, user: RtcUser, state: FirstFramePlayState): void; onVideoFramePlayStateChanged?(roomId: String, user: RtcUser, state: FirstFramePlayState): void; onScreenVideoFramePlayStateChanged?(roomId: String, user: RtcUser, state: FirstFramePlayState): void; onAudioDeviceStateChanged?(deviceID: String, deviceType: AudioDeviceType, deviceState: int, deviceError: int): void; onVideoDeviceStateChanged?(deviceID: String, deviceType: VideoDeviceType, deviceState: int, deviceError: int): void; onAudioDeviceWarning?(deviceID: String, deviceType: AudioDeviceType, deviceWarning: int): void; onVideoDeviceWarning?(deviceID: String, deviceType: VideoDeviceType, deviceWarning: int): void; onRecordingStateUpdate?(type: StreamIndex, state: RecordingState, errorCode: RecordingErrorCode, info: RecordingInfo): void; onRecordingProgressUpdate?(type: StreamIndex, progress: RecordingProgress, info: RecordingInfo): void; onAudioRecordingStateUpdate?(state: AudioRecordingState, errorCode: AudioRecordingErrorCode): void; onAudioMixingPlayingProgress?(mixId: int, progress: long): void; onLocalAudioPropertiesReport?(audioPropertiesInfos: Array): void; onAudioPlaybackDeviceTestVolume?(volume: int): void; onRemoteAudioPropertiesReport?(audioPropertiesInfos: Array, totalRemoteVolume: int): void; onActiveSpeaker?(roomId: String, uid: String): void; onStreamSyncInfoReceived?(streamKey: RemoteStreamKey, streamType: SyncInfoStreamType, data: ByteBuffer): void; onPushPublicStreamResult?(roomId: String, publicStreamId: String, error: PublicStreamErrorCode): void; onPlayPublicStreamResult?(publicStreamId: String, error: PublicStreamErrorCode): void; onPublicStreamSEIMessageReceived?(publicStreamId: String, message: ByteBuffer, sourceType: DataMessageSourceType): void; onPublicStreamDataMessageReceived?(publicStreamId: String, message: ByteBuffer, sourceType: DataMessageSourceType): void; onFirstPublicStreamVideoFrameDecoded?(publicStreamId: String, videoFrameInfo: VideoFrameInfo): void; onFirstPublicStreamAudioFrame?(publicStreamId: String): void; onEchoTestResult?(result: EchoTestResult): void; onCloudProxyConnected?(interval: int): void; onNetworkTimeSynchronized?(): void; onHardwareEchoDetectionResult?(hardwareEchoDetectionResult: HardwareEchoDetectionResult): void; onLocalProxyStateChanged?(localProxyType: LocalProxyType, localProxyState: LocalProxyState, localProxyError: LocalProxyError): void; onUserMuteAudio?(roomId: String, uid: String, muteState: MuteState): void; onUserMuteVideo?(roomId: String, uid: String, muteState: MuteState): void; onAudioPlaybackDeviceChanged?(device: AudioPlaybackDevice): void; onMediaDeviceStateChanged?(deviceID: String, deviceType: int, deviceState: int, deviceError: int): void; onMediaDeviceWarning?(deviceID: String, deviceType: int, deviceWarning: int): void; onHttpProxyState?(state: int): void; onHttpsProxyState?(state: int): void; onSocks5ProxyState?(state: int, cmd: String, proxyAddress: String, localAddress: String, remoteAddress: String): void; onAudioMixingStateChanged?(mixId: int, state: AudioMixingState, error: AudioMixingError): void; } export declare class ISnapshotResultCallback { onTakeLocalSnapshotResult?(taskId: long, streamIndex: StreamIndex, image: Bitmap, errorCode: int): void; onTakeRemoteSnapshotResult?(taskId: long, streamKey: RemoteStreamKey, image: Bitmap, errorCode: int): void; } export declare class IAudioFrameProcessor { onProcessRecordAudioFrame?(audioFrame: IAudioFrame): int; onProcessPlayBackAudioFrame?(audioFrame: IAudioFrame): int; onProcessRemoteUserAudioFrame?(streamKey: RemoteStreamKey, audioFrame: IAudioFrame): int; onProcessEarMonitorAudioFrame?(audioFrame: IAudioFrame): int; onProcessScreenAudioFrame?(audioFrame: IAudioFrame): int; }