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:

implementation "com.google.android.exoplayer:exoplayer:2.17.1"

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

Now add Internet permission in your android manifest file:

<uses-permission android:name="android.permission.INTERNET"/>

If you face below exception:

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

then add line in your application tag in manifest file.

android:usesCleartextTraffic="true"

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:

--

--

--

Android Dev | Data Science | Researcher

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Data Binding in android fragments with Kotlin

Android Development #2

How to create a Circular Determinate Progress Bar with Kotlin for your Android Project

The Day39#100DaysOfCode: Flutter Plugin

Setup an Android Application (APK) Security Testing Environment on Lineage OS (Raspberry Pi…

HMS Kit Integration in Android Studio Arctic Fox

Animations in Navigation Compose

Create Custom Packages for Flutter Apps

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
Muhammad Danish

Muhammad Danish

Android Dev | Data Science | Researcher

More from Medium

Jetpack DataStore in Android

Kotlin Coroutine Context Element Ordering Causing Unexpected Behavior.

Listview/Recyclerview using android Jetpack compose LazyColumn

Android Jetpack Compose