Playing video using ExoPlayer
In this section, we’ll harness the full power of ExoPlayer so that we can integrate it into our newly created video playback UI. Let’s learn how we can do this.
Creating PlaybackActivity
We’ll start by creating a new Activity
for this functionality called PlaybackActivity
:
class PlaybackActivity: ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { PlaybackScreen() } } }
This PlaybackActivity
activity will show our already created PlaybackScreen()
in its content.
We also want our playback UI to be always displayed in landscape mode. To do so, we’ll configure this activity in the AndroidManifest...