Skip to main content

Using RtkGridView

The RtkGridView is a custom Android View provided by RealtimeKit-UI Android, designed to simplify the rendering of participant videos in a meeting. It abstracts the grid handling logic, making it easy to display videos in a grid layout.

To render participant videos using RtkGridView, follow these steps:

  1. Add RtkGridView to your layout:
<com.cloudflare.realtimekit.ui.view.grid.RtkGridView
android:id="@+id/rtk_grid_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
  1. Activate RtkGridView: In your fragment or activity class, activate the RtkGridView by calling the activate method with an instance of RealtimeKitClient.
import com.cloudflare.realtimekit.ui.view.grid.RtkGridView
import com.cloudflare.realtimekit.RealtimeKitClient

class MeetingFragment : Fragment() {
private lateinit var gridView: RtkGridView
private val meeting: RealtimeKitClient by lazy { RealtimeKitUIBuilder.meeting }

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
gridView = view.findViewById(R.id.rtk_grid_view)
gridView.activate(meeting)
}
}

After activation, the RtkGridView will automatically render the videos of the participants present in the meeting.

Render Participant videos using RtkGridView

Building Your Own UI

While RtkGridView provides a convenient way to render participant videos, you may want to customize the UI further. In the next section, we will explore how to build your own UI to render participant videos according to your application's specific requirements.