Playing 2 Quicktime movies in the same view controller.

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;

@end



In 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];
  }
@end


When 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

Hello everyone.


I'm replying to my old post so it gets shunted up to the front again. I need this problem solved and tried many ways but I'm not getting anywhere. I hope I am not braking protocol by doing this but I need answers.


JR

It might not be possible...

http://stackoverflow.com/questions/5753107/play-two-video-in-iphone-simultaneously


http://stackoverflow.com/questions/6475849/can-avplayer-instances-be-used-to-play-two-videos-simultaneously


You should also be aware that the MPMoviePlayerController is depricated...

https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/


https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVPlayerViewController_Class/index.html#//apple_ref/occ/cl/AVPlayerViewController


https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVPlayer_Class/index.html#//apple_ref/occ/instm/AVPlayer/play

It isn't possible...

https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPMoviePlayerController_Class/

Note

Although you can create multiple

MPMoviePlayerController
objects and present their views in your interface, only one movie player at a time can play its movie.

Playing 2 Quicktime movies in the same view controller.
 
 
Q