This tutorial shows you how to use Kohii to enable Video playback in a RecyclerView, including automatic start/pause playbacks, recycling playback resources to reduce the memory usage and improve the performance.
The Application we are about to build will:
It is suggested to finish the previous tutorial first. Also you need to be familiar with the RecyclerView at basic level.
We will start with what has been done after the step 1 of this tutorial.
We will need to add RecyclerView dependency, and use it in our layout file. This step has nothing to do with Kohii yet, but a important starting step. You can find the change here:
In this step, we add more details about the implementation. In reality, you will have your own data source with many different Videos. In this step, we will just reuse a Video file for all data items. Also to make it close to real life scenario, I will use the AndroidX Lifecycle library in the code:
Below is our App after the step 2: