Skip to content

Commit

Permalink
Solve ANRs - play overlay music on another thread
Browse files Browse the repository at this point in the history
  • Loading branch information
yairm210 committed Dec 17, 2024
1 parent 9f4828d commit 096f62a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/com/unciv/ui/audio/MusicController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -630,8 +630,10 @@ class MusicController {
isLooping: Boolean = false,
fadeIn: Boolean = false
) {
val file = getMatchingFiles(folder, name).firstOrNull() ?: return
playOverlay(file, volume, isLooping, fadeIn)
Concurrency.run { // no reason for this to run on GL thread
val file = getMatchingFiles(folder, name).firstOrNull() ?: return@run
playOverlay(file, volume, isLooping, fadeIn)
}
}

/** Called for Leader Voices */
Expand Down

0 comments on commit 096f62a

Please sign in to comment.