主播 | 观众 |
| |
Podfile
文件中添加 pod 'TUILiveKit'
依赖,如果您遇到任何问题,请参见 Example 工程。target 'xxxx' do......pod 'TUILiveKit'end
Podfile
文件,首先终端cd
到xxxx.xcodeproj
目录,然后通过以下命令创建:pod init
cd
到Podfile
目录下,然后执行以下命令,安装组件。pod install
pod repo update
pod update
<key>NSCameraUsageDescription</key><string>TUILiveKit需要访问你的相机权限,开启后录制的视频才会有画面</string><key>NSMicrophoneUsageDescription</key><string>TUILiveKit需要访问您的麦克风权限,开启后录制的视频才会有声音</string>
//// AppDelegate.swift//import TUICorefunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {TUILogin.login(1400000001, // 请替换为步骤一取到的 SDKAppIDuserID: "denny", // 请替换为您的 UserIDuserSig: "xxxxxxxxxxx") { // 您可以在控制台中计算一个 UserSig 并填在这个位置print("login success")} fail: { (code, message) inprint("login failed, code: \\(code), error: \\(message ?? "nil")")}return true}
//// AppDelegate.m//#import <TUICore/TUILogin.h>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {[TUILogin login:1400000001 // 请替换为步骤一取到的 SDKAppIDuserID:@"denny" // 请替换为您的 UserIDuserSig:@"xxxxxxxxxxx" // 您可以在控制台中计算一个 UserSig 并填在这个位置succ:^{NSLog(@"login success");} fail:^(int code, NSString * _Nullable msg) {NSLog(@"login failed, code: %d, error: %@", code, msg);}];return YES;}
let params = CreateRoomParams()parmas.maxAnchorCount = VoiceRoomDefine.MAX_CONNECTED_VIEWERS_COUNTparmas.seatMode = .applyToTakeVoiceRoomKit.createInstance().createRoom(roomId: "your room id", params: params)
CreateRoomParams *parmas = [[CreateRoomParams alloc] init];parmas.maxAnchorCount = VoiceRoomDefine.MAX_CONNECTED_VIEWERS_COUNT;parmas.seatMode = TUISeatModeApplyToTake;[[VoiceRoomKit createInstance] createRoomWithRoomId:@"your room id" params:parmas];
语音聊天室预览画面 | 语音聊天室房间内画面 |
| |
VoiceRoomKit.createInstance().enterRoom(roomId: "your room id")
[[VoiceRoomKit createInstance] enterRoomWithRoomId:@"your room id"];
语音聊天室 | 语音聊天室 |
| |
本页内容是否解决了您的问题?