Caused by: java.lang.RuntimeException: Cannot initialize effect engine for type: 0bed4300-ddd6-11db-8f34-0002a5d5c51b Error: -3

我只是一个虾纸丫 提交于 2019-12-11 09:52:12

问题


I am testing equalizer in my Android Version 7.1.1 but it shows a Runtime Exception but It's perfectly working on below version 7.0.

When I try to initialize equalizer :

private static UUID EQUALIZER_UUID;
mp = MediaPlayer.create(this, R.raw.a);
mp.start();
if(hasEqualizer()) {
   equalizer = new Equalizer(0, mp.getAudioSessionId());
   equalizer = equalizerUtil.getEqualizer(mp);
   Log.d("No. of Presets",String.valueOf(equalizer.getNumberOfPresets()));
}

public static boolean hasEqualizer() {
    for (AudioEffect.Descriptor effect : AudioEffect.queryEffects()) {
        if (EQUALIZER_UUID.equals(effect.type)) {
            return true;
        }
    }
    return false;
}

It Shows Error :

java.lang.RuntimeException: Cannot initialize effect engine for type: 0bed4300-ddd6-11db-8f34-0002a5d5c51b Error: -3
          at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2678)
          at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2743)
          at android.app.ActivityThread.-wrap12(ActivityThread.java)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1490)
          at android.os.Handler.dispatchMessage(Handler.java:102)
          at android.os.Looper.loop(Looper.java:154)
          at android.app.ActivityThread.main(ActivityThread.java:6165)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
Caused by: java.lang.RuntimeException: Cannot initialize effect engine for type: 0bed4300-ddd6-11db-8f34-0002a5d5c51b Error: -3

I had tried various solutions available on - java.lang.RuntimeException: Cannot initialize effect engine for type: 0bed4300-ddd6-11db-8f34-0002a5d5c51b Error: -3, but Nothing works

Can someone have any ideas?


回答1:


It looks like it might be an issue with getAudioSessionId() if a session ID isn't available yet. See this response on the thread linked below:

That means it hasn't been set yet. You can use player.setAudioDebugListener to listen for the ID being set (the ID will be passed via onAudioSessionId when it is).

https://github.com/google/ExoPlayer/issues/2357



来源:https://stackoverflow.com/questions/48649507/caused-by-java-lang-runtimeexception-cannot-initialize-effect-engine-for-type

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!