droid-vizu icon indicating copy to clipboard operation
droid-vizu copied to clipboard

Caused by: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3

Open TheRedSpy15 opened this issue 6 years ago • 2 comments

What is error -3? Keeps coming from soundPlayerView.setMediaPlayer(mediaPlayer);

here's my code:

private void setUpVisualizer() {

        SoundPlayerView soundPlayerView = findViewById(R.id.sound_player_view);
        soundPlayerView.setMediaPlayer(mediaPlayer);
        soundPlayerView.setPlayStopListener(new SoundPlayerView.OnMediaControlListener() {
            @Override
            public void onPlay() {
                visualizer.play();
            }

            @Override
            public void onStop() {
                visualizer.stop();
            }
        });

        visualizer.setMediaPlayer(mediaPlayer);
        visualizer.setCurrentRenderer(new BarRenderer(16, PaintUtil.getBarGraphPaint(Color.RED)));
        visualizer.setRippleColor(Color.RED);
    }

XML file: (also tested it with the visualizer being inside the sound player view

<info.kimjihyok.ripplesoundplayer.RippleVisualizerView
        android:id="@+id/visualizer"
        android:layout_width="202dp"
        android:layout_height="116dp"
        android:layout_margin="16dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/albumView"
        app:layout_constraintTop_toBottomOf="@+id/songNameView" />

    <info.kimjihyok.ripplesoundplayer.SoundPlayerView
        android:id="@+id/sound_player_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"/>

Full exception:

java.lang.RuntimeException: Unable to start activity ComponentInfo{theredspy15.fosyplayer/theredspy15.fosyplayer.MainActivity}: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
                      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
                      at android.app.ActivityThread.-wrap11(Unknown Source:0)
                      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                      at android.os.Handler.dispatchMessage(Handler.java:105)
                      at android.os.Looper.loop(Looper.java:164)
                      at android.app.ActivityThread.main(ActivityThread.java:6541)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                   Caused by: java.lang.RuntimeException: Cannot initialize Visualizer engine, error: -3
                      at android.media.audiofx.Visualizer.<init>(Visualizer.java:218)
                      at info.kimjihyok.ripplesoundplayer.RippleVisualizerView.setMediaPlayer(RippleVisualizerView.java:65)
                      at theredspy15.fosyplayer.MainActivity.setUpVisualizer(MainActivity.java:174)
                      at theredspy15.fosyplayer.MainActivity.onCreate(MainActivity.java:77)
                      at android.app.Activity.performCreate(Activity.java:6975)
                      at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
                      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)

TheRedSpy15 avatar Jun 11 '18 13:06 TheRedSpy15

I have this error too

TwinsOd avatar Nov 08 '18 13:11 TwinsOd

I too facing this issue is there any solution for this

ganesh04071996 avatar Jun 04 '19 14:06 ganesh04071996