Search code examples
iosmpmovieplayercontroller

Cloning an instance of a MPMoviePlayer


I know that you can have one instance of MPMoviePlayer at a time in screen, but i successfully implemented a tableview with cells as big as screen bounds with reference to a single instance of a MPMoviePlayer stored in the AppDelegate. Since the cells are as big as the screen I have no problems with transition but I'm getting some glitches every time you tap the screen to change the cell displayed (I have paging enabled) and you interrupt the transition between cells, the player's view just disappears (I'm not really sure if it's a tableview's cell reuse matter or a MPMoviePlayer's thing). Anyway I'm wondering to avoid tableview's matters and use one big scrollview with contentSize width double the screen… and just build two clones of the AppDelegate's MPMoviePlayer instance. Just cloning the view with something like

UIView *view = [[UIView alloc]initwithframe:myFrame];
view = myAppDelegate.streamPlayer.view;

doesn't seem to work… Any ideas? Hope the question fits the forum guidelines

Edit: Maybe it's clearer if I put it like this:"It's possible to have 2 copies of the same instance of a MPMoviePlayer on the same screen?"


Solution

  • Probably the question was not that clear… But if you want to have 2 instance of a player, playing together the same clip, you need to have 2 instance of AVPlayer. This is from where I started:

    http://iosguy.com/2012/01/11/multiple-video-playback-on-ios/

    It's very clear