Integrating ExoPlayer in Jetpack Compose Android

https://9to5google.com/2021/07/28/jetpack-compose-1-0-android-ui-kotlin/

Hi Android Devs in this article i am going to show you how you can integrate latest exoplayer library in your jetpack compose android app. My code does not contains any deprecated code in integration of exoplayer.

First declare exoplayer library in your gradle file:

Note: only use latest library of exoplayer else you will face errors in your code.

Now add Internet permission in your android manifest file:

If you face below exception:

com.google.android.exoplayer2.upstream.HttpDataSource$CleartextNotPermittedException

then add line in your application tag in manifest file.

Now go to your activity and write below code:

Now call uiContainer() from setContent{} inside onCreate method of your activity.

Output:

Check this repository for full code:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store