TKRoomSDK Playback Interface
Playback instructions
- TKRoomSDK supports full room playback functionality, which can completely reproduce the content and process of the live room.
TKPlayBackManager
- Playback main interface class
instance
-
A brief description - Create a singleton object of TKPlaybackManager. Objects must be created through this interface
-
Interface Name
+ getInstance()
- Method Example
TKPlayBackManager.getInstance()
- Return Value Description
| Type | Description |
|---|---|
| None | None |
destroy
-
A brief description - Destroy the singleton object of TKPlaybackManager. This interface must be called.
-
Interface Name
+ (void)destroy
- Method Example
TKPlayBackManager.getInstance().destroy();
- Return Value Description
| Type | Description |
|---|---|
| None | None |
setLoggerInfo
-
A brief description - Set the SDK log printing level. Logs will be written to the sandbox.
-
Interface Name
+ setLoggerInfo(int filter, String logFilePath)
- Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| level | Yes | int | log level |
| logPath | No | String | Log file path (must be a readable and writable file path) |
- Method Example
TKPlayBackManager.getInstance().setLoggerInfo(LogLevel.ERROR,"");
- Return Value Description
| Type | Description |
|---|---|
| None | None |
init
-
A brief description - Set the AppID. This interface must be called to initialize room information
-
Interface Name
- init(Context applicationContext, String appId, HashMap<String, Object> params)
- Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| appId | Yes | String | enterprise key value |
| params | No | Map | room extension information |
| applicationContext | Yes | Context | context object |
- Method Example
1 2 3 4 5 6 7 8 9 | |
- Return Value Description
| Type | Description |
|---|---|
| None | None |
registerRoomObserver
-
A brief description - Register the room registerRoomObserver delegate to receive room information callbacks.
-
Interface Name
- registerRoomObserver(TKPlayBackManagerObserver callBack)
- Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| callBack | None | TKPlayBackManagerObserver | the object that implements the TKPlayBackManagerObserver protocol |
- Method Example
TKRoomManager.getInstance().registerRoomObserver(null);
- Return Value Description
| Type | Description |
|---|---|
| None | None |
joinPlayBackRoom
-
A brief description - The interface for entering a playback room
-
Interface Name
- (int)joinPlayBackRoom(final String host, final int port, String nickname, Map<String, Object> params, Map<String, Object> properties) ;
- Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| host | Yes | String | server address the default is https |
| port | Yes | int | server port |
| nickname | Yes | String | nickname |
| params | Yes | Map | basic parameters required for the room |
| properties | Yes | Map | the initialization information of the user when entering the room. This information will be saved to the properties attribute of the RoomUser object. You can customize it according to your own needs, such as giftNumber (number of gifts) |
- Method Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
- Return Value Description
| Type | Description |
|---|---|
| int | 0: Indicates successful invocation; Non-zero: Indicates invocation failure |
leaveRoom
-
A brief description - Exit the classroom
-
Interface Name
- (int)leaveRoom(boolean force) synchronous exit - (int)leaveRoom();
- Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| force | Yes | boolean | whether to execute synchronously |
- Method Example
TKPlayBackManager.getInstance().joinPlayBackRoomLeaveRoom();
- Return Value Description
| Type | Description |
|---|---|
| int | 0: Indicates successful invocation; Non-zero: Indicates invocation failure |
getRoomProperties
- A brief description - Get room attributes
This should be called after the joinroom interface to obtain valid results. It returns all information related to the room, such as room ID, room type, and configuration items. Configuration items: These indicate whether the room has enabled teaching auxiliary functions, such as automatic class dismissal, quiz tools, and other interactive teaching features.
- Interface Name
- JSONObject getRoomProperties();
- Method Example
TKPlayBackManager.getInstance().getRoomProperties();
- Return Value Description
| Type | Description |
|---|---|
| JSONObject | dictionary of room-related information |
getUser
- A brief description - Get a user by user ID
RoomUser is a user object class that stores user-related information. It should be called after the joinroom interface to obtain valid results.
- Interface Name
- RoomUser getUser(String peerId)
- Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| peerId | Yes | NSString | User ID |
- Method Example
TKPlayBackManager.getInstance().getUser("1");
- Return Value Description
| Type | Description |
|---|---|
| RoomUser | If there is a user with this user ID in the room, it returns the RoomUser object; otherwise, it returns null |
playVideo
- A brief description - Play a user’s video. Refer to playVideo in TKRoomManager.
playAudio
- A brief description - Play a user’s audio. Refer to playAudio in TKRoomManager.
unPlayVideo
- A brief description - Stop playing a user’s video. Refer to unPlayVideo in TKRoomManager.
unPlayAudio
- A brief description - Stop playing a user’s audio. Refer to unPlayAudio in TKRoomManager.
playMediaFile
- A brief description - Play a media stream file shared by a user. Refer to playMediaFile in TKRoomManager.
unPlayMediaFile
- A brief description - Stop playing a shared media stream file. Refer to unPlayMediaFile in TKRoomManager.
playScreen
- A brief description - Play screen sharing. Refer to playScreen in TKRoomManager.
unPlayScreen
- A brief description - Stop playing screen sharing. Refer to unPlayScreen in TKRoomManager.
playFile
- A brief description - Play a movie file shared by a user. Refer to playFile in TKRoomManager.
unPlayFile
- A brief description - Stop playing a movie file shared by a user. Refer to unPlayFile in TKRoomManager.
seekPlayback
-
A brief description - Set the progress of the playback
-
Interface Name
- seekPlayback(long positionTime);
- Parameters
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| positionTime | Yes | long | progress time point |
- Method Example
TKPlayBackManager.getInstance().seekPlayback(20);
- Return Value Description
| Type | Description |
|---|---|
| None | None |
pausePlayback
-
A brief description - Pause playback
-
Interface Name
- pausePlayback();
- Parameters
None
- Method Example
TKPlayBackManager.getInstance().pausePlayback();
- Return Value Description
| Type | Description |
|---|---|
| int | 0: Indicates successful invocation; Non-zero: Indicates invocation failure |
resumePlayBack
-
A brief description - Play back
-
Interface Name
- resumePlayBack();
- Parameters
None
- Method Example
TKPlayBackManager.getInstance().resumePlayBack();
- Return Value Description
| Type | Description |
|---|---|
| int | 0: Indicates successful invocation; Non-zero: Indicates invocation failure |




