'Visualizer Stop Playing when Call second time in a project Android

My Scenario is that I have two fragment 1st Fragment Show All Audios 2nd Fragment Show Recently Played Audios

I am using chibde:audiovisualizer "android-audio-visualizer"

Visualizer Show on Both Fragments of the recycler view Position of the currently playing item

` public void enableVisualizer(BarVisualizer barVisualizer) {

    barVisualizer.setVisibility(View.VISIBLE);
    barVisualizer.setColor(context.getResources().getColor(R.color.equalizerAnimatedColor));
    barVisualizer.setDensity(20);
    barVisualizer.setPlayer(PlayerService.exoPlayerSessionID);
}` 

when this method is called the first time, then starts the visualizer, while calling from another fragment adapter to start the visualizer at that position of item playing, then the visualizer gets stuck at the first position (stops playback).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source