How to set progress to specific position of exo_progress of ExoPlayer in RecyclerView?

Viewed 56

I want UI Something like the attached screenshot.

enter image description here

This all will be a list of mp3 audio, which is user has played at some point already and left in middle.

I am using ExoPlayer for mp3 and PlayerControlView for UI. I have to take a separate DefaultTimeBar view of exoplayer for each item of recyclerview, and manage it with conditions. As I have taken one instance of exoplayer throughout the app.

Problem:

When I am playing one item, It will work fine with that item but also started seeking for all the items together.

enter image description here

Here is my Logic in RecyclerViewAdapter:

        if (data.isPlaying) {
            player?.let {
                // Setting Player to UI
                playerView.player = it
            }
        } else {
            player?.let {
                // Setting Player to UI
                playerView.player = it
                
                // Set progress bar to the previously player position
                playerView.findViewById<DefaultTimeBar>(R.id.exo_progress).apply {
                    setPosition(alreadyPlayedPosition ?: 0)
                }
            }
        }

Can Anyone have an idea about this? Or can suggest any other way.

Thanks in Advance!

0 Answers
Related