Fixed music playing automatically after setting playback speed and pitch
This commit is contained in:
parent
5ac1b2bcc6
commit
0f66d005c7
1 changed files with 4 additions and 0 deletions
|
@ -333,6 +333,10 @@ internal fun crossFadeScope(): CoroutineScope = CoroutineScope(Job() + Dispatche
|
||||||
|
|
||||||
fun MediaPlayer.setPlaybackSpeedPitch(speed: Float, pitch: Float) {
|
fun MediaPlayer.setPlaybackSpeedPitch(speed: Float, pitch: Float) {
|
||||||
if (hasMarshmallow()) {
|
if (hasMarshmallow()) {
|
||||||
|
val wasPlaying = isPlaying
|
||||||
playbackParams = PlaybackParams().setSpeed(speed).setPitch(pitch)
|
playbackParams = PlaybackParams().setSpeed(speed).setPitch(pitch)
|
||||||
|
if (!wasPlaying) {
|
||||||
|
pause()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue