Anchor Preparation Page

Feature Overview

The anchor preparation page is where anchors preview the local camera, adjust beauty parameters, and flip the camera before starting the live broadcast. This document describes how to complete the access work for the anchor preparation page within 10 minutes.


Feature Integration

Note:
Note: Before completing the feature integration, you must first complete the integration steps in the overview.

Creating an Anchor Preparation Page View and Initializing

Kotlin
Java
val roomId = "1236666"

val anchorPrepareView = AnchorPrepareView(context)
anchorPrepareView.init(roomId, null)
String roomId = "live_123456";

mAnchorPrepareView = new AnchorPrepareView(this);
mAnchorPrepareView.init(roomId, null);

Load the Preparation Page Into the Activity

Kotlin
Java
setContentView(mAnchorPrepareView)
setContentView(mAnchorPrepareView);

Retrieve View Data Provided by the Host Preparation Page

The preparation page allows you to set the cover, live room name, and live mode. You can use the getState() api to retrieve the specific values you set.
Kotlin
Java
val state: PrepareState = anchorPrepareView.getState()
val roomName = state.roomName.getValue()
val coverURL = state.coverURL.getValue()
val liveMode: LiveStreamPrivacyStatus? = state.liveMode.getValue()
PrepareState state = mAnchorPrepareView.getState();
String roomName = state.roomName.getValue();
String coverURL = state.coverURL.getValue();
LiveStreamPrivacyStatus liveMode = state.liveMode.getValue();

Adding Go Live Button Click Event

Kotlin
Java
// Implement the AnchorPrepareViewDefine.AnchorPrepareViewListener interface in your Activity and override the following two methods.
// Callback for clicking the go live button
override fun onClickStartButton() {
//
}

override fun onClickBackButton() {
finish();
}

// Add a listener to the anchor preparation page view.
anchorPrepareView.addAnchorPrepareViewListener(this)
// Implement the AnchorPrepareViewDefine.AnchorPrepareViewListener interface in your Activity and override the following two methods.
// Callback for clicking the go live button
@Override
public void onClickStartButton() {

}

// Callback for clicking the return button
@Override
public void onClickBackButton() {
}

// Add a listener to the anchor preparation page view.
mAnchorPrepareView.addAnchorPrepareViewListener(this);

Feature Customization

Hiding the Operation Area View

Kotlin
Java
anchorPrepareView.disableFeatureMenu(true)
mAnchorPrepareView.disableFeatureMenu(true);

Hiding the Operation Area Beauty Effect Feature

Kotlin
Java
anchorPrepareView.disableMenuBeautyButton(true)
mAnchorPrepareView.disableMenuBeautyButton(true);

Hide Operation Area Sound Effect Feature

Kotlin
Java
anchorPrepareView.disableMenuAudioEffectButton(true)
mAnchorPrepareView.disableMenuAudioEffectButton(true);

Hide Operation Area Flip Feature

Kotlin
Java
anchorPrepareView.disableMenuSwitchButton(true)
mAnchorPrepareView.disableMenuSwitchButton(true);