Fix: Prevent abrupt stop of custom sound playback

This commit is contained in:
Beingpax 2025-11-16 22:45:03 +05:45
parent 7365493366
commit ff0be0092b

View File

@ -52,6 +52,13 @@ class SoundManager: ObservableObject {
} }
private func reloadCustomSoundsAsync() async { private func reloadCustomSoundsAsync() async {
if customStartSound?.isPlaying == true {
customStartSound?.stop()
}
if customStopSound?.isPlaying == true {
customStopSound?.stop()
}
customStartSound = loadAndPreparePlayer(from: CustomSoundManager.shared.getCustomSoundURL(for: .start)) customStartSound = loadAndPreparePlayer(from: CustomSoundManager.shared.getCustomSoundURL(for: .start))
customStopSound = loadAndPreparePlayer(from: CustomSoundManager.shared.getCustomSoundURL(for: .stop)) customStopSound = loadAndPreparePlayer(from: CustomSoundManager.shared.getCustomSoundURL(for: .stop))
} }