LiveListStore
Introduction
LiveListStore provides a complete set of live room management APIs, including creating live, joining live, leaving live, ending live and other functions.
Through this class, you can manage the lifecycle of live rooms.
Important:
Use the LiveListStore.shared singleton object to get the LiveListStore instance.
Note:
Live state updates are delivered through the liveState publisher. Subscribe to it to receive real-time updates of live data.
Features
Live List:Get and manage live room list
Live Creation:Create new live rooms
Live Joining:Join existing live rooms
Live Management:Update live info, end live and other operations
Event Listening:Listen for live ended, kicked out and other events
Subscribable Data
LiveListState fields are described below:
API List
Function | Description |
Singleton object. | |
Live list event callbacks. | |
Live list event callbacks. | |
Get live list. | |
Get live info. | |
Create live. | |
Join live. | |
Leave live. | |
End live. | |
Update live info. | |
Query metadata. | |
Update metadata. |
Getting Instance
LiveListStore.shared
Singleton object
Observing State and Events
addLiveListListener
Add live list event listener
void addLiveListListener(LiveListListener listener);
Version
Supported since version 3.5.
Parameters
Parameter | Type | Required | Description |
listener | Required | Listener. |
removeLiveListListener
Remove live list event listener
void removeLiveListListener(LiveListListener listener);
Version
Supported since version 3.5.
Parameters
Parameter | Type | Required | Description |
listener | Required | Listener. |
Live List
fetchLiveList
Get live list
Future<CompletionHandler> fetchLiveList({required String cursor,required int count,});
Version
Supported since version 3.5.
Parameters
Parameter | Type | Required | Description |
cursor | String | Required | Cursor. |
count | int | Required | Count. |
fetchLiveInfo(liveID:completion:)
Get live info
Live Operations
createLive
Create live
Future<LiveInfoCompletionHandler> createLive(LiveInfo liveInfo);
Version
Supported since version 3.5.
Parameters
Parameter | Type | Required | Description |
liveInfo | Required | Live info. |
joinLive
Join live
Future<LiveInfoCompletionHandler> joinLive(String liveID);
Version
Supported since version 3.5.
Parameters
Parameter | Type | Required | Description |
liveID | String | Required | Live ID. |
leaveLive
Leave live
Future<CompletionHandler> leaveLive();
Version
Supported since version 3.5.
endLive
End live
Future<StopLiveCompletionHandler> endLive();
Version
Supported since version 3.5.
updateLiveInfo
Update live info
Future<CompletionHandler> updateLiveInfo({required LiveInfo liveInfo,required List<ModifyFlag> modifyFlagList,});
Version
Supported since version 3.5.
Parameters
Parameter | Type | Required | Description |
liveInfo | Required | Live info. | |
modifyFlag | List<ModifyFlag> | Required | Modify flag. |
Metadata Operations
queryMetaData
Query metadata
Future<MetaDataCompletionHandler> queryMetaData(List<String> keys);
Version
Supported since version 3.5.
Parameters
Parameter | Type | Required | Description |
keys | List<String> | Required | Key list. |
updateLiveMetaData
Update live metadata
Future<CompletionHandler> updateLiveMetaData(Map<String, String> metaData);
Version
Supported since version 3.5.
Parameters
Parameter | Type | Required | Description |
metaData | Map<String, String> | Required | Metadata. |
Data Structures
TakeSeatMode
Take seat mode.
Enum Value | Description |
free | Free to take seat. |
apply | Apply to take seat. |
LiveEndedReason
Live ended reason.
Enum Value | Description |
endedByHost | Ended by host. |
endedByServer | Ended by server. |
LiveKickedOutReason
Kicked out of live room reason.
Enum Value | Description |
byAdmin | Kicked out by admin. |
byLoggedOnOtherDevice | Logged on other device. |
byServer | Kicked out by server. |
forNetworkDisconnected | Network disconnected. |
forJoinRoomStatusInvalidDuringOffline | Join room status invalid during offline. |
forCountOfJoinedRoomsExceedLimit | Count of joined rooms exceed limit. |
LiveInfo
Live information
Property | Type | Description |
liveID | String | Live ID. |
liveName | String | Live name. |
notice | String | Live notice. |
isMessageDisable | bool | Whether message is disabled. |
isPublicVisible | bool | Whether publicly visible. |
isSeatEnabled | bool | Whether seat is enabled. |
keepOwnerOnSeat | bool | Whether to keep owner on seat. |
maxSeatCount | int | Maximum seat count. |
seatMode | Take seat mode. | |
seatTemplate | SeatLayoutTemplate | Seat layout template for simplifying seat configuration. |
seatLayoutTemplateID | int | Seat layout template ID. |
coverURL | String | Cover URL. |
backgroundURL | String | Background URL. |
categoryList | List<int> | Category list. |
activityStatus | int | Activity status. |
liveOwner | Live owner info. | |
createTime | int | Create time. |
totalViewerCount | int | Total viewer count. |
isGiftEnabled | bool | Whether gift is enabled. |
metaData | Map<String, String> | Metadata. |
LiveListState
Live list state
LiveListListener
Live list events
Methods
onLiveEnded: Live ended event.
void Function(String liveID, LiveEndedReason reason, String message)? onLiveEnded;
Parameter | Type | Description |
liveID | String | Live ID. |
reason | Ended reason. | |
message | String | Message. |
onKickedOutOfLive: Kicked out of live room event.
void Function(String liveID, LiveKickedOutReason reason, String message)? onKickedOutOfLive;LiveListListener({this.onLiveEnded, this.onKickedOutOfLive});
Parameter | Type | Description |
liveID | String | Live ID. |
reason | Kicked out reason. | |
message | String | Message. |
LiveInfoCompletionHandler
Live info completion handler for Dart.
Completion handler for live info operations in Dart, containing the result live info.
Properties
Property | Type | Description |
liveInfo | Live info returned on success. |
StopLiveCompletionHandler
Stop live completion handler for Dart.
Completion handler for stop live operations in Dart, containing the live statistics data.
Properties
Property | Type | Description |
statisticsData | TUILiveStatisticsData | Live statistics data returned on success. |
MetaDataCompletionHandler
Metadata completion handler for Dart.
Completion handler for metadata operations in Dart, containing the metadata result.
Properties
Property | Type | Description |
metaData | Map<String, String> | Metadata returned on success. |