开发者

Overriding iOS system volume to play alarm

开发者 https://www.devze.com 2023-03-14 17:26 出处:网络
I have an alarm application and if user reduces the phone volume using the hardware keys the alarm volume also gets affected. I have noticed few of the other alarm applications raising alarm ev开发者_

I have an alarm application and if user reduces the phone volume using the hardware keys the alarm volume also gets affected. I have noticed few of the other alarm applications raising alarm ev开发者_运维技巧en if system volume is zero or muted. How i can achieve the same? iam currently using both AVAudioPlayer & MPMusicPlayerController for playing audio.


You can set volume on both MPMusicPlayerController and on AVAudioPlayer.

For example:

MPMusicPlayerController *musicPlayer = [MPMusicPlayerController applicationMusicPlayer];
musicPlayer.volume = 1.0;
0

精彩评论

暂无评论...
验证码 换一张
取 消