Atomic X Core API
🚀 AtomicX Core API
Tencent Real-Time Communication SDK Core API Documentation
📋 Overview
AtomicX Core API is an SDK designed based on state management patterns. It manages business logic for each module through Store classes, and each Store provides a corresponding State data class to subscribe to state changes.
🏗️ API Overview
| Module | Store | State | Description |
|---|---|---|---|
| Login | LoginStore | LoginState | User login, logout, profile management |
| Call | CallStore | CallState | Audio and video calling |
| Live | LiveListStore | LiveListState | Live room list management |
| LiveAudienceStore | LiveAudienceState | Audience state management | |
| LiveSeatStore | LiveSeatState | Seat management | |
| CoGuestStore | CoGuestState | Audience co-streaming management | |
| CoHostStore | CoHostState | Host co-streaming management | |
| BattleStore | BattleState | PK battle management | |
| LikeStore | LikeState | Like management | |
| Room | RoomStore | RoomState | Room management |
| RoomParticipantStore | RoomParticipantState | Room participant management | |
| Barrage | BarrageStore | BarrageState | Barrage message management |
| Gift | GiftStore | GiftState | Gift sending and receiving |
| Device | DeviceStore | DeviceState | Camera, microphone management |
| AudioEffectStore | AudioEffectState | Audio effect management | |
| BaseBeautyStore | BaseBeautyState | Basic beauty management |
🔐 Login Module
LoginStore
Core class for login management, responsible for user login, logout, and profile settings.
Core APIs:
| Method | Description |
|---|---|
| login | User login |
| logout | User logout |
| setSelfInfo | Set profile information |
| addLoginListener | Add login listener |
| removeLoginListener | Remove login listener |
State Subscription (LoginState):
| Property | Type | Description |
|---|---|---|
| loginStatus | StateFlow<LoginStatus> | Login status |
| loginUserInfo | StateFlow<UserProfile?> | Current logged-in user info |
Related Types: LoginStatus | UserProfile | Gender | AllowType | LoginListener
📞 Call Module
CallStore
Core class for call management, responsible for initiating, answering, rejecting, hanging up calls, group call management, and call history management.
Core APIs:
| Method | Description |
|---|---|
| calls | Initiate a call |
| accept | Answer a call |
| reject | Reject a call |
| hangup | Hang up a call |
| join | Join a group call |
| invite | Invite users to join a call |
| queryRecentCalls | Query call history |
| deleteRecentCalls | Delete call records |
| addListener | Add call listener |
| removeListener | Remove call listener |
State Subscription (CallState):
| Property | Type | Description |
|---|---|---|
| activeCall | StateFlow<CallInfo> | Current active call info |
| recentCalls | StateFlow<LinkedHashSet<CallInfo>> | Call history list |
| cursor | StateFlow<String> | Pagination cursor |
| selfInfo | StateFlow<CallParticipantInfo> | Current user info |
| allParticipants | StateFlow<LinkedHashSet<CallParticipantInfo>> | All participants list |
| speakerVolumes | StateFlow<MutableMap<String, Int>> | Participant volume info |
| networkQualities | StateFlow<MutableMap<String, NetworkQuality>> | Participant network quality |
Related Types: CallMediaType | CallEndReason | CallDirection | CallParticipantStatus | CallParams | CallParticipantInfo | CallInfo | CallListener
📺 Live Module
CoGuestStore
Audience co-streaming management, handles co-streaming requests, invitations, acceptance, and rejection between hosts and audiences.
Core APIs:
| Method | Description |
|---|---|
| applyForSeat | Apply to take seat |
| cancelApplication | Cancel application |
| acceptApplication | Accept application |
| rejectApplication | Reject application |
| inviteToSeat | Invite to take seat |
| cancelInvitation | Cancel invitation |
| acceptInvitation | Accept invitation |
| rejectInvitation | Reject invitation |
| disconnect | Disconnect co-streaming |
| addHostListener | Add host-side listener |
| removeHostListener | Remove host-side listener |
| addGuestListener | Add guest-side listener |
| removeGuestListener | Remove guest-side listener |
State Subscription (CoGuestState):
| Property | Type | Description |
|---|---|---|
| connected | StateFlow<List<SeatUserInfo>> | Connected users list |
| invitees | StateFlow<List<LiveUserInfo>> | Users invited by host |
| applicants | StateFlow<List<LiveUserInfo>> | Users applying to co-stream |
| candidates | StateFlow<List<LiveUserInfo>> | Co-streaming candidate users |
Related Types: HostListener | GuestListener | NoResponseReason | SeatUserInfo | LiveUserInfo
CoHostStore
Host co-streaming management, handles cross-room co-streaming between hosts.
Core APIs:
| Method | Description |
|---|---|
| requestConnection | Request connection |
| cancelRequest | Cancel request |
| acceptConnection | Accept connection |
| rejectConnection | Reject connection |
| disconnect | Disconnect |
State Subscription (CoHostState):
| Property | Type | Description |
|---|---|---|
| connectedUsers | StateFlow<List<LiveUserInfo>> | Connected hosts list |
| sentConnectionRequests | StateFlow<List<LiveUserInfo>> | Sent connection requests |
| receivedConnectionRequests | StateFlow<List<LiveUserInfo>> | Received connection requests |
BattleStore
PK battle management, handles PK battle logic between hosts.
Core APIs:
| Method | Description |
|---|---|
| requestBattle | Request PK battle |
| cancelRequest | Cancel request |
| acceptBattle | Accept PK battle |
| rejectBattle | Reject PK battle |
| exitBattle | Exit PK battle |
State Subscription (BattleState):
| Property | Type | Description |
|---|---|---|
| isBattling | StateFlow<Boolean> | Whether in PK battle |
| battleUsers | StateFlow<List<BattleUserInfo>> | PK battle users list |
| sentBattleRequests | StateFlow<List<LiveUserInfo>> | Sent PK requests |
| receivedBattleRequests | StateFlow<List<LiveUserInfo>> | Received PK requests |
LiveSeatStore
Seat management, controls seat status in live rooms.
Core APIs:
| Method | Description |
|---|---|
| takeSeat | Take seat |
| leaveSeat | Leave seat |
| lockSeat | Lock seat |
| kickUserOffSeat | Kick user off seat |
State Subscription (LiveSeatState):
| Property | Type | Description |
|---|---|---|
| seatList | StateFlow<List<SeatInfo>> | Seat list |
LiveListStore
Live room list management.
Core APIs:
| Method | Description |
|---|---|
| fetchLiveList | Fetch live list |
| fetchRecommendedList | Fetch recommended list |
State Subscription (LiveListState):
| Property | Type | Description |
|---|---|---|
| liveList | StateFlow<List<LiveInfo>> | Live list |
LiveAudienceStore
Audience state management.
Core APIs:
| Method | Description |
|---|---|
| joinLive | Join live room |
| leaveLive | Leave live room |
State Subscription (LiveAudienceState):
| Property | Type | Description |
|---|---|---|
| liveInfo | StateFlow<LiveInfo?> | Current live info |
LikeStore
Like management.
Core APIs:
| Method | Description |
|---|---|
| like | Send like |
State Subscription (LikeState):
| Property | Type | Description |
|---|---|---|
| likeCount | StateFlow<Int> | Like count |
🏠 Room Module
RoomStore
Core class for room management, responsible for room creation, joining, leaving, and scheduling.
Core APIs:
| Method | Description |
|---|---|
| createAndJoinRoom | Create and join room |
| joinRoom | Join room |
| leaveRoom | Leave room |
| endRoom | End room |
| scheduleRoom | Schedule room |
| cancelScheduledRoom | Cancel scheduled room |
| callUserToRoom | Call user to join room |
| acceptCall | Accept call |
| rejectCall | Reject call |
| addRoomListener | Add room listener |
| removeRoomListener | Remove room listener |
State Subscription (RoomState):
| Property | Type | Description |
|---|---|---|
| currentRoom | StateFlow<RoomInfo?> | Current room info |
| scheduledRoomList | StateFlow<List<RoomInfo>> | Scheduled room list |
Related Types: RoomStatus | RoomInfo | RoomUser | RoomCall | RoomListener
RoomParticipantStore
Room participant management, handles participant permissions, device control, message muting, etc.
Core APIs:
| Method | Description |
|---|---|
| getParticipantList | Get participant list |
| transferOwner | Transfer owner |
| setAdmin | Set admin |
| revokeAdmin | Revoke admin |
| kickUser | Kick user |
| closeParticipantDevice | Close participant device |
| disableAllDevices | Disable all devices |
| disableAllMessages | Mute all messages |
| requestToOpenDevice | Request to open device |
| inviteToOpenDevice | Invite to open device |
State Subscription (RoomParticipantState):
| Property | Type | Description |
|---|---|---|
| participantList | StateFlow<List<RoomParticipant>> | Participant list |
| participantListWithVideo | StateFlow<List<RoomParticipant>> | Participants with video |
| participantWithScreen | StateFlow<RoomParticipant?> | Participant sharing screen |
| localParticipant | StateFlow<RoomParticipant?> | Local participant |
| pendingDeviceApplications | StateFlow<List<DeviceRequestInfo>> | Pending device applications |
Related Types: ParticipantRole | RoomParticipant | DeviceRequestInfo | RoomParticipantListener
💬 Barrage Module
BarrageStore
Core class for barrage management, responsible for sending and syncing barrage messages.
Core APIs:
| Method | Description |
|---|---|
| sendTextMessage | Send text barrage |
| sendCustomMessage | Send custom barrage |
| appendLocalTip | Append local tip message |
State Subscription (BarrageState):
| Property | Type | Description |
|---|---|---|
| messageList | StateFlow<List<Barrage>> | Barrage message list |
Related Types: Barrage | BarrageType
🎁 Gift Module
GiftStore
Core class for gift management, handles gift sending and receiving.
Core APIs:
| Method | Description |
|---|---|
| sendGift | Send gift |
| refreshUsableGifts | Refresh available gifts list |
| setLanguage | Set gift info display language |
| addGiftListener | Add gift event listener |
| removeGiftListener | Remove gift event listener |
State Subscription (GiftState):
| Property | Type | Description |
|---|---|---|
| usableGifts | StateFlow<List<GiftCategory>> | Available gift categories |
Related Types: Gift | GiftCategory | GiftListener
📱 Device Module
DeviceStore
Core class for device management, controls hardware devices like camera and microphone.
Core APIs:
| Method | Description |
|---|---|
| openLocalMicrophone | Open microphone |
| closeLocalMicrophone | Close microphone |
| openLocalCamera | Open camera |
| closeLocalCamera | Close camera |
| switchCamera | Switch front/back camera |
| switchMirror | Switch mirror mode |
| updateVideoQuality | Update video quality |
| setAudioRoute | Set audio route |
| setCaptureVolume | Set capture volume |
| setOutputVolume | Set output volume |
| startScreenShare | Start screen sharing |
| stopScreenShare | Stop screen sharing |
| startCameraTest | Start camera test |
| stopCameraTest | Stop camera test |
State Subscription (DeviceState):
| Property | Type | Description |
|---|---|---|
| microphoneStatus | StateFlow<DeviceStatus> | Microphone status |
| microphoneLastError | StateFlow<DeviceError> | Microphone error |
| cameraStatus | StateFlow<DeviceStatus> | Camera status |
| cameraLastError | StateFlow<DeviceError> | Camera error |
| isFrontCamera | StateFlow<Boolean> | Is front camera |
| localMirrorType | StateFlow<MirrorType> | Local mirror type |
| localVideoQuality | StateFlow<VideoQuality> | Local video quality |
| currentAudioRoute | StateFlow<AudioRoute> | Current audio route |
| screenStatus | StateFlow<DeviceStatus> | Screen sharing status |
| networkInfo | StateFlow<NetworkInfo> | Network info |
| captureVolume | StateFlow<Int> | Capture volume |
| outputVolume | StateFlow<Int> | Output volume |
| currentMicVolume | StateFlow<Int> | Current mic volume |
Related Types: DeviceType | DeviceStatus | DeviceError | AudioRoute | VideoQuality | MirrorType | NetworkQuality | NetworkInfo
AudioEffectStore
Audio effect management, provides voice changer, reverb and other audio effects.
State Subscription (AudioEffectState):
| Property | Type | Description |
|---|---|---|
| changerType | StateFlow<AudioChangerType> | Voice changer type |
| reverbType | StateFlow<AudioReverbType> | Reverb type |
| musicVolume | StateFlow<Int> | Music volume |
| voiceVolume | StateFlow<Int> | Voice volume |
| voicePitch | StateFlow<Double> | Voice pitch |
Related Types: AudioChangerType | AudioReverbType
BaseBeautyStore
Basic beauty management, provides whitening, smoothing and other beauty features.
State Subscription (BaseBeautyState):
| Property | Type | Description |
|---|---|---|
| smoothLevel | StateFlow<Int> | Smooth level |
| whitenessLevel | StateFlow<Int> | Whiteness level |
| ruddyLevel | StateFlow<Int> | Ruddy level |
🖼️ View Module
LiveCoreView
Live core view component, provides live video rendering capability.
CameraView
Camera preview view component.
RoomParticipantView
Room participant video view component, used to display participant video.
Core APIs:
| Method | Description |
|---|---|
| init | Initialize view |
| updateStreamType | Update video stream type |
| updateParticipant | Update participant info |
| setFillMode | Set fill mode |
| setActive | Set active state |
Related Types: VideoStreamType | FillMode
📦 Package Structure
| Package | Description |
|---|---|
| io.trtc.tuikit.atomicxcore.api.login | Login related |
| io.trtc.tuikit.atomicxcore.api.call | Call related |
| io.trtc.tuikit.atomicxcore.api.live | Live related |
| io.trtc.tuikit.atomicxcore.api.room | Room related |
| io.trtc.tuikit.atomicxcore.api.barrage | Barrage related |
| io.trtc.tuikit.atomicxcore.api.gift | Gift related |
| io.trtc.tuikit.atomicxcore.api.device | Device related |
| io.trtc.tuikit.atomicxcore.api.view | View components |