I'm trying to retrieve the audioSession of the current player on android in order to send it to the Visualizer class, but all attempts are not working.
I tried this:
AudioManager audioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
assert audioManager != null;
int audioSessionId = audioManager.generateAudioSessionId();
// Create the Visualizer object and attach it to our media player.
mVisualizer = new Visualizer(audioSessionId);
mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
According to the documentation it is this way.