直播间信息组件 | 点击组件后,展示直播间信息详情面板 | 集成后效果展示 |
![]() | ![]() | ![]() |

settings.gradle.kts (或settings.gradle)文件中添加 jitpack 仓库地址:中添加 jitpack 仓库依赖(下载播放礼物 svg 动画的三方库 SVGAPlayer):dependencyResolutionManagement {repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories {google()mavenCentral()// 添加 jitpack 仓库地址maven { url = uri("https://jitpack.io") }}}
dependencyResolutionManagement {repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories {google()mavenCentral()// 添加 jitpack 仓库地址maven { url 'https://jitpack.io' }}}
settings.gradle.kts (或settings.gradle)文件中增加如下代码,它的作用是将您下载的 tuilivekit 组件导入到您当前的项目中:include(":tuilivekit")
include ':tuilivekit'
build.gradle.kts(或build.gradle)文件,并在其中增加如下代码,它的作用是声明当前 app 对新加入的 tuilivekit 组件的依赖:api(project(":tuilivekit"))
api project(':tuilivekit')
TRTC SDK、IM SDK、tuiroomengine 以及公共库 tuicore,不需要开发者单独配置。如需进行版本升级,则修改tuilivekit/build.gradle文件即可。proguard-rules.pro文件中添加如下代码:-keep class com.tencent.** { *; }-keep class com.trtc.uikit.livekit.livestreamcore.** { *; }-keep class com.trtc.uikit.livekit.component.gift.store.model.** { *; }-keep class com.squareup.wire.** { *; }-keep class com.opensource.svgaplayer.proto.** { *; }-keep class com.tcmediax.** { *; }-keep class com.tencent.** { *; }-keep class com.tencent.xmagic.** { *; }-keep class androidx.exifinterface.** {*;}-keep class com.google.gson.** { *;}# Tencent Effect SDK - beauty-keep class com.tencent.xmagic.** { *;}-keep class org.light.** { *;}-keep class org.libpag.** { *;}-keep class org.extra.** { *;}-keep class com.gyailib.**{ *;}-keep class com.tencent.cloud.iai.lib.** { *;}-keep class com.tencent.beacon.** { *;}-keep class com.tencent.qimei.** { *;}-keep class androidx.exifinterface.** { *;}
AndroidManifest.xml 文件,在 application 节点中添加 tools:replace="android:allowBackup"和android:allowBackup="false",覆盖组件内的设置,使用自己的设置。// app/src/main/AndroidManifest.xml<application...// 添加如下配置覆盖 依赖的 sdk 中的配置android:allowBackup="false"tools:replace="android:allowBackup">
LiveInfo和Common文件夹到本地。
Podfile 文件中添加 pod 'TUILiveInfo' 和pod 'TUILiveResources'依赖。target 'xxxx' do......pod 'TUILiveResources', :path => '../Component/Common/TUILiveResources.podspec'//路径是您的Podfile文件与TUILiveResources.podspec文件之间的相对路径pod 'TUILiveInfo', :path => '../Component/LiveInfo/TUILiveInfo.podspec'//路径是您的Podfile文件与TUILiveInfo.podspec文件之间的相对路径end
Podfile 文件,首先终端cd 到xxxx.xcodeproj目录,然后通过以下命令创建:pod init
cd到Podfile目录下,然后执行以下命令,安装组件。pod install
LiveInfoView liveInfoView = new LiveInfoView(getContext());
<com.trtc.uikit.livekit.component.roominfo.LiveInfoViewandroid:id="@+id/rl_room_info"android:layout_width="150dp"android:layout_height="wrap_content"android:layout_marginStart="16dp"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"/>
import TUILiveInfolet enableFollowFeature = true //是否开启关注功能lazy var liveInfoView = LiveInfoView(enableFollow: enableFollowFeature)// ...此处将liveInfoView添加到您的父视图上并调整布局
enterRoomSuccessNotifier.value 置为 true。final enterRoomSuccessNotifier = ValueNotifer(false);// change enterRoomSuccessNotifier.value to true after enter room successValueListenableBuilder(valueListenable: enterRoomSuccessNotifier,builder: (context, enterRoomSuccess, _) {return Visibility(visible: enterRoomSuccess,child: LiveInfoWidget(roomId: 'replace with your roomId',),);}),
LiveInfoView 的 init 方法,让组件绑定数据和事件。liveInfoView.init(roomInfo);
LiveInfoView 的 initialize 方法,让组件绑定数据和事件。liveInfoView.initialize(roomInfo: roomInfo)
Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários