Fixed music playing automatically after setting playback speed and pitch

This commit is contained in:
Prathamesh More 2022-06-20 11:28:08 +05:30
parent 5ac1b2bcc6
commit 0f66d005c7

View file

@ -333,6 +333,10 @@ internal fun crossFadeScope(): CoroutineScope = CoroutineScope(Job() + Dispatche
fun MediaPlayer.setPlaybackSpeedPitch(speed: Float, pitch: Float) {
if (hasMarshmallow()) {
val wasPlaying = isPlaying
playbackParams = PlaybackParams().setSpeed(speed).setPitch(pitch)
if (!wasPlaying) {
pause()
}
}
}