Solve ANRs - play overlay music on another thread

This commit is contained in:
yairm210 2024-12-17 11:42:53 +02:00
parent 9f4828d55a
commit 096f62a719

View File

@ -630,9 +630,11 @@ class MusicController {
isLooping: Boolean = false, isLooping: Boolean = false,
fadeIn: Boolean = false fadeIn: Boolean = false
) { ) {
val file = getMatchingFiles(folder, name).firstOrNull() ?: return Concurrency.run { // no reason for this to run on GL thread
val file = getMatchingFiles(folder, name).firstOrNull() ?: return@run
playOverlay(file, volume, isLooping, fadeIn) playOverlay(file, volume, isLooping, fadeIn)
} }
}
/** Called for Leader Voices */ /** Called for Leader Voices */
fun playVoice(name: String) = playOverlay(name, "voices", settings.voicesVolume) fun playVoice(name: String) = playOverlay(name, "voices", settings.voicesVolume)