Android Visualizer class throwing runtime exception

Viewed 5526

I am using AndroidFX Visualizer class in my demo app to read FFT but when i try to create object of that class its throwing Runtime exception (java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -1). Player class is my custom class for playback control and using same Player class i have implemented equalizer class and that's working fine. Do i need to add any permission in manifest file?

Player mediaPlayer = Player.GetInstance();
    mediaPlayer.LoadFile("song.mp3");
    mediaPlayer.Play();
    try{
    visual = new Visualizer(mediaPlayer.GetAudioSessionID()); // this line causing Exception 
    visual.setEnabled(true);
    visual.setCaptureSize(Visualizer.getCaptureSizeRange()[1]);
    }
    catch(Exception ex)
    {
        Log.e("Visual Ex", ex.getMessage());
    }
2 Answers
Related