mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-12 08:49:22 +07:00
Solve ANRs due to resuming music player which is in an unplayable state
This commit is contained in:
@ -544,7 +544,8 @@ class MusicController {
|
|||||||
*/
|
*/
|
||||||
fun resume(speedFactor: Float = 1f) {
|
fun resume(speedFactor: Float = 1f) {
|
||||||
Log.debug("MusicTrackController.resume called")
|
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)
|
val fadingStep = defaultFadingStep * speedFactor.coerceIn(0.001f..1000f)
|
||||||
current!!.startFade(MusicTrackController.State.FadeIn, fadingStep)
|
current!!.startFade(MusicTrackController.State.FadeIn, fadingStep)
|
||||||
// this may circumvent a PlaySingle, but -
|
// this may circumvent a PlaySingle, but -
|
||||||
|
Reference in New Issue
Block a user