集成实时音视频(一)

发布于 2025-08-16 18:36:22

实时音视频是腾讯推出的一款带有直播和语音房UI的SDK。可以快速帮助我们集成开播实现直播功能。本文档只讨论带有UI的集成方案,不带UI可自行参考官方文档。

官方文档:https://cloud.tencent.com/document/product/647

iOS集成步骤:

1. 全功能接入我们只需要在pod文件中导入TUILiveKit即可,pod update以后就能使用了。

pod 'TUILiveKit'

2. 工程配置。

<key>NSCameraUsageDescription</key>

<string>TUILiveKit需要访问你的相机权限,开启后录制的视频才会有画面</string>

<key>NSMicrophoneUsageDescription</key>

<string>TUILiveKit需要访问您的麦克风权限,开启后录制的视频才会有声音</string>

3.初始化。

//

//  AppDelegate.swift

//

import TUICore

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    TUILogin.login(1400000001,               // 请替换为步骤一取到的 SDKAppID

            userID: "denny",                 // 请替换为您的 UserID

            userSig: "xxxxxxxxxxx") {        // 您可以在控制台中计算一个 UserSig 并填在这个位置

      print("login success")

    } fail: { (code, message) in

      print("login failed, code: \(code), error: \(message ?? "nil")")

    }

    return true

}

这样我们就配置好相关SDK并初始化完成

0 条评论

发布
问题