1
我正在開發一個應用程序,我必須在同一時間錄製一首歌曲和一個wav文件。我從iPod音樂庫播放歌曲並在視圖控制器上放置了一個按鈕,點擊其中的一個WAV文件啓動,但是當我開始使用AVAudioRecorder錄製時,我的wav文件停止工作。 這是我的iPod音樂庫中的代碼: -如何在同一時間播放與AVPlayer和wav文件一起播放的歌曲?
- (void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItemCollection *) collection
{
MPMediaItem *item = [[collection items] objectAtIndex:0];
NSURL *url = [item valueForProperty:MPMediaItemPropertyAssetURL];
[self dismissModalViewControllerAnimated: YES];
// Play the item using AVPlayer
AVPlayerItem *playerItem = [[AVPlayerItem alloc] initWithURL:url];
player = [[AVPlayer alloc] initWithPlayerItem:playerItem];
[player play];
}
,這是我的代碼由即時通訊播放wav文件: -
-(void)playAudio:(NSString *)path
{
SystemSoundID soundIDWav;
NSString *sound = [NSString stringWithFormat:@"%@%@",[[NSBundle mainBundle] resourcePath], @"/wavFile.wav"];
NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)filePath, &soundIDWav);
AudioServicesPlaySystemSound(soundIDWav);
}
我錄製這兩個由AVAudioRecorder ... 請help.Thanks提前...