Android MediaPlayer.setVolume(int,int) functionality stops playback when parameters have different values

為{幸葍}努か 提交于 2019-12-12 18:51:29

问题


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

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