博客> 播放系统音的代码
播放系统音的代码
2017-10-17 03:46 评论:0 阅读:365 LetCodeEasy
ios

CFBundleRef mainBundle;

SystemSoundID soundFileObject;

mainBundle = CFBundleGetMainBundle ();

CFURLRef soundFileURLRef  = CFBundleCopyResourceURL (mainBundle, CFSTR ("蔡琴 - 爱断情伤"), CFSTR ("wav"), NULL);

AudioServicesCreateSystemSoundID (soundFileURLRef, &soundFileObject);

AudioServicesPlaySystemSound(soundFileObject);

//Xcode7.0之前还要插入依赖库avf

收藏
0
sina weixin mail 回到顶部