首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

播发音频 AVAudioPlayer(实例)

2012-07-01 
播放音频 AVAudioPlayer(实例)1.?AVFoundation?Build Phases Link Binary With Libraies + AVFou

播放音频 AVAudioPlayer(实例)

1.?AVFoundation

?

Build Phases => Link Binary With Libraies => + => AVFoundation.framework => add

?

firstviewcontroller.h

?

test.mp3 拖放到 Supporting Files 文件夹。

?

播放,暂停和停止

- (IBAction)toplay:(id)sender{    CFBundleRef mainBundle = CFBundleGetMainBundle();    CFURLRef soundFileURLRef;    soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"sound1", CFSTR ("wav"), NULL);        UInt32 soundID;    AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);    AudioServicesPlaySystemSound(soundID);}
?

视频:

http://www.youtube.com/watch?v=lSJhYx28Krg&feature=youtu.be

?

?

?

?

?

热点排行