TUILiveKit host streaming is powered by PusherView, a ready-to-use, fully featured interface designed for live streaming applications. It supports pre-stream preview, live video broadcasting, real-time audience interaction, and post-stream settlement, enabling rapid integration into your app.Host Preview Before Going Live | Host Live Streaming | Host and Audience Co-hosting |
![]() | ![]() | ![]() |
TUILiveKit trial version or activate the paid version.import android.os.Bundleimport androidx.activity.OnBackPressedCallbackimport androidx.appcompat.app.AppCompatActivityimport com.trtc.uikit.livekit.pusher.PusherViewclass PusherActivity : AppCompatActivity() {private lateinit var pusherView: PusherViewoverride fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)val liveID = intent.getStringExtra(EXTRA_LIVE_ID).orEmpty()// 1. Create PusherViewpusherView = PusherView(this)// 2. Set exit callback: triggered when closing the preview page or exiting the settlement pagepusherView.onExit = { finish() }// 3. Bind live room ID, must be called before setContentViewpusherView.bind(liveID)// 4. Add PusherView to the UIsetContentView(pusherView)// 5. During streaming, delegate back button handling to the component to avoid accidental exitsonBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {override fun handleOnBackPressed() {if (!pusherView.handleBackPressed()) {finish()}}})}companion object {const val EXTRA_LIVE_ID = "liveID"}}
bind(liveID) must be called before PusherView is mounted to the window; otherwise, the binding between the live room and the live connection Store will not be completed internally.AtomicPusher.startPush after the user clicks to start the live broadcast. When logging down, first enter the settlement page. Only after the user clicks "Exit" will it call back "onExit".handleBackPressed()' function returns' true ', indicating that the component has consumed the returned event (such as closing a pop-up layer or preventing accidental exits during live streaming). When false is returned, the host exits the page.import android.content.Contextimport android.content.Intentfun enterPusherPage(context: Context, liveID: String) {val intent = Intent(context, PusherActivity::class.java)intent.putExtra(PusherActivity.EXTRA_LIVE_ID, liveID)context.startActivity(intent)}
Method / Property | Description |
PusherView(context, attrs?, defStyleAttr?) | Constructor for creating the host streaming view. |
bind(liveID: String) | Bind the live room ID. Must be called before the view is mounted (e.g., setContentView). Internally, this creates the LiveSeatStore and co-hosting Store. |
onExit: (() -> Unit)? | Exit callback. Triggered when the user closes the pre-stream preview page or exits the post-stream settlement page; the component will clean up the session first. |
handleBackPressed(): Boolean | Handles the system back key: closes overlays within the component and prevents accidental exit during streaming. Returns true if handled, false if the host should exit the page. |
Stage | Description |
Pre-Stream Preview | Camera preview, title and cover setup, beauty and audio effect adjustments; clicking to start streaming initiates a countdown. |
Live Streaming | The component calls AtomicPusher.startPush to begin streaming, and displays live comments, gifts, audience co-hosting, online audience, and other interactive UI elements. |
Post-Stream Settlement | After streaming ends, session statistics are displayed. Exiting triggers onExit. |
Feature | Description | Integration Guide |
Audience Viewing | Allows audience members to join the host’s live room to watch the stream. Supports audience co-hosting, live room info, online audience list, live comments, and more. | |
Live Stream List | Displays the live stream list page and features, including the stream list and room details. | |
Gift System | Supports custom gift asset configuration, billing integration, PK mode interaction, and more. |

フィードバック