Android ExoPlayer - How to run ExoPlayer in background thread?

44 Views Asked by At

I'm using Jetpack Compose, and ExoPlayer to play video files. When I navigate to the Playback screen, the UI freezes while init/prepare ExoPlayer. I see the log, it has a lot of "skipped XXX frames". I found how to configure ExoPlayer to run on a background thread using HandlerThread. But the next issue is androidx.media3.ui.PlayerView cannot be used to display Video and the app crashes. So, how do we implement ExoPlayer run in a background thread?

1

There are 1 best solutions below

0
Kamal Nayan On

Have a look at this repo.

Repo Link : https://github.com/ZahraHeydari/MusicPlayer