Overriding iOS system volume to play alarm
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;
精彩评论