0

When I try to change video speed on Android 9.0, it dosen't work. Only fo 9.0 and only when set speed over 1.0. I just use mIjkVideoPlayer.setSpeed(1.0). It works on all other devices under 9.0. ijkplayer verson: 0.8.8 and this is the error log:

11-29 15:55:14.241 6747-6801/com.xiao.nicevieoplayer E/J4A: J4AC_android_media_AudioTrack__setSpeed 1.100000 11-29 15:55:14.241 6747-6801/com.xiao.nicevieoplayer D/AudioTrack: isSampleRateSpeedAllowed_l denied mAfLatency:80 mAfFrameCount:1920 mAfSampleRate:48000 sampleRate:44100 speed:1.100000 mFrameCount:3544 < minFrameCount:3888 11-29 15:55:14.241 6747-6801/com.xiao.nicevieoplayer W/AudioTrack: setPlaybackRate(1.100000, 1.000000) failed (buffer size) 11-29 15:55:14.242 6747-6801/com.xiao.nicevieoplayer W/System.err: java.lang.IllegalArgumentException: arguments out of range 11-29 15:55:14.242 6747-6801/com.xiao.nicevieoplayer W/System.err: at android.media.AudioTrack.native_set_playback_params(Native Method) 11-29 15:55:14.242 6747-6801/com.xiao.nicevieoplayer W/System.err: at android.media.AudioTrack.setPlaybackParams(AudioTrack.java:1902) 11-29 15:55:14.242 6747-6801/com.xiao.nicevieoplayer W/System.err: java.lang.IllegalArgumentException: arguments out of range 11-29 15:55:14.242 6747-6801/com.xiao.nicevieoplayer W/System.err: at android.media.AudioTrack.native_set_playback_params(Native Method) 11-29 15:55:14.242 6747-6801/com.xiao.nicevieoplayer W/System.err: at android.media.AudioTrack.setPlaybackParams(AudioTrack.java:1902)

king meng
  • 11
  • 2
  • I found the source code explanation Another possible cause is that the AudioTrack is streaming * (see {@link #MODE_STREAM}) and the * buffer size is too small. For speeds greater than 1.0f, the AudioTrack buffer * on configuration must be larger than the speed multiplied by the minimum size * {@link #getMinBufferSize(int, int, int)}) to allow proper playback. – king meng Dec 13 '18 at 06:37
  • but how to set the audiotrack buffer on configuration – king meng Dec 13 '18 at 06:37

1 Answers1

0

add this line when init ijkMediaPlayer:

ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "soundtouch", 1);
king meng
  • 11
  • 2