Pre-stream Setup | Co-Host Interaction | Audience Interaction | Live Room Management |
![]() | ![]() | ![]() | ![]() |
AnchorPrepareView component already has built-in features for camera preview, audio effects settings, layout settings, and other functional configurations. You need to create and load AnchorPrepareView. The specific example code is as follows:import android.os.Bundleimport androidx.appcompat.app.AppCompatActivityimport com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareViewclass YourActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)// 1. Create and initialize AnchorPrepareViewval anchorPrepareView = AnchorPrepareView(this)anchorPrepareView.init("live_1236666", null)// 2. Add AnchorPrepareView to the UIsetContentView(anchorPrepareView)}}
import android.os.Bundle;import androidx.appcompat.app.AppCompatActivity;import com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareView;public class YourActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);// 1. Create and initialize AnchorPrepareViewAnchorPrepareView anchorPrepareView = new AnchorPrepareView(this);anchorPrepareView.init("live_1236666", null);// 2. Add AnchorPrepareView to the UIsetContentView(anchorPrepareView);}}
AnchorView component has built-in features for audio/video pushing (streaming), viewer co-hosting, live interaction, and live room management. You only need to create and load AnchorView. The specific example code is as follows:import android.os.Bundleimport androidx.appcompat.app.AppCompatActivityimport com.tencent.cloud.tuikit.engine.extension.TUILiveListManagerimport com.tencent.cloud.tuikit.engine.room.TUIRoomDefineimport com.trtc.uikit.livekit.features.anchorboardcast.AnchorViewimport com.trtc.uikit.livekit.features.anchorboardcast.AnchorViewDefine.RoomBehaviorimport com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareViewDefine.LiveStreamPrivacyStatus.PUBLICclass YourActivity : AppCompatActivity() {lateinit var anchorPrepareView: AnchorPrepareViewoverride fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)anchorPrepareView = AnchorPrepareView(this)anchorPrepareView.init("live_1236666", null)setContentView(anchorPrepareView)}// Call this code after going livefun initAnchorView() {// 1. Create AnchorViewval anchorView = AnchorView(this)// 2. Initialize AnchorView, where liveInfo is live room information and anchorPrepareView is your preparation page before going liveval liveInfo = TUILiveListManager.LiveInfo()liveInfo.roomInfo = TUIRoomDefine.RoomInfo();liveInfo.roomInfo.roomId = "live_1236666"liveInfo.roomInfo.name = anchorPrepareView.state?.roomName?.getValue()liveInfo.isPublicVisible = anchorPrepareView.state?.liveMode?.getValue() == PUBLICliveInfo.coverUrl = anchorPrepareView.state?.coverURL?.getValue()liveInfo.seatLayoutTemplateId = anchorPrepareView.state.coGuestTemplateId.getValue()!!// Room entry action:// RoomBehavior.CREATE_ROOM: broadcaster creates a room// RoomBehavior.ENTER_ROOM: Audience Enters RoomanchorView.init(liveInfo, anchorPrepareView?.coreView, RoomBehavior.CREATE_ROOM, null)// 3. Add AnchorView to the UIsetContentView(anchorView)}}
import android.os.Bundle;import androidx.appcompat.app.AppCompatActivity;import com.tencent.cloud.tuikit.engine.extension.TUILiveListManager;import com.tencent.cloud.tuikit.engine.room.TUIRoomDefine;import com.trtc.uikit.livekit.features.anchorboardcast.AnchorView;import com.trtc.uikit.livekit.features.anchorboardcast.AnchorViewDefine;import com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareViewDefine;public class YourActivity extends AppCompatActivity {AnchorPrepareView anchorPrepareView;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);anchorPrepareView = new AnchorPrepareView(this);anchorPrepareView.init("live_123456", null);setContentView(anchorPrepareView);}// Call this code after going liveprivate void initAnchorView() {// 1. Create AnchorViewAnchorView anchorView = new AnchorView(this);// 2. Initialize AnchorView, where liveInfo is live room information and anchorPrepareView is your preparation page before going liveTUILiveListManager.LiveInfo liveInfo = new TUILiveListManager.LiveInfo();liveInfo.roomInfo = new TUIRoomDefine.RoomInfo();liveInfo.roomInfo.roomId = "live_1236666";liveInfo.roomInfo.name = anchorPrepareView.getState().roomName.getValue();liveInfo.isPublicVisible = anchorPrepareView.getState().liveMode.getValue() == AnchorPrepareViewDefine.LiveStreamPrivacyStatus.PUBLIC;liveInfo.coverUrl = anchorPrepareView.getState().coverURL.getValue();// Room entry action:// RoomBehavior.CREATE_ROOM: broadcaster creates a room// RoomBehavior.ENTER_ROOM: Audience Enters RoomanchorView.init(liveInfo, anchorPrepareView.getCoreView(), AnchorViewDefine.RoomBehavior.CREATE_ROOM);// 3. Add AnchorView to the UIsetContentView(anchorView);}}
AnchorPrepareView component, completing the transition to the host streaming page. The specific example code is as follows:import android.os.Bundleimport androidx.appcompat.app.AppCompatActivityimport com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareViewimport com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareViewDefine.AnchorPrepareViewListenerclass YourActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)val anchorPrepareView = AnchorPrepareView(this)anchorPrepareView.init("live_1236666", null)// 1. Add preview page click event listeninganchorPrepareView.addAnchorPrepareViewListener(object : AnchorPrepareViewListener {override fun onClickStartButton() {// Handle the click event, switch the page to your broadcaster stream page, see the initAnchorView method in procedure 4initAnchorView()}override fun onClickBackButton() {finish()}})// 2. Add AnchorPrepareView to the UIsetContentView(anchorPrepareView)}}
import android.os.Bundle;import androidx.appcompat.app.AppCompatActivity;import com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareView;import com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareViewDefine;public class YourActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);AnchorPrepareView anchorPrepareView = new AnchorPrepareView(this);anchorPrepareView.init("live_123456", null);// 1. Add preview page click event listeninganchorPrepareView.addAnchorPrepareViewListener(new AnchorPrepareViewDefine.AnchorPrepareViewListener() {@Overridepublic void onClickStartButton() {// Handle the click event, switch the page to your broadcaster stream page, see the initAnchorView method in procedure 4initAnchorView()}@Overridepublic void onClickBackButton() {finish();}});// 2. Add AnchorPrepareView to the UIsetContentView(anchorPrepareView);}}

