TRTCCalling
is an open-source class based on two closed-source SDKs: Tencent Cloud Real-Time Communication (TRTC) and Instant Messaging (IM). It supports one-to-one and group audio calls. For detailed instructions how to implement it, see Real-Time Audio Call (Android).
TUICalling
API OverviewAPI | Description |
---|---|
sharedInstance | Gets a singleton. |
call | Sends call invitations by user ID. |
receiveAPNSCalled | Answers a call. |
setCallingListener | Sets the listener. |
setCallingBell | Sets the ringtone (preferably shorter than 30s). |
enableMuteMode | Enables/Disables the mute mode. |
enableCustomViewRoute | Enables/Disables custom views. |
TUICallingListener
API OverviewAPI | Description |
---|---|
shouldShowOnCallView | Callback of whether the answering view is displayed when there is an incoming call |
onCallStart | Callback for starting calling. This callback is triggered for both callers and callees. |
onCallEnd | Callback for ending a call. This callback is triggered for both callers and callees. |
onCallEvent | Call event callback |
Enumerated Type | Description |
---|---|
AUDIO | Audio call |
VIDEO | Video call |
Enumerated Type | Description |
---|---|
CALL | Caller |
CALLED | Callee |
Enumerated Type | Description |
---|---|
CALL_START | The call started. |
CALL_SUCCEED | The call was connected successfully. |
CALL_END | The call ended. |
CALL_FAILED | The call failed. |
This API is used to get a singleton of the TUICalling
component.
public static TUICallingManager sharedInstance();
This API is used to send call invitations by user ID.
void call(String[] userIDs, Type type);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userIDs | String[] | List of the user IDs of call participants |
type | TUICalling.Type | Call type: audio/video |
This API is used to answer a call.
void receiveAPNSCalled(String[] userIDs, Type type);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userIDs | String[] | List of the user IDs of call participants |
type | TUICalling.Type | Call type: audio/video |
This API is used to set the listener.
void setCallingListener(TUICallingListener listener);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
listener | TUICallingListener | Listener of the TUIcalling component |
This API is used to set the ringtone (preferably shorter than 30s).
void setCallingBell(String filePath);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
filePath | String | Path of the ringtone file |
This API is used to enable/disable the mute mode.
void enableMuteMode(boolean enable);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
enable | boolean | Whether to enable the mute mode |
This API is used to enable/disable custom views.
After enabling custom views, you will receive a CallingView
instance in the callback for calling/being called, and can decide how to display the view by yourself.
Note:The view must be displayed full screen or in proportion to the screen size; otherwise, an error may occur.
void enableCustomViewRoute(boolean enable);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
enable | boolean | Whether to enable custom views |
TUICallingListener
Callback APIsCallback of whether the answering view is displayed when there is an incoming call.
boolean shouldShowOnCallView();
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
Return value | boolean | Whether the answering view is displayed |
Callback for starting calling, which is triggered for both callers and callees.
void onCallStart(String[] userIDs, TUICalling.Type type, TUICalling.Role role, View tuiCallingView);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userIDs | String[] | List of the user IDs of call participants |
type | TUICalling.Type | Call type: audio/video |
role | TUICalling.Role | Role type: caller/callee |
tuiCallingView | View | Calling view. When enableCustomViewRoute is false , view is null. |
Callback for ending a call, which is triggered for both callers and callees.
void onCallEnd(String[] userIDs, TUICalling.Type type, TUICalling.Role role, long totalTime);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
userIDs | String[] | List of the user IDs of call participants |
type | TUICalling.Type | Call type: audio/video |
role | TUICalling.Role | Role type: caller/callee |
totalTime | long | Call duration (s) |
Call event callback.
void onCallEvent(TUICalling.Event event, TUICalling.Type type, TUICalling.Role role, String message);
The parameters are as detailed below:
Parameter | Type | Description |
---|---|---|
event | TUICalling.Event | Call event type |
type | TUICalling.Type | Call type: audio/video |
role | TUICalling.Role | Role type: caller/callee |
message | String | Event description |
Was this page helpful?