4

I have been trying to do this for a few days now using AVFoundation as well as trying to use MPMoviePlayerViewController. The closest I can get is allowing one to play at a time. I would like to think that this is possible because of Facetime. However, I know this is a little different because there is no separate video file.

Any ideas would help, and thanks.

brad_roush
  • 235
  • 1
  • 3
  • 10

2 Answers2

1

Have you tried to play video on one thread and recording video on another? That would allow both of them to run while maintaining their separation.

brandonbocklund
  • 595
  • 4
  • 11
  • Thanks, I think this is the right direction to go. Would you be able to point me to an example as to how this would be implemented correctly. So I can see if this will work, and I'll accept your answer. Thanks. – brad_roush Nov 30 '11 at 20:32
  • 1
    It would be hard for me to explain it in a really concise example... Threading is one of those things that you have to go out and learn (like Core Data, if you have learned how to use in a similar as the one I used, it basically consisted of reading through Apple Docs to find out how to work it) So, here is the link to the Apple Documentation for setting up and implementing threads: Good Luck! http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Multithreading/Introduction/Introduction.html – brandonbocklund Dec 01 '11 at 03:53
1

I'm not sure where this is documented, but to get AVCaptureVideoPreviewLayer and MPMoviePlayerViewController to play together at the same time you need to set a mixable audio session category first.

Here's one way to do that:

AVAudioSession* session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback error:nil];
UInt32 mixable = 1;
AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryMixWithOthers, sizeof(mixable), &mixable);
[session setActive:YES error:nil];

See the Audio Session Programming Guide and Audio Session Cookbook for more info.

Rhythmic Fistman
  • 34,352
  • 5
  • 87
  • 159