Initialization and registration settings related interfaces
instance
Create a singleton object of TKRoomManager, and the object must be created through this interface.
+ (instancetype)instance
| @interface RoomController : NSObject@property (strong, nonatomic) TKRoomManager *roomMgr;@end
@implementation RoomController- (instancetype)init {
self = [super init];
if (self) {
_roomMgr = [TKRoomManager instance];
}
return self;
}
@end
|
Type |
Description |
instancetype |
An instance object of type TKRoomManager |
destory
Destroy the singleton object of TKRoomManager, and this interface must be called.
+ (void)destory
[TKRoomManager destory];
Type |
Description |
None |
None |
setLogLevel
Set the SDK log printing level, and logs will be written to the sandbox.
- (int)setLogLevel:(TKLogLevel)level logPath:(NSString * _Nullable)logPath debugToConsole:(BOOL)debug
Parameter Name |
Required |
Type |
Description |
level |
Yes |
TKLogLevel |
Log Level |
logPath |
No |
NSString |
The path for logs to be written to the sandbox; the default path is: Library/Caches/TKSDKLogs |
debug |
Yes |
BOOL |
Whether the console outputs logs: YES means logs will be printed to the console, NO means logs will not be printed to the console |
| - (instancetype)init {
self = [super init];
if (self) {
_roomMgr = [TKRoomManager instance];
[_roomMgr setLogLevel:TKLogLevelInfo logPath:nil debugToConsole:YES];
}
return self;}
|
Type |
Description |
int |
0: Indicates that the call was successful. Non-zero: Indicates that the call failed |
initWithAppKey
Set the AppID, and this interface must be called to initialize the room information. The appKey needs to be passed in, which can be found in the enterprise backend.
- (int)initWithAppID:(NSString *)appID optional:(TKRoomConfig *)config
Parameter Name |
Required |
Type |
Description |
appKey |
Yes |
NSString |
Enterprise Key |
config |
No |
TKRoomConfig |
Room Extension Information. You can view the relevant settings fields defined in the TKRoomConfig in the TKRoomDefines.h file according to your own needs |
1
2
3
4
5
6
7
8
9
10
11
12
13 | - (instancetype)init {
self = [super init];
if (self) {
_roomMgr = [TKRoomManager instance];
[_roomMgr setLogLevel:TKLogLevelInfo logPath:logPath debugToConsole:YES];
TKRoomConfig *config = [[TKRoomConfig alloc] init];
config.tk_use_secure_socket = YES;
config.tk_host = self.host;
config.tk_port = config.tk_use_secure_socket ? @"443" : @"80";
[_roomMgr initWithAppKey:kAppkey optional:config];
}
return self;}
|
Type |
Description |
int |
0: Indicates that the call was successful. Non-zero: Indicates that the call failed |
registerRoomManagerDelegate
Register the TKRoomManagerDelegate delegate to receive room information callbacks.
- (int)registerRoomManagerDelegate:(id<TKRoomManagerDelegate> _Nullable)roomDelegate
Parameter Name |
Required |
Type |
Description |
roomDelegate |
No |
id |
The object that implements the TKRoomManagerDelegate delegate |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 | @interface RoomController : NSObject<TKRoomManagerDelegate>@property (strong, nonatomic) TKRoomManager *roomMgr;@end
@implementation RoomController- (instancetype)init {
self = [super init];
if (self) {
_roomMgr = [TKRoomManager instance];
[_roomMgr setLogLevel:TKLogLevelInfo logPath:logPath debugToConsole:YES];
TKRoomConfig *config = [[TKRoomConfig alloc] init];
config.tk_use_secure_socket = YES;
config.tk_host = self.host;
config.tk_port = config.tk_use_secure_socket ? @"443" : @"80";
[_roomMgr initWithAppKey:kAppkey optional:config];
[_roomMgr registerRoomManagerDelegate:self];
}
return self;}@end
|
Type |
Description |
int |
0: Indicates that the call was successful. Non-zero: Indicates that the call failed |
Set the delegate for TKMediaFrameDelegate to receive callbacks for local and remote audio and video data.
- (int)registerMediaDelegate:(id<TKMediaFrameDelegate> _Nullable)mediaDelegate
Parameter Name |
Required |
Type |
Description |
mediaDelegate |
No |
id |
The object that implements the TKMediaFrameDelegate delegate |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 | @interface RoomController : NSObject<TKRoomManagerDelegate,TKMediaFrameDelegate>@property (strong, nonatomic) TKRoomManager *roomMgr;@end
@implementation RoomController- (instancetype)init {
self = [super init];
if (self) {
_roomMgr = [TKRoomManager instance];
[_roomMgr setLogLevel:TKLogLevelInfo logPath:logPath debugToConsole:YES];
TKRoomConfig *config = [[TKRoomConfig alloc] init];
config.tk_use_secure_socket = YES;
config.tk_host = self.host;
config.tk_port = config.tk_use_secure_socket ? @"443" : @"80";
[_roomMgr initWithAppKey:kAppkey optional:config];
[_roomMgr registerRoomManagerDelegate:self];
[_roomMgr registerMediaDelegate:self];
}
return self;}
|
Type |
Description |
int |
0: Indicates that the call was successful. Non-zero: Indicates that the call failed |
Notes
- For more return error codes, please refer to the error code descriptions in TKRoomErrorCode