412 lines
9.0 KiB
TypeScript
412 lines
9.0 KiB
TypeScript
declare namespace TUICallEngine {
|
|
/**
|
|
* create TUICallEngine instance
|
|
* @link https://web.sdk.qcloud.com/component/trtccalling/doc/TUICallEngine/web/TUICallEngine.html#.createInstance
|
|
*/
|
|
function createInstance(options: ITRTCCallingOptions): any;
|
|
/**
|
|
* destroy TUICallEngine instance
|
|
*/
|
|
function destroyInstance(): Promise<void>;
|
|
/**
|
|
* set log level
|
|
*/
|
|
function setLogLevel(level: LOG_LEVEL): void;
|
|
/**
|
|
* add event listener
|
|
*/
|
|
function on(eventName: string, callback: () => void, context?: any): void;
|
|
/**
|
|
* remove event listener
|
|
*/
|
|
function off(eventName: string, callback: () => void, context?: any): void;
|
|
/**
|
|
* init
|
|
*/
|
|
function init(params: ILoginParams): Promise<void>;
|
|
/**
|
|
* login interface. All functions require login before you can use them.
|
|
*/
|
|
function login(params: ILoginParams): Promise<any>;
|
|
/**
|
|
* logout interface
|
|
*/
|
|
function logout(): Promise<void>;
|
|
/**
|
|
* one-to-one audio/video call.
|
|
*/
|
|
function call(params: ICallParam): Promise<any>;
|
|
/**
|
|
* group call.
|
|
*/
|
|
function groupCall(params: IGroupCallParam): Promise<any>;
|
|
/**
|
|
* invite others.
|
|
*/
|
|
function inviteUser(params: IInviteUserParam): Promise<any>;
|
|
/**
|
|
* join in group call.
|
|
*/
|
|
function joinInGroupCall(params: IJoinInGroupCallParam): Promise<any>;
|
|
/**
|
|
* accept.
|
|
*/
|
|
function accept(): void;
|
|
/**
|
|
* reject.
|
|
*/
|
|
function reject(): void;
|
|
/**
|
|
* hangup.
|
|
*/
|
|
function hangup(): void;
|
|
/**
|
|
* openCamera to start local preview
|
|
*/
|
|
function openCamera(videoViewDomID: HTMLElement | string): Promise<any>;
|
|
/**
|
|
* closeCamera to stop local preview
|
|
*/
|
|
function closeCamera(): void;
|
|
/**
|
|
* start remote view
|
|
*/
|
|
function startRemoteView(params: IStartViewParam): Promise<any>;
|
|
/**
|
|
* stop remote view
|
|
*/
|
|
function stopRemoteView(params: IStopViewParam): Promise<any>;
|
|
/**
|
|
* open local microphone
|
|
*/
|
|
function openMicrophone(): void;
|
|
/**
|
|
* close local microphone
|
|
*/
|
|
function closeMicrophone(): void;
|
|
/**
|
|
* set video resolution: '480p' | '720p' | '1080p'
|
|
*/
|
|
function setVideoQuality(profile: string): Promise<any>;
|
|
/**
|
|
* set video render parameters
|
|
*/
|
|
function setVideoRenderParams(params: ITRTCRenderParams): Promise<any>;
|
|
/**
|
|
* switch call media type: 1 - audio; 2 - video
|
|
*/
|
|
function switchCallMediaType (newMediaType:number): Promise<any>;
|
|
/**
|
|
* get device lists, deviceType: 'camera' | 'microphones'
|
|
*/
|
|
function getDeviceList(deviceType:string): Promise<[]>;
|
|
/**
|
|
* switch device
|
|
*/
|
|
function switchDevice(params: ISwitchDeviceParams): Promise<any>;
|
|
/**
|
|
* set self userInfo
|
|
*/
|
|
function setSelfInfo(params: ISelfInfoParams): Promise<any>;
|
|
/**
|
|
* enable/disable AI voice
|
|
*/
|
|
function enableAIVoice(enable: boolean): void;
|
|
}
|
|
export enum TUICallEvent {
|
|
ERROR = 'onError',
|
|
SDK_READY= 'sdkReady',
|
|
INVITED= 'onInvited',
|
|
USER_ACCEPT= 'onUserAccept',
|
|
USER_ENTER= 'onUserEnter',
|
|
USER_LEAVE= 'onUserLeave',
|
|
REJECT= 'onReject',
|
|
NO_RESP= 'onNoResp',
|
|
LINE_BUSY= 'onLineBusy',
|
|
CALLING_CANCEL= 'onCallingCancel',
|
|
KICKED_OUT= 'onKickedOut',
|
|
CALLING_TIMEOUT= 'onCallingTimeout',
|
|
CALL_END= 'onCallEnd',
|
|
CALLING_END= 'onCallEnd',
|
|
USER_VIDEO_AVAILABLE= 'onUserVideoAvailable',
|
|
USER_AUDIO_AVAILABLE= 'onUserAudioAvailable',
|
|
USER_VOICE_VOLUME= 'onUserVoiceVolume',
|
|
GROUP_CALL_INVITEE_LIST_UPDATE= 'onGroupCallInviteeListUpdate',
|
|
CALL_TYPE_CHANGED= 'onCallTypeChanged',
|
|
DEVICED_UPDATED= 'onDeviceUpdated',
|
|
MESSAGE_SENT_BY_ME= 'onMessageSentByMe',
|
|
ON_CALL_BEGIN= 'onCallBegin',
|
|
ON_CALL_RECEIVED= 'onCallReceived',
|
|
ON_CALL_CANCELED= 'onCallCanceled',
|
|
ON_USER_NETWORK_QUALITY_CHANGED= 'onUserNetworkQualityChanged',
|
|
}
|
|
export enum TUICallType {
|
|
AUDIO_CALL = 1,
|
|
VIDEO_CALL = 2,
|
|
DEVCIED_CAMERA= 'camera',
|
|
DEVCIED_MICROPHONES= 'microphones',
|
|
}
|
|
export enum TUICallCameraPosition {
|
|
FRONT = 0,
|
|
BACK = 1,
|
|
}
|
|
export interface ITRTCCallingOptions {
|
|
SDKAppID: number;
|
|
tim?: any;
|
|
}
|
|
export interface ILoginParams {
|
|
userID: string;
|
|
userSig: string;
|
|
assetsPath?: string;
|
|
}
|
|
export interface ICallParam {
|
|
userID: string;
|
|
type: CALL_TYPE;
|
|
timeout?: number;
|
|
offlinePushInfo?: OfflinePushInfo;
|
|
roomID?: number;
|
|
userData?: string;
|
|
}
|
|
export enum CALL_TYPE {
|
|
UNKNOWN = 0,
|
|
AUDIO_CALL = 1,
|
|
VIDEO_CALL = 2
|
|
}
|
|
export interface OfflinePushInfo {
|
|
title?: string,
|
|
description?: string,
|
|
androidOPPOChannelID?: string,
|
|
extension: String
|
|
}
|
|
export interface IGroupCallParam {
|
|
userIDList: string[];
|
|
type: CALL_TYPE;
|
|
groupID: string;
|
|
timeout?: number;
|
|
offlinePushInfo?: OfflinePushInfo;
|
|
roomID?: number;
|
|
userData?: string;
|
|
}
|
|
export interface IJoinInGroupCallParam {
|
|
type: CALL_TYPE;
|
|
groupID: string;
|
|
roomID: number;
|
|
}
|
|
export interface IInviteUserParam {
|
|
userIDList: string[];
|
|
offlinePushInfo?: OfflinePushInfo;
|
|
}
|
|
export interface IStopViewParam {
|
|
userID: string;
|
|
}
|
|
export declare const CMD_TYPE_LIST: string[];
|
|
export declare enum CMD_TYPE {
|
|
AUDIO_CALL = "audioCall",
|
|
VIDEO_CALL = "videoCall",
|
|
HANG_UP = "hangup",
|
|
SWITCH_TO_AUDIO = "switchToAudio",
|
|
SWITCH_TO_AUDIO_CALL = "switch_to_audio_call",
|
|
SWITCH_TO_VIDEO = "switchToVideo"
|
|
}
|
|
export declare enum CALL_STATUS {
|
|
IDLE = "idle",
|
|
CALLING = "calling",
|
|
CONNECTED = "connected"
|
|
}
|
|
export declare enum CALL_ROLE {
|
|
UNKNOWN = "",
|
|
INVITER = "inviter",
|
|
INVITEE = "invitee"
|
|
}
|
|
export declare enum ACTION_TYPE {
|
|
INVITE = 1,
|
|
CANCEL_INVITE = 2,
|
|
ACCEPT_INVITE = 3,
|
|
REJECT_INVITE = 4,
|
|
INVITE_TIMEOUT = 5
|
|
}
|
|
export declare enum BUSINESS_ID {
|
|
SIGNAL = 1
|
|
}
|
|
export declare const VALID_VIDEO_PROFILE_LIST: string[];
|
|
export declare enum MODE_TYPE {
|
|
AUDIO = "audio",
|
|
VIDEO = "video"
|
|
}
|
|
export declare enum LOG_LEVEL {
|
|
NORMAL = 0,
|
|
RELEASE = 1,
|
|
WARNING = 2,
|
|
ERROR = 3,
|
|
NONE = 4,
|
|
}
|
|
export interface ISwitchDeviceParams {
|
|
deviceType: 'video' | 'audio';
|
|
deviceId: string;
|
|
}
|
|
export declare enum CALL_EXPERMENTEL_API_TYPE {
|
|
BASE,
|
|
PRO,
|
|
ULTIMATE
|
|
}
|
|
export declare enum DEVICE_TYPE {
|
|
AUDIO = "audio",
|
|
VIDEO = "video",
|
|
CAMERA = "camera",
|
|
MICROPHONES = "microphones"
|
|
}
|
|
export interface ISelfInfoParams {
|
|
nickName?: string;
|
|
avatar?: string;
|
|
}
|
|
export interface IGenerateCallEndDataParams {
|
|
roomId?: number;
|
|
callMediaType?: CALL_TYPE;
|
|
callRole?: CALL_ROLE;
|
|
totalTime?: number;
|
|
userId?: string;
|
|
}
|
|
export interface ITRTCRenderParams {
|
|
userID?: string;
|
|
objectFit?: string;
|
|
muted?: boolean;
|
|
mirror?: boolean;
|
|
}
|
|
export interface IOnCallEndData {
|
|
roomID: number;
|
|
callMediaType: CALL_TYPE;
|
|
callRole: CALL_ROLE;
|
|
callEnd?: number;
|
|
totalTime: number;
|
|
userID: string;
|
|
}
|
|
export interface ITRTCClientOptions {
|
|
sdkAppID: number;
|
|
userID: string;
|
|
userSig: string;
|
|
tuiCallEngine: any;
|
|
assetsPath?: string;
|
|
}
|
|
export interface IPlayVideoOptions {
|
|
objectFit?: string;
|
|
muted?: boolean;
|
|
mirror?: boolean;
|
|
}
|
|
export interface IPlayVideoParams {
|
|
domID: string;
|
|
type: 'local' | 'remote';
|
|
userID: string;
|
|
options?: IPlayVideoOptions;
|
|
}
|
|
export interface IStopVideoParams {
|
|
type: 'local' | 'remote';
|
|
userID: string;
|
|
}
|
|
export interface IStartViewParam {
|
|
userID: string;
|
|
videoViewDomID: string;
|
|
options?: IPlayVideoOptions;
|
|
}
|
|
export interface IHangupParams {
|
|
userIDList: string[];
|
|
callType: CALL_TYPE;
|
|
callEnd?: number;
|
|
}
|
|
export interface IInviteeAcceptedParams {
|
|
name: string;
|
|
data: {
|
|
invitee: string;
|
|
inviteID: string;
|
|
inviter: string;
|
|
groupID: string;
|
|
data: string;
|
|
};
|
|
}
|
|
export interface ITSignalClientOptions {
|
|
SDKAppID: number;
|
|
tim?: any;
|
|
isRejectNotifyAll?: boolean;
|
|
}
|
|
export interface IInvitationReceivedParams {
|
|
data: {
|
|
inviter: string;
|
|
inviteeList: string[];
|
|
data: string;
|
|
inviteID: string;
|
|
groupID: string;
|
|
inCallUserIDs: string[];
|
|
};
|
|
}
|
|
export interface IInviteeRejectedParams {
|
|
data: {
|
|
inviteID: string;
|
|
inviter: string;
|
|
groupID: string;
|
|
invitee: string;
|
|
data: string;
|
|
};
|
|
}
|
|
export interface IInvitationCancelledParams {
|
|
data: {
|
|
inviteID: string;
|
|
inviter: string;
|
|
groupID: string;
|
|
data: string;
|
|
};
|
|
}
|
|
export interface InvitationTimeoutParams {
|
|
data: {
|
|
inviter: string;
|
|
inviteeList: string[];
|
|
inviteID: string;
|
|
groupID: string;
|
|
isSelfTimeout: boolean;
|
|
};
|
|
}
|
|
export interface ILoginParams {
|
|
userID: string;
|
|
userSig: string;
|
|
assetsPath?: string;
|
|
}
|
|
export interface IInviteParams {
|
|
userID: string;
|
|
type: CALL_TYPE;
|
|
roomId: number;
|
|
strRoomId: string;
|
|
timeout: number;
|
|
offlinePushInfo?: OfflinePushInfo;
|
|
userIDList?: string[];
|
|
userData?: string;
|
|
}
|
|
export interface IInviteInGroupParams {
|
|
groupID: string;
|
|
userIDList: string[];
|
|
roomID: number;
|
|
strRoomId: string;
|
|
type: CALL_TYPE;
|
|
timeout: number;
|
|
inCallUserIDs?: string[];
|
|
offlinePushInfo?: OfflinePushInfo;
|
|
userData?: string;
|
|
}
|
|
export interface IAcceptParams {
|
|
inviteID: string;
|
|
callType: CALL_TYPE;
|
|
switch_to_audio_call?: string;
|
|
}
|
|
export interface IRejectParams {
|
|
inviteID: string;
|
|
callType: CALL_TYPE;
|
|
isBusy: boolean;
|
|
}
|
|
export interface ICancelParams {
|
|
inviteID: string;
|
|
}
|
|
export interface ISwitchParams {
|
|
userID: string;
|
|
callType: CALL_TYPE;
|
|
roomID: number;
|
|
timeout: number;
|
|
mode: MODE_TYPE;
|
|
}
|