Got this error while initializing Visualizer
visualizer = new Visualizer(mediaPlayer.getAudioSessionId()); <----
Error: Cannot initialize Visualizer engine, error: -3 java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3
NB : This is only happening in Marshmallow
Got the cause of the problem !!!
This is caused for dynamic permission problem for Marshmallow.
It requires RECORD_AUDIO
permission to initialize it.
I need to give permission Manifest.permission.RECORD_AUDIO
before initialize the visualizer.
来源:https://stackoverflow.com/questions/35498734/android-error-code-3-when-initializing-visualizer