我试图在tick方法的倒数计时器中的一个应用程序中设置Tick声音/音频,但是10秒钟后,该Mediaplayer音频变为静音,任何人都可以检查一下。
countDownTimer = new CountDownTimer(seekBar.getProgress() * 1000 + 100, 1000) {
public void onTick(long millisUntilFinished) {
Log.i("started", "that");
Log.i("seconds left", String.valueOf(millisUntilFinished));
taskupdate((int) millisUntilFinished / 1000);
mediaPlayer2 = MediaPlayer.create(getApplicationContext(), R.raw.tick);
mediaPlayer2.start();
}
public void onFinish() {
mediaPlayer = MediaPlayer.create(MainActivity.this, R.raw.airhorn);
mediaPlayer.start();