After completing the room creation/obtaining RoomToken operation of a specific room, and after getting the room UUID and the room RoomToken, the developer can call the API related to WhiteSDK
and joinRoom
.
The relevant code of this article can be viewed in the WhiteRoomViewController
of the Demo project.
@import UIKit;
#import "WhiteBaseViewController.h"
@interface WhiteRoomViewController: WhiteBaseViewController
@property (nonatomic, strong, nullable) WhiteRoom *room;
#pragma mark-CallbackDelegate
@property (nonatomic, weak, nullable) id<WhiteRoomCallbackDelegate> roomCallbackDelegate;
@end
@implementation WhiteRoomViewController
-(void)joinRoomWithToken:(NSString *)roomToken
{
...
WhiteRoomConfig *roomConfig = [[WhiteRoomConfig alloc] initWithUuid:@"UUID" roomToken:@"ROOMTOKEN"];
[self.sdk joinRoomWithConfig:roomConfig callbacks:self.roomCallbackDelegate completionHandler:^(BOOL success, WhiteRoom * _Nonnull room, NSError * _Nonnull error) {
if (success) {
self.room = room;
} else {
// error handling
}
}];
}
@end
After calling the Active Disconnect API, the Room object cannot continue to operate. If you need to rejoin the room, you need to call the joinRoom
API of WhiteSDK
again.
room uuid and room token can remain unchanged.
[self.room disconnect:^{
//Disconnected successfully
}];
The disconnect method will still trigger the
- (void)firePhaseChanged:
callback.
The latest version can be distinguished by thedisconnectedBySelf
property ofWhiteRoom
.