MediaPlayer:在Android中以状态0错误开始调用

时间:2019-01-06 21:02:14

标签: java android android-mediaplayer

运行程序时出现此错误:

E/MediaPlayerNative:start called in state 0, mPlayer(...) error(-38, 0) 

我尝试使用onPreparedListener,但是我不确定如何使用它。关于这两个主题的任何帮助(为什么出错或onPreparedListener)都将大有帮助。

public void onChallenge1Click(View view) {
    Log.e("SynthesizerActivity", "Challenge 1 Button Clicked");
    mpE.start();
    delayPlaying(WHOLE_NOTE / 2);
    mpFS.start();
    delayPlaying(WHOLE_NOTE / 2);
    mpGS.start();
    delayPlaying(WHOLE_NOTE / 2);
    mpA.start();
    delayPlaying(WHOLE_NOTE / 2);
    mpB.start();
    delayPlaying(WHOLE_NOTE / 2);
    mpCS.start();
    delayPlaying(WHOLE_NOTE / 2);
    mpDS.start();
    delayPlaying(WHOLE_NOTE / 2);
    mpHighE.start();
    delayPlaying(WHOLE_NOTE / 2);
}

0 个答案:

没有答案