AudioTooBox

系统音频播放

震动
//id = 1520 是3d touch的pop震动反馈,id = 1519 是3d touch的peek震动反馈
//id = kSystemSoundID_Vibrate 是系统声音
SystemSoundID soundID = kSystemSoundID_Vibrate;
AudioServicesPlaySystemSound(soundID)
播放系统声音
//soundID 1000-
AudioServicesPlaySystemSound(soundID)
播放自定义音频
//自定义音频地址
 CFURLRef urlRef;
//为自定义音频记录id
SystemSoundID soundID;
//创建id
AudioServicesCreateSystemSoundID(urlRef, &soundID)
//播放
AudioServicesPlaySystemSound(soundID)

自定义音频支持.mp3,.wav等格式,但是音频长度建议在30秒内,不可过长

你可能感兴趣的:(AudioTooBox)