[英]Simultaneously recording video and playing audio file
我正在開發一個iPhone應用程序,其中需要從iPhone前置攝像頭錄制視頻並同時播放兩者之間的音頻文件。 我使用AVCamCaptureManager錄制視頻。 我正在后台使用dispatch_queue錄制視頻,如下所示:
// ------ This will start recording in Background --------
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[self startRecordingInBackground];
});
在播放一些音頻文件之前,它可以正常工作。
// ----- Playing Audio File ---------
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Start_b4_counting_down" ofType:@"mp3" inDirectory:Nil];
NSLog(@"filePath %@", filePath);
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: filePath];
self.theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:NULL];
self.theAudio.volume = 10.0;
self.theAudio.delegate = self;
[self.theAudio prepareToPlay];
[self.theAudio play];
音頻文件一播放,視頻記錄就會停止,並且不會恢復。
我對這個主題沒有任何想法,但也許這個答案對您會有所幫助。 祝好運!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.