您的位置:首页 > 其它

检测iphone 是不是震动模式 并播放音频文件

2014-10-16 18:37 411 查看
检测iphone 是不是震动模式 并播放音频文件

if (![AVAudioSessionPortHeadsetMic isEqualToString:[[AVAudioSession sharedInstance] category]] && ![RecorderManager sharedManager].isRecording)
{
SystemSoundID soundToPlay;
NSString *path = [[NSBundle mainBundle] pathForResource:@"messagein" ofType:@"caf"];
NSURL *pathURL = [NSURL fileURLWithPath : path];
AudioServicesCreateSystemSoundID((__bridge CFURLRef) pathURL, &soundToPlay);
//playback
AudioServicesPlaySystemSound(soundToPlay);
}else
{
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: