Could someone please help me with this.
I am attempting to play two quicktime movie in the same view controller simultaneously.
In the Support Files they are 1. xOxLeak1.mov
2. xOxLeak2.mov
In the Storyboard:
I have 2 Referencing Outlets 1. F17xOxLeak1MovieOutlet.
2. F18xOxLeak2MovieOutlet
In the ViewController2.h file:
#import <MediaPlayer/MediaPlayer.h>
@interface ViewController2: UIViewController
{
MPMoviePlayerController *moviePlayerController1;
MPMoviePlayerController *moviePlayerController2;
}
@property (weak, nonatomic) IBOutlet UIView *F17xOxLeak1MovieOutlet;
@property (weak, nonatomic) IBOutlet UIView *F18xOxLeak2MovieOutlet;
@endIn the ViewController2.m file:
- (void) viewDidLoad
{
[super viewDidLoad];
NSString *moviePath1 = [[NSBundle mainBundle] pathForResource: @"xOxLeak1"
ofType: @"mov"];
NSURL *movieURL1 = [NSURL fileURLWithPath: moviePath1];
moviePlayerController1 = [[MPMoviePlayerController alloc] initWithContentURL: movieURL1];
[moviePlayerController1.view setFrame: _F17xOxLeak1MovieOutlet.bounds];
[_F17xOxLeak1MovieOutlet addSubview: moviePlayerController1.view];
moviePlayerController1.controlStyle = MPMovieControlStyleNone;
[moviePlayerController1 prepareToPlay];
NSString *moviePath2 = [[NSBundle mainBundle] pathForResource: @"xOxLeak2"
ofType: @"mov"];
NSURL *movieURL2 = [NSURL fileURLWithPath: moviePath2];
moviePlayerController2 = [[MPMoviePlayerController alloc] initWithContentURL: movieURL2];
[moviePlayerController2.view setFrame: _F18xOxLeak2MovieOutlet.bounds];
[_F18xOxLeak2MovieOutlet addSubview: moviePlayerController2.view];
moviePlayerController2.controlStyle = MPMovieControlStyleNone;
[moviePlayerController2 prepareToPlay];
}
- (IBAction) showFleaOutletAction: (id) sender
{
[self showFleaOutlets];
[self playxOxLeak1Video];
[self playxOxLeak2Video];
}
- (void) playxOxLeak1Video];
{
[moviePlayerController1 play];
}
- (void) playxOxLeak2Video];
{
[moviePlayerController2 play];
}
- (void) didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
@endWhen the app displays ViewController2 the user should see the 2 videos play simultaneously side by side. What happens though, is the xOxLeak1 displays black until the video is finished, while xOxLeak2 pays just fine.
I commented out all the code that displays the xOxLeak2 video and suddenly xOxLeak1 plays just fine. So it isn't something wrong with the xOxLeak1.mov file. It's as if Xcode doesn't allow two Quicktime videos to play at the same time in a ViewController.
Is that what's happening? Can anyone see what the problem is?
JR