SystemSoundID soundID6; // declaration
NSURL *gamePlayMusic = [NSURL fileURLWithPath:[[NSBundle
mainBundle]pathForResource:@"song1" ofType:@"wav"]];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)Music,&soundID6);
AudioServicesPlaySystemSound(soundID6); //running of music
我可能知道在完成/完成后再次运行此音乐的代码。
答案 0 :(得分:1)
1. Add AVKit.framework.
2.create a global webview object like UIWebView* audioPlayerView;
3.create a button action for playing audio file
4.your mp3 file add in to your bundel.
-(IBAction)playAudioFile:(UIButton*)sender
{
NSString *path = [[NSBundle mainBundle] pathForResource:@"your file name" ofType:@"mp3"];
NSURL *targetURL = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
[audioPlayerView loadRequest:request];
[audioPlayerView setScalesPageToFit:YES];
[self.view addSubview:audioPlayerView];
}