首页 > 移动平台 > 详细

IOS 播放音频

时间:2014-06-27 19:21:05      阅读:362      评论:0      收藏:0      [点我收藏+]

1,播放短音频

#import <AudioToolbox/AudioToolbox.h>
#import "GLYViewController.h"
static void completionCallback(SystemSoundID mySSID)
{
AudioServicesPlaySystemSound(mySSID);
}
@interface GLYViewController ()

@end

@implementation GLYViewController
SystemSoundID crash;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSURL* crashUrl = [[NSBundle mainBundle] URLForResource:@"crash"
withExtension:@"wav"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)crashUrl, &crash);

AudioServicesAddSystemSoundCompletion(crash, NULL, NULL, (void *)completionCallback, NULL);
}
- (IBAction)play:(id)sender {
AudioServicesPlayAlertSound(crash);
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

@end

IOS 播放音频,布布扣,bubuko.com

IOS 播放音频

原文:http://www.cnblogs.com/guanliyang/p/3809682.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!