问题
I wanted to play audio at different levels on the left and right earphone. I used the following code to manipulate the levels.
MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext(),uri);
mediaPlayer.setVolume(0.1f,0.2f);
mediaPlayer.start();
This option does not generate any playback. When I change the code into the following:
mediaPlayer.setVolume(0.2f,0.2f);
The output seems to be fine and working(whenever right and left volume are equal). There seems to be no error displayed in the android studio Logcat as well.
(All tests were done on a Nexus 6 running Android 6.0.1)
来源:https://stackoverflow.com/questions/34285581/android-mediaplayer-setvolumeint-int-functionality-stops-playback-when-paramet