List of usage examples for android.media MediaPlayer getPlaybackParams
@NonNull public native PlaybackParams getPlaybackParams();
From source file:github.popeen.dsub.service.DownloadService.java
private synchronized void applyPlaybackParams(MediaPlayer mediaPlayer) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { float playbackSpeed = getPlaybackSpeed(); try {//from w ww . j a va 2 s . c om if (Math.abs(playbackSpeed - 1.0) > 0.01 || mediaPlayer.getPlaybackParams() != null) { PlaybackParams playbackParams = new PlaybackParams(); playbackParams.setSpeed(playbackSpeed); mediaPlayer.setPlaybackParams(playbackParams); } } catch (Exception e) { Log.e(TAG, "Error while applying media player params", e); } } }