AlarmKit - Custom Sounds?

Could someone please explain how to use a custom sound when setting up an alarm using AlarmKit? It keeps playing a default sound.

Also, I keep having an issue where the alarm sound plays but doesn’t show the alarm interface buttons unless the screen is locked.

What I did to play a custom sound was I just did Add File "Glass Drum.caf" to add it to the Bundle, then in the func where I schedule the alarm in the AlarmConfiguration I add sound: AlertConfiguration.AlertSound.named("Glass Drum.caf") and that works.

Also be sure you have imported ActivityKit.

My problem is that when I hit the Stop button, the alarm is dismissed, but the sound keeps playing.

I also have the problem where if I haven't locked the screen I get the sound but no alarm visual presentation.

Any help on those items would be great.

does it have to be a .caf file, or a certain duration sound file? mine is a .wav file.

I can't either, no matter caf/wav/m4a. I tried to put audio into bundle and library/sounds (check AlertConfiguration.AlertSound's doc) , no one works

I don't think it has to be a .caf file or a specific length. I made my sound in GarageBand and it's about 10 seconds in total, so not hugely long but more than just a simple beep, and I first made the sound quite awhile ago when caf was being promoted by Apple but I think any standard audio type that is compatible with CoreAudio should work.

Also, after you add your file make sure its Target Membership includes whatever Target will be calling the audio, that might have an effect. So if you are calling it from your LiveActivity Target, the sound may have to have the LiveActivity target as a Target Membership. I haven't tried that on a sound (mine is just a simple Lock Screen alarm) but I know that has an impact on other media.

AlarmKit - Custom Sounds?
 
 
Q