2016-08-03 1 views
0
SystemSoundID soundID6; // declaration  
NSURL *gamePlayMusic = [NSURL fileURLWithPath:[[NSBundle 
mainBundle]pathForResource:@"song1" ofType:@"wav"]]; 

AudioServicesCreateSystemSoundID((__bridge CFURLRef)Music,&soundID6);  
AudioServicesPlaySystemSound(soundID6); //running of music 

この音楽を終了/完了後にもう一度実行する方法を知っているかもしれません。ios sdkで何度もオーディオファイルを実行するには

答えて

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]; 
    } 
関連する問題