@zegocloud/zego-uikit-prebuilt-call-mini-program
Version:
zegocloud prebuilt meeting rtc sdk
355 lines (354 loc) • 9.3 kB
TypeScript
/**
* 通话状态枚举
*/
export declare enum CallStatus {
/**
* 未开始
*/
NONE = 0,
/**
* 申请通话中
*/
InApply = 1,
/**
* 等待接听
*/
WaitCall = 2,
/**
* 通话中
*/
Calling = 3,
/**
* 结束通话
*/
EndCall = 4,
/**
* 主动取消通话
*/
CancelCall = 5,
/**
* 被取消通话
*/
CancelledCall = 6,
/**
* 主动拒绝通话
*/
RefuseCall = 7,
/**
* 被拒绝通话
*/
RejectedCall = 8,
/**
* 邀请者接受到超时回调
*/
CallTimeoutInviter = 9,
/**
* 被邀请者接受到超时回调
*/
CallTimeoutInvitee = 10,
/**
* 杀进程、退后台、切换标签等触发的页面隐藏
*/
HiddenPage = 11,
/**
* 主动挂断 (结束呼叫)
*/
HangUp = 12,
/**
* 被挂断
*/
HangedUp = 13,
/**
* 远端异常退出
*/
RemoteAbnormalExit = 14
}
export interface PushConfig {
streamID?: string;
url?: string;
pusherContext?: any;
mode?: 'SD' | 'HD' | 'FHD' | 'RTC';
autopush?: boolean;
enableCamera?: boolean;
enableMic?: boolean;
enableAgc?: boolean;
enableAns?: boolean;
enableEarMonitor?: boolean;
enableAutoFocus?: boolean;
enableZoom?: boolean;
minBitrate?: number;
maxBitrate?: number;
videoWidth?: number;
videoHeight?: number;
beautyLevel?: number;
whitenessLevel?: number;
videoOrientation?: 'vertical' | 'horizontal';
videoAspect?: '3:4' | '9:16';
frontCamera?: boolean;
enableRemoteMirror?: boolean;
localMirror?: boolean;
enableBackgroundMute?: boolean;
audioQuality?: number;
audioVolumeType?: number;
audioReverbType?: number;
waitingImage?: string;
beautyStyle?: string;
filter?: string;
fps?: number;
}
export interface PlayConfig {
streamID?: string;
playerContext?: any;
url?: string;
mode?: 'live' | 'RTC';
autoplay?: boolean;
muteAudio?: boolean;
muteVideo?: boolean;
orientation?: string;
objectFit?: string;
minCache?: number;
maxCache?: number;
soundMode?: string;
enableRecvMessage?: boolean;
autoPauseIfNavigate?: boolean;
autoPauseIfOpenNative?: boolean;
enableMetadata?: boolean;
}
export declare enum ZIMCallUserState {
Unknown = -1,
Inviting = 0,
Accepted = 1,
Rejected = 2,
Cancelled = 3,
Received = 5,
Timeout = 6,
Quit = 7,
Ended = 8,
NotYetReceived = 9,
BeCancelled = 10
}
/**
* 用户信息接口,用于描述房间内的用户状态。
*/
export interface ZegoUIKitUser {
userID: string;
userName?: string;
avatar?: string;
isCameraOn?: boolean;
isMicrophoneOn?: boolean;
streamConfig?: any;
mainStreamID?: string;
shareStreamID?: string;
soundLevel?: number;
attributes?: Record<string, string>;
}
/**
* 呼叫邀请相关监听接口,用于监听呼叫邀请的状态变化。
*/
export interface ZegoCallInvitationListener {
onCallInvitationCreated?: (callID: string, extendedData: string) => void;
onCallInvitationAccepted?: (callID: string, callerID: string, calleeID: string) => void;
onCallInvitationRefused?: (callID: string, callerID: string, calleeID: string, extendedData: string) => void;
onCallInvitationCancelled?: (callID: string, caller: ZegoUIKitUser, extendedData: string) => void;
onCallInvitationReceived?: (callID: string, extendedData: string) => void;
onCallInvitationTimeoutofInviter?: (callID: string, calleeID: string, extendedData?: string) => void;
onCallInvitationTimeoutofInvitee?: (callID: string, caller: ZegoUIKitUser) => void;
onZIMTokenWillExpire?: () => void;
onCallEnded?: () => void;
onZIMConnectionStateChanged?: (state: number) => void;
}
export interface ZegoUIKitListener {
onLocalUserUpdated?: (user: ZegoUIKitUser) => void;
onUserLeaved?: (user: ZegoUIKitUser) => void;
onUserListUpdated?: (userList: ZegoUIKitUser[]) => void;
onReconnected?: () => void;
}
export declare enum ScenarioModel {
SINGLE_CALL = 0,// 1v1 单聊
GROUP_CALL = 1
}
export interface ZegoUIKitConfig {
/**
* 默认是否启用摄像头,默认值为启用
*/
turnOnCameraWhenJoining?: boolean;
/**
* 默认是否启用麦克风,默认为启用
*/
turnOnMicrophoneWhenJoining?: boolean;
/**
* 呼叫模式
*/
mode?: ZegoUIKitScenario;
/**
* token 过期回调
*/
onTokenWillExpire?: (roomID: string) => void;
}
export declare enum ZegoUIKitScenario {
SINGLE_CALL = 0,// 1v1 单聊
GROUP_CALL = 1,// 群聊
CALL_INVITATION = 2
}
export declare enum Language {
ZH = "zh",
EN = "en"
}
export interface ZegoPrebuiltAudioVideoViewConfig {
/**
* 控制是否在 VideoView 上显示预制层的默认 MicrophoneStateIcon。
*/
showMicrophoneStateOnView: boolean;
/**
* 控制是否在 VideoView 上显示预制层的默认 CameraStateIcon。
*/
showCameraStateOnView: boolean;
/**
* 控制是否在 VideoView 上显示预制层的默认 UserNameLabel。
*/
showUserNameOnView: boolean;
/**
* 在语音模式下是否显示头像周围的声浪。
*/
showSoundWavesInAudioMode: boolean;
}
export interface ZegoBottomMenuBarConfig {
/**
* 需要在 MenuBar 上显示的按钮,按照实际 List 的顺序显示。
*/
/**
* MenuBar 上可以显示的按钮的最大数量,最多为 5个。如果超过这个值,则会显示“更多”按钮。注意,这个值包含了“更多”按钮。
*/
/**
* 5 秒内没有操作屏幕,或者用户点击屏幕非响应区域的位置,顶部和底部会自动收起。
*/
hideAutomatically: boolean;
/**
* 用户是否可以点击屏幕非响应区域的位置,并收起顶部和底部。
*/
/**
* MenuBar 显示颜色,有高亮和暗色两种。
*/
/**
* MenuBar按钮配置,使用此配置来改变按钮的图标。
*/
buttonConfig: ZegoMenuBarButtonConfig;
}
export interface ZegoMemberListConfig {
/**
* 是否显示麦克风的状态图标,默认值为 true。
*/
showMicrophoneState: boolean;
/**
* 是否显示摄像头的状态图标,默认值为 true。
*/
showCameraState: boolean;
/**
* 自定义成员列表视图。
*/
memberListItemProvider?: any;
}
export interface ZegoTopMenuBarConfig {
/**
* 需要在 MenuBar 上显示的按钮,按照实际 List 的顺序显示。
*/
buttons: string[];
/**
* 5 秒内没有操作屏幕,或者用户点击屏幕非响应区域的位置,顶部和底部会自动收起。
*/
hideAutomatically: boolean;
/**
* 用户是否可以点击屏幕的非响应区域来收起顶部和底部的菜单栏。
*/
hideByClick: boolean;
/**
* MenuBar 的显示颜色,有两种风格:高亮和暗色。
*/
style: string;
/**
* 是否可见,默认值为 false。
*/
isVisible: boolean;
/**
* MenuBar 按钮配置,使用此配置修改按钮的图标。
*/
buttonConfig: ZegoMenuBarButtonConfig;
}
export interface ZegoCallDurationConfig {
/**
* 是否显示通话时间时长,默认值为 true。
*/
isVisible: boolean;
/**
* 通话时长更新的回调。
*/
durationUpdateListener?: () => void;
}
export interface ZegoMenuBarButtonConfig {
/**
* 自定义摄像头开启状态的按钮图标。
*/
toggleCameraOnImage: string;
/**
* 自定义摄像头关闭状态的按钮图标。
*/
toggleCameraOffImage: string;
/**
* 自定义麦克风开启状态的按钮图标。
*/
toggleMicrophoneOnImage: string;
/**
* 自定义麦克风关闭状态的按钮图标。
*/
toggleMicrophoneOffImage: string;
/**
* 自定义挂断按钮的图标。
*/
hangUpButtonImage: string;
/**
* 自定义切换至前置摄像头的按钮图标。
*/
switchCameraFrontImage: string;
/**
* 自定义切换至后置摄像头的按钮图标。
*/
switchCameraBackImage: string;
}
export interface LayoutConfig {
/**
* 通话页面音视频窗口显示样式,包括画中画布局、流式布局
*/
layoutType: 'picture-in-picture' | 'streaming';
}
export interface HangUpConfirmDialogInfo {
/**
* 是否显示离开房间的对话框信息。
*/
showDialog: boolean;
/**
* 对话框信息内容。
*/
dialogMessage?: string;
}
export interface InRoomChatConfig {
/**
* 房间内聊天的标题。
*/
chatTitle: string;
/**
* 房间内聊天的输入提示。
*/
inputPlaceholder: string;
}
export interface VideoConfig {
/**
* 通话视频的分辨率,默认值为 360p。
*/
resolution: string;
}
export interface ZegoAvatarViewProvider {
/**
* 自定义用户头像。
*/
getAvatar: (userId: string) => string;
}