xmpp即时通讯之接收消息提示声音+震动

来源:互联网 发布:网络监控系统主要功能 编辑:程序博客网 时间:2024/04/30 05:29

使用AudioServicesPlaySystemSound 这个接口来进行声音和震动的播放, 当然需要在工程中加入AudioToolBox.framework


1. 播放震动

     

AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);



2. 播放特定的声音

static SystemSoundID soundIDTest = 0;

NSString * path = [[NSBundle mainBundlepathForResource:@"test" ofType:@"wav"];

if (path) {

      AudioServicesCreateSystemSoundID( (CFURLRef)[NSURL fileURLWithPath:path], &soundIDTest );

}

    AudioServicesPlaySystemSoundsoundIDTest );

0 0
原创粉丝点击