SystemSoundID soundID;
NSString *bundlePath = [[ NSBundle mainBundle] pathForResource:@"wav" ofType:@"mp4"];
NSURL *url =[NSURL fileURLWithPath:bundlePath];
//创建系统音频
OSStatus error = AudioServicesCreateSystemSoundID((__bridge CFURLRef _Nonnull)(url), & soundID);
if (error == 0) {
//播放 系统声音id从1000开始
//振动vibrate
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate);
AudioServicesPlaySystemSound(soundID);
}
网友评论