0
當使用Android的澳新VolumeShaper,我試圖用MediaPlayer的創建:MediaPlayer.createVolumeShaper拋出IllegalArgumentException:無效的配置或操作:-19
// Create a VolumeShaper configuration
VolumeShaper.Configuration volumeShaperConfig =
new VolumeShaper.Configuration.Builder()
.setDuration(3000)
.setCurve(new float[] {0.f, 1.f}, new float[] {0.f, 1.f})
.setInterpolatorType(VolumeShaper.Configuration.INTERPOLATOR_TYPE_LINEAR)
.build();
mVolumeShaper = mMediaPlayer.createVolumeShaper(configuration);
mMediaPlayer.setDataSource(context, uri);
mMediaPlayer.prepareAsync();
當我嘗試運行它,然而,它拋出一個異常:
Caused by: java.lang.IllegalArgumentException: invalid configuration or operation: -19
at android.media.VolumeShaper.applyPlayer(VolumeShaper.java:189)
at android.media.VolumeShaper.<init>(VolumeShaper.java:54)
at android.media.MediaPlayer.createVolumeShaper(MediaPlayer.java:1392)