mirror of
https://github.com/yairm210/Unciv.git
synced 2024-12-22 16:54:24 +07:00
Solve ANRs due to resuming music player which is in an unplayable state
This commit is contained in:
parent
d26d942f58
commit
afbc15db79
@ -544,7 +544,8 @@ class MusicController {
|
||||
*/
|
||||
fun resume(speedFactor: Float = 1f) {
|
||||
Log.debug("MusicTrackController.resume called")
|
||||
if (state == ControllerState.Pause && current != null) {
|
||||
if (state == ControllerState.Pause && current != null
|
||||
&& current!!.state.canPlay && current!!.music != null) {
|
||||
val fadingStep = defaultFadingStep * speedFactor.coerceIn(0.001f..1000f)
|
||||
current!!.startFade(MusicTrackController.State.FadeIn, fadingStep)
|
||||
// this may circumvent a PlaySingle, but -
|
||||
|
Loading…
Reference in New Issue
Block a user