Primary proxy callback
Notification
- CUSTOMIZE NOTIFICATIONS
This notification is a special customized one and does not require listening. Its purpose is to obtain link-related statistical information during the process of entering the classroom and connecting to the server. The relevant information, including errors and link-related statistics, can be obtained in the userInfo of the NSNotification.
1.TKRoomManagerJoinRoomSuccessNotification When the SDK's joinRoomWithHost or joinRoomEx interface is called to join a room, this notification will be received if the operation is successful.
2.TKRoomManagerJoinRoomFailedNotification When the SDK's joinRoomWithHost or joinRoomEx interface is called to join a room, this notification will be received if the operation fails.
3.TKRoomManagerContinueCheckRoomNotification When the SDK's joinRoomWithHost or joinRoomEx interface is called to join a room, if device detection is required during the process (device detection is a room configuration feature that needs to be set when creating the room in the backend), the SDK will listen for this notification. Once the SDK receives this notification (indicating that the device detection is complete), it will continue with the room joining process.
⚠️ Note: When enabling the device detection configuration feature, you need to pass the TKRoomSettingOptionalInteruptCheckRoom field as true in the initWithAppKey interface. Additionally, you must send the TKRoomManagerContinueCheckRoomNotification notification after completing the device detection; otherwise, the room joining process will be halted.
TKRoomManagerDelegate agreement
The TKRoomManagerDelegate protocol is the main signaling callback for rooms in the TKRoomSDK.
roomManagerRoomJoined
- Brief description
-The callback for successfully entering the room. When calling the joinRoomWithHost or joinRoomEx interface to enter a room, this callback will be triggered upon success. If the operation fails, this callback will not be triggered.
- Callback name
- (void)roomManagerRoomJoined
roomManagerRoomLeft
- Brief description
-The callback for leaving the room. This callback will be triggered when calling the leaveRoom interface to exit the room.
- Callback name
- (void)roomManagerRoomLeft
roomManagerOnConnectionLost
- Brief description
Offline callback
- Callback name
- (void)roomManagerOnConnectionLost
roomManagerDidOccuredError
- Brief description
The callback for all errors that occur in the SDK
- Callback name
- (void)roomManagerDidOccuredError:(NSError *)error
- Parameter
Parameter Name | Type | Description |
---|---|---|
error | NSError | Error information, where the detailed error codes can be found in the enumeration values of TKRoomErrorCode in the TKRoomDefines.h file |
roomManagerDidOccuredWaring
- Brief description
The callback for warnings that occur in the SDK
- Callback name
- (void)roomManagerDidOccuredWaring:(TKRoomWarningCode)code
- Parameter
Parameter Name | Type | Description |
---|---|---|
code | TKRoomWarningCode | Warning code, for details please refer to the enumeration values of TKRoomWarningCode in the TKRoomDefines.h file |
roomManagerUserJoined
- Brief description
The callback when a user enters the room
- Callback name
- (void)roomManagerUserJoined:(NSString *)peerID inList:(BOOL)inList
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerID | NSString | User ID |
inList | BOOL | YES: Indicates that the user entered the room before me. NO: Indicates that the user entered the room after me |
roomManagerUserLeft
- Brief description
The callback when a user leaves the room
- Callback name
- (void)roomManagerUserLeft:(NSString *)peerID
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerID | NSString | User ID |
roomManagerKickedOut
- Brief description
The callback when I am kicked out of the room
- Callback name
- (void)roomManagerKickedOut:(NSDictionary *)reason
- Parameter
Parameter Name | Type | Description |
---|---|---|
reason | NSDictionary | Reason for being kicked |
roomManagerUserPropertyChanged
- Brief description
The callback when a user's attributes change
- Callback name
1 2 3 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerID | NSString | User ID |
properties | NSDictionary | The changed user attributes |
fromId | NSString | The user ID of the user who modified the attributes |
roomManagerOnUserVideoStatus
- Brief description
-Single-stream mode: Callback when a user's video status changes. Multi-stream mode: Callback when the video status of a specific video device of a user changes. Default mode: Single-stream mode. Mobile devices do not support enabling multi-stream mode, meaning they cannot publish multiple video streams, but they can receive multiple video streams
- Callback name
1 2 3 4 5 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerID | NSString | User ID |
deviceId | NSString | Camera device ID. This parameter is valid if the user has multiple cameras and has enabled multi-stream mode |
state | TKMediaState | Video status, for details refer to the enumeration values in the TKRoomDefines.h file |
roomManagerOnUserAudioStatus
- Brief description
The callback when a user's audio status changes
- Callback name
1 2 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerID | NSString | User ID |
state | TKMediaState | Audio status, for details refer to the enumeration values in the TKRoomDefines.h file |
roomManagerOnRemotePubMsgWithMsgID
- Brief description
-When a user sends a publish signaling message (pubMsg), if I am the recipient of this signaling message, I will receive the callback for the custom signaling published by the user
- Callback name
1 2 3 4 5 6 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
msgID | NSString | Signaling ID |
msgName | NSString | Signaling name |
data | NSObject | Signaling content |
fromID | NSString | The sender ID of the signaling |
inlist | BOOL | YES: Indicates that the signaling was published before I entered the room. NO: Indicates that the signaling was published after I entered the room |
ts | long | Timestamp |
roomManagerOnRemoteDelMsgWithMsgID
- Brief description
-When a user sends a delete signaling message (delMsg), if I am the recipient of this signaling message, I will receive the callback for the custom signaling sent by the user
- Callback name
1 2 3 4 5 6 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
msgID | NSString | Signaling ID |
msgName | NSString | Signaling name |
data | NSObject | Signaling content |
fromID | NSString | The sender ID of the signaling |
inlist | BOOL | YES: Indicates that the signaling was published before I entered the room. NO: Indicates that the signaling was published after I entered the room |
ts | long | Timestamp |
roomManagerMessageReceived
- Brief description
-The callback for receiving a chat message sent by a user. You can send a chat message by calling the sendMessage interface
- Callback name
1 2 3 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
message | NSString | Chat message content |
peerID | NSString | Sender ID |
extension | NSDictionary | Extended information |
roomManagerOnServerRecordStateChanged
- Brief description
-The callback for the recording status during playback. You can call the startServerRecord interface to start server-side recording
- Callback name
1 2 3 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
state | NSString | Status value, for details refer to the enumeration values in the TKRoomDefines.h file |
peerID | NSString | Sender ID |
extension | NSDictionary | If the parameter state == TKRecordState_Started (indicating the recording has started), the extension dictionary will return the regular recording piece ID and the MP4 recording piece ID for this recording session. The extension dictionary may be nil |
roomManagerOnVideoStatsReport
- Brief description
Callback for video data statistics, occurring once per second
- Callback name
- (void)roomManagerOnVideoStatsReport:(NSString *)peerId stats:(TKVideoStats *)stats
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerId | NSString | User ID, indicating that the video data belongs to this user |
stats | TKVideoStats | Video data object, for details refer to the relevant definitions in the TKRoomDefines.h file |
roomManagerOnAudioStatsReport
- Brief description
Callback for audio data statistics, occurring once per second
- Callback name
- (void)roomManagerOnAudioStatsReport:(NSString *)peerId stats:(TKAudioStats *)stats
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerId | NSString | User ID, indicating that the audio data belongs to this user |
stats | TKAudioStats | Audio data object, for details refer to the relevant definitions in the TKRoomDefines.h file |
roomManagerOnRtcStatsReport
- Brief description
Callback for uplink and downlink audio and video data statistics, occurring once per second
- Callback name
- (void)roomManagerOnRtcStatsReport:(TKRtcStats *)stats
- Parameter
Parameter Name | Type | Description |
---|---|---|
stats | TKRtcStats | Audio and video data object, for details refer to the relevant definitions in the TKRoomDefines.h file |
roomManagerOnAudioVolumeWithPeerID
- Brief description
The callback for changes in a user's audio volume level
- Callback name
- (void)roomManagerOnAudioVolumeWithPeerID:(NSString *)peeID volume:(int)volume
- Parameter
Parameter Name | Type | Description |
---|---|---|
peeID | NSString | User ID |
volume | int | Volume level |
roomManagerOnAudioRoomSwitch
- Brief description
The callback for changes in room mode, such as switching between audio-only and audio-video rooms
- Callback name
- (void)roomManagerOnAudioRoomSwitch:(NSString *)fromId onlyAudio:(BOOL)onlyAudio
- Parameter
Parameter Name | Type | Description |
---|---|---|
fromId | NSString | The user ID of the person who switched the room mode, i.e., the signaling sender ID |
onlyAudio | BOOL | YES: Indicates an audio-only room. NO: Indicates an audio-video room. |
roomManagerOnFirstVideoFrameWithPeerID
- Brief description
-When playing a user's video, this callback will be received when the first frame of the video is rendered. If the video of a user has not been unplayed and is played again, this callback will not be received again
Single-stream mode: Callback when the first frame of a user's video is rendered while playing the user's video. Multi-stream mode: Callback when the first frame of a specific device's video is rendered while playing a user's video from that device. Default mode: Single-stream mode. Mobile devices do not support enabling multi-stream mode, meaning they cannot publish multiple video streams, but they can receive multiple video streams
- Callback name
1 2 3 4 5 6 7 8 9 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerID | NSString | User ID |
deviceId | NSString | Camera device ID. This parameter is valid if the user has multiple cameras and has enabled multi-stream mode |
width | NSInteger | Video width |
height | NSInteger | Video height |
type | TKMediaType | Type, for details refer to the relevant definitions in the TKRoomDefines.h file |
roomManagerOnVideoStateChange
- Brief description
The callback for changes in video status while playing a user's video
- Callback name
1 2 3 4 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerID | NSString | User ID |
deviceId | NSString | Camera device ID. It is nil in single-stream mode and valid in multi-stream mode |
state | TKRenderState | Status, for details refer to the relevant definitions in the TKRoomDefines.h file |
type | TKMediaType | Type, for details refer to the relevant definitions in the TKRoomDefines.h file |
roomManagerOnFirstAudioFrameWithPeerID
- Brief description
The callback for changes in audio status while playing a user's audio
- Callback name
1 2 3 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerID | NSString | User ID |
state | TKRenderState | Status, for details refer to the relevant definitions in the TKRoomDefines.h file |
type | TKMediaType | Type, for details refer to the relevant definitions in the TKRoomDefines.h file |
roomManagerOnAudioStateChange
- Brief description
The callback for receiving the first frame of audio data while playing a user's audio and video. If the audio of a user has not been unplayed and is played again, this callback will not be received again.o
- Callback name
- (void)roomManagerOnFirstAudioFrameWithPeerID:(NSString *)peerID mediaType:(TKMediaType)type;
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerID | NSString | User ID |
type | TKMediaType | Type, for details refer to the relevant definitions in the TKRoomDefines.h file |
roomManagerOnShareMediaState
- Brief description
The callback for changes in the status of a media stream when a user shares it. You can call the playMediaFile interface to play the media stream
- Callback name
1 2 3 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerId | NSString | User ID |
state | TKMediaState | Status, for details refer to the relevant definitions in the TKRoomDefines.h file |
message | NSDictionary | Extended information |
roomManagerUpdateMediaStream
- Brief description
-The callback for updates to the media stream information when a user shares it. ⚠️ Note: Currently, only the person who initiated the media stream will receive this callback
- Callback name
1 2 3 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
duration | NSTimeInterval | Total duration |
pos | NSTimeInterval | Current progress |
isPlay | BOOL | Whether it is in the playing state |
roomManagerMediaLoaded
- Brief description
-The callback when the first frame of the media stream is loaded while a user is sharing it.
This callback is triggered when the first frame is loaded after calling the playMediaFile interface to play the media stream
- Callback name
- (void)roomManagerMediaLoaded;
- Parameter
None
roomManagerOnShareScreenState
- Brief description
-The callback for changes in the status when a user shares their screen.
You can call the playScreen interface to play the screen-sharing stream
- Callback name
1 2 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerId | NSString | User ID |
state | TKMediaState | Status, for details refer to the relevant definitions in the TKRoomDefines.h file |
roomManagerOnShareFileState
- Brief description
-The callback for changes in the status when a user shares a movie file.
You can call the playFile interface to play the stream of the shared movie file
- Callback name
1 2 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
peerId | NSString | User ID |
state | TKMediaState | Status, for details refer to the relevant definitions in the TKRoomDefines.h file |
KMediaFrameDelegate Agreement
The TKMediaFrameDelegate protocol is the delegate callback for local media capture data and remote media data.
⚠️ Note: These callback functions are not thread-safe.
onCaptureVideoFrame
- Brief description
The callback for locally captured video data
- Callback name
- (void)onCaptureVideoFrame:(TKVideoFrame *)frame sourceType:(TKMediaType)type;
- Parameter
Parameter Name | Type | Description |
---|---|---|
frame | TKVideoFrame | Video data, for details refer to the relevant definitions in the TKRoomDefines.h file |
type | TKMediaType | Status, for details refer to the relevant definitions in the TKRoomDefines.h file |
onCaptureAudioFrame
- Brief description
The callback for locally captured audio data
- Callback name
- (void)onCaptureAudioFrame:(TKAudioFrame *)frame sourceType:(TKMediaType)type;
- Parameter
Parameter Name | Type | Description |
---|---|---|
frame | TKAudioFrame | Audio data, for details refer to the relevant definitions in the TKRoomDefines.h file |
type | TKMediaType | Status, for details refer to the relevant definitions in the TKRoomDefines.h file |
onRenderAudioFrame
- Brief description
The callback for receiving remote audio data
- Callback name
- (void)onRenderAudioFrame:(TKAudioFrame *)frame uid:(NSString *)peerId sourceType:(TKMediaType)type;
- Parameter
Parameter Name | Type | Description |
---|---|---|
frame | TKAudioFrame | Audio data, for details refer to the relevant definitions in the TKRoomDefines.h file |
peerId | NSString | User ID |
type | TKMediaType | Status, for details refer to the relevant definitions in the TKRoomDefines.h file |
onRenderVideoFrame
- Brief description
The callback for receiving video data from a remote user or receiving video data from a specific video device of a remote user
- Callback name
1 2 3 |
|
or
1 2 3 4 |
|
- Parameter
Parameter Name | Type | Description |
---|---|---|
frame | TKVideoFrame | Audio data, for details refer to the relevant definitions in the TKRoomDefines.h file |
peerId | NSString | User ID |
deviceId | NSString | Device ID |
type | TKMediaType | Status, for details refer to the relevant definitions in the TKRoomDefines.h file |