Playing Multiple Videos on iPAD

后端 未结 4 1492
青春惊慌失措
青春惊慌失措 2020-12-17 06:21

I am facing some problem in playing multiple videos on iPAD. I am trying to play multiple thumbnail videos on the same view. You can say its much like the CCTV camera.Well,

相关标签:
4条回答
  • 2020-12-17 06:24

    This is actually pretty simple to do on the iPad.

    You basically need multiple MPMoviePlayerController objects.

    Each MPMoviePlayerController object has a view property, you just need to set the frames of the views on the different MPMoviePlayerController objects to match what you want it to look like.

    Here is a simple example using two MPMoviePlayerController objects ans 2 different frames:

    MPMoviePlayerController *player =
            [[MPMoviePlayerController alloc] initWithContentURL: myURL];
    [[player view] setFrame: yourFrame1];
    [myView addSubview: [player view]];
    // ...
    [player play];
    
    MPMoviePlayerController *player2 =
                [[MPMoviePlayerController alloc] initWithContentURL: myURL2];
    [[player2 view] setFrame: yourFrame2];
    [myView addSubview: [player2 view]];
    // ...
    [player2 play];
    
    0 讨论(0)
  • 2020-12-17 06:31

    MPMoviePlayerController will allow multiple instances, but only one of them can be playing their movie at any given time.

    It mentions it here: http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPMoviePlayerController_Class/MPMoviePlayerController/MPMoviePlayerController.html

    From the article:

    Note: Although you may create multiple MPMoviePlayerController objects and present their views in your interface, only one movie player at a time may play its movie.

    0 讨论(0)
  • 2020-12-17 06:32

    You can't use the MKMediaFramework to play multiple videos. You can however do this with the lower level AVFoundation Framework. It's not as hard as you might think and I've made a tutorial that goes over it here: http://www.sdkboy.com/?p=66

    Essentially what you need to do is extend UIView so it contains an AVPlayerLayer to which the output of an AVPlayer object is directed, then you can create multiple instances of this UIView that you feed video using AVPlayer instances.

    0 讨论(0)
  • 2020-12-17 06:47

    May be When Creating a WebView and using a HTML5 Video instance you can run multiple videos at the same time

    0 讨论(0)
提交回复
热议问题