Note
This iOS voice integration guide is intended only for iOS client developers. Developers on other platforms do not need to do any extra work — as long as voice works correctly on every platform, multi-platform voice co-viewing is supported automatically.
Caution
Before you begin, integrate the Realsee iOS container SDK by following the official Domestic iOS integration guide. The container guide is not duplicated in this overseas SDK documentation tree.
The SDK implements voice synchronization during co-viewing using Tencent RTC (TRTC). To use the co-viewing feature, perform the following steps:
Adding the Dependency
You need to add the Tencent voice library separately. Edit your Podfile and add the dependency:
# Voice (Tencent Cloud TRTC)
pod 'TXLiteAVSDK_TRTC', '8.7.10102'Login Verification
Co-viewing requires verifying the user's login state. The SDK needs to obtain the current user's login token to validate it, so you must provide implementations of the methods that return user information:
// Return the latest user login token
[RSVRSDKConfig shareInstance].accessToken = ^NSString * _Nullable{
return [[NSUserDefaults standardUserDefaults] valueForKey:@"login_token"];
};
// Return the latest user ID
[RSVRSDKConfig shareInstance].userId = ^NSString * _Nullable{
return [[NSUserDefaults standardUserDefaults] valueForKey:@"login_user_id"];
};
// Return the latest user name
[RSVRSDKConfig shareInstance].userName = ^NSString * _Nullable{
return [[NSUserDefaults standardUserDefaults] valueForKey:@"login_user_name"];
};When the verification result indicates that the user is not logged in or that the login information is invalid, the SDK will proactively navigate to the app's login screen. The SDK triggers the app login through the RSVRSDKDelegate:
[RSVRSDKConfig shareInstance].configDelegate = self;Implement the RSVRSDKDelegate methods:
#pragma RSVRSDKDelegate
/// Bring up the login screen in this delegate method.
/// @param didUserLoginBlock Call this block proactively after the user logs in successfully.
- (void)actionLogin:(dispatch_block_t)didUserLoginBlock
{
self.loginBlockAction = didUserLoginBlock;
LoginViewController* loginVc = [[LoginViewController alloc] init];
[self.navigationController pushViewController:loginVc animated:YES];
}
....After the H5 layer receives the login-success notification, it will call the user-information methods again to fetch the updated information, pass verification, and start the co-viewing session.
