5

I want to play two video in iPhone simultaneously.

There are two way to play video in iphone, One is use AVQueuePlayer. but in this controller I don't get how get the video playing is completed and how to restart video again.

Another way is MPMoviePlayerController . but in this controller I don't get how to seek video at particular time and also it is not able to play two video simultaneously as the AVQueuePlayer is able to play.

as a solution i am using AVQueuePlayer to play video and but can any one help me to restart video and get method to detect end point of the video. or know any other api to so this

Thanks in advance.

pablasso
  • 2,479
  • 2
  • 26
  • 32
Crazy Developer
  • 3,464
  • 3
  • 28
  • 62
  • Correct me if I am wrong, you want to play a video and when it ends you want to play another video. Is that right? – visakh7 Apr 25 '11 at 11:21

3 Answers3

1

I have found the solution to play two video . You can use AVQueuePlayer to play video. Using this controller you can play two video at the same time .

Crazy Developer
  • 3,464
  • 3
  • 28
  • 62
  • 1
    This is wrong answer. Apple doc:An AVQueuePlayer object to play a number of items in sequence. 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. http://developer.apple.com/library/mac/#documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/02_Playback.html#//apple_ref/doc/uid/TP40010188-CH3-SW4 http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMoviePlayerController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006953-CH3-DontLinkElementID_2 – san May 16 '12 at 10:47
0

I wonder if this is even possible. Video playback on the iPhone is ensured thanks to a hardware video decoder. And I really think the hardware decoder can only handle one video stream at a time.

Ecco
  • 1,323
  • 1
  • 11
  • 15
0

Ecco is correct. You're limited to one video at a time due to hardware restrictions.

However, if you're after 7KV7's suggestion of one video ending and triggering the playback of another, you can make use of the MPMoviePlayerPlaybackDidFinishNotification notification in the following way:

 - (void)viewDidLoad {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(firstMoviePlayerDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil];
    }

    - (void)moviePlayerDidFinish:(NSNotification *)notification {
        if (firstMovie) {
           [moviePlayerController setContentURL:nextMovieURL];
           [moviePlayerController play];
        } else {
           [[NSNotificationCenter defaultCenter] removeObserver:self];
        }
    }

Also, note that you can find the current playback point in a MPMoviePlayerController instance by examining the currentPlaybackTime property.

imnk
  • 4,342
  • 3
  • 29
  • 31