0
當我添加代碼以附加BassBoost
效果時,我的的onCompletionListener
立即被觸發。這裏的相關代碼:爲什麼onCompletionListener會立即觸發附加的AudioEffect?
player.setDataSource(context, Uri.parse(song.filename));
// everything is fine if I comment out these 3 lines
BassBoost boost = new BassBoost(0, player.getAudioSessionId());
boost.setStrength((short) 1000);
player.attachAuxEffect(boost.getId());
player.prepare();
player.start();
我已經試驗了這個特定的代碼的順序無濟於事。最後,我在完成處理程序中記錄了getCurrentPosition()
和getDuration()
值,你不知道它們:它們都是零!
我目前的想法是,附加效應需要異步準備,但我一直未能找到任何進一步的線索。