Name | dynamic grid layout | dynamic float layout | static grid layout | static float layout |
Template ID | 600 | 601 | 800 | 801 |
Description | The default layout; grid size adjusts dynamically based on the number of co-hosts. | Co-hosts are displayed in floating small windows. | The number of co-hosts is fixed, and each co-host occupies a fixed grid cell. | The number of co-hosts is fixed, and co-hosts are displayed in fixed small windows. |
Preview | ![]() | ![]() | ![]() | ![]() |
AnchorPrepareView Feature AreaprepareView created in Step 3, you can customize and hide the operation area or specific features on the host setup page:import android.os.Bundleimport androidx.appcompat.app.AppCompatActivityimport com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareViewclass YourActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)val anchorPrepareView = AnchorPrepareView(this)anchorPrepareView.init("live_1236666", null)// 1. Custom function area - Example: Hide the entire feature areaanchorPrepareView.disableFeatureMenu(true)setContentView(anchorPrepareView)}}
import android.os.Bundle;import androidx.appcompat.app.AppCompatActivity;import com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareView;public class YourActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);AnchorPrepareView anchorPrepareView = new AnchorPrepareView(this);anchorPrepareView.init("live_1236666", null);// 1. Custom function area - Example: Hide the entire feature areaanchorPrepareView.disableFeatureMenu(true);setContentView(anchorPrepareView);}}
API | Description |
disableFeatureMenu(true) | Hide Entire Feature Area |
disableMenuBeautyButton(true) | Hide Beauty Effect Button |
disableMenuAudioEffectButton(true) | Hide Sound Effect Button |
disableMenuSwitchCameraButton(true) | Hide Camera Toggle Button |
AnchorView Feature AreaanchorView created in Step 4, you can customize and hide the operation area or specific features on the host live page:import android.os.Bundleimport androidx.appcompat.app.AppCompatActivityimport com.tencent.cloud.tuikit.engine.extension.TUILiveListManagerimport com.tencent.cloud.tuikit.engine.room.TUIRoomDefineimport com.trtc.uikit.livekit.features.anchorboardcast.AnchorViewimport com.trtc.uikit.livekit.features.anchorboardcast.AnchorViewDefine.RoomBehaviorimport com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareViewDefine.LiveStreamPrivacyStatus.PUBLICclass YourActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)val anchorView = AnchorView(this)val liveInfo = TUILiveListManager.LiveInfo()liveInfo.roomInfo = TUIRoomDefine.RoomInfo();liveInfo.roomInfo.roomId = "live_1236666"liveInfo.roomInfo.name = anchorPrepareView.state?.roomName?.getValue()liveInfo.isPublicVisible = anchorPrepareView.state?.liveMode?.getValue() == PUBLICliveInfo.coverUrl = anchorPrepareView.state?.coverURL?.getValue()liveInfo.seatLayoutTemplateId = anchorPrepareView.state.coGuestTemplateId.getValue()!!anchorView.init(liveInfo, anchorPrepareView?.coreView, RoomBehavior.CREATE_ROOM, null)// 1. Custom function area - Example: Hide the anchor connection featureanchorView.disableFooterCoHost(true)setContentView(anchorView)}}
import android.os.Bundle;import androidx.appcompat.app.AppCompatActivity;import com.tencent.cloud.tuikit.engine.extension.TUILiveListManager;import com.tencent.cloud.tuikit.engine.room.TUIRoomDefine;import com.trtc.uikit.livekit.features.anchorboardcast.AnchorView;import com.trtc.uikit.livekit.features.anchorboardcast.AnchorViewDefine;import com.trtc.uikit.livekit.features.anchorprepare.AnchorPrepareViewDefine;public class YourActivity extends AppCompatActivity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);AnchorView anchorView = new AnchorView(this);TUILiveListManager.LiveInfo liveInfo = new TUILiveListManager.LiveInfo();liveInfo.roomInfo = new TUIRoomDefine.RoomInfo();liveInfo.roomInfo.roomId = "live_1236666";liveInfo.roomInfo.name = anchorPrepareView.getState().roomName.getValue();liveInfo.isPublicVisible = anchorPrepareView.getState().liveMode.getValue() == AnchorPrepareViewDefine.LiveStreamPrivacyStatus.PUBLIC;liveInfo.coverUrl = anchorPrepareView.getState().coverURL.getValue();anchorView.init(liveInfo, anchorPrepareView.getCoreView(), AnchorViewDefine.RoomBehavior.CREATE_ROOM);// 1. Custom function area - Example: Hide the anchor connection featureanchorView.disableFooterCoHost(true);setContentView(anchorView);}}
API | Description |
disableHeaderVisitorCnt(true) | Hide Top Audience List Feature |
disableFooterCoGuest(true) | Hide Bottom Audience Mic Connection Feature |
disableFooterCoHost(true) | Hide Bottom Anchor Connection Feature |
disableFooterBattle(true) | Hide Bottom Anchor PK Function |


Feature | Description | Integration Guide |
Audience Viewing | Audience can watch live streaming after entering the anchor's live streaming room, with features like audience mic connection, live room information, online audience, and bullet screen display. | |
Live Stream List | Display the live stream list interface and features, including the live stream list and room information display. | |
Gift System | Support custom gift asset configuration, billing system integration, and gift-sending in PK scenarios. |

Feedback