Is it possible to play 2 video files in one view at the same time?

Is it possible to play 2 video files at the same time at the same time?

I want them both to play half the screen, something like this:

 _ _ _ _ _ _ _ _ _ _ _ 
| |
| |
| VIDEO |
| |
| _ _ _ _ _ _ _ _ _ _ _ | |
| |
| |
| VIDEO |
| |
| _ _ _ _ _ _ _ _ _ _ _ | |

How can i do this?

Thank:)

+3
source share
3 answers

apple document said:

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

So you know ...

+7
source

It is possible to play 2 videos at a time.

:

1. 2 MPMoviePlayer

2.set frame 2- CGRectMake

3. 2 (self.view)

, u.

iOS 3.2 .

, - .

:

player1.view.frame = CGRectMake(0, 0, 320, 240);
[self.view addSubview:player1.view];
[[NSNotificationCenter defaultCenter]addObserver:self 
                                        selector:@selector(movieFinishedCallback:)
                                            name:MPMoviePlayerPlaybackDidFinishNotification
                                          object:player1];
[player1 play];
player2.view.frame = CGRectMake(0, 241, 320, 220);
[self.view addSubview:player2.view];
[[NSNotificationCenter defaultCenter]addObserver:self 
                                        selector:@selector(movieFinishedCallback:)
                                            name:MPMoviePlayerPlaybackDidFinishNotification
                                          object:player2];
[player2 play];
+6

You can use AVPlayer to play two video images in one layer. You can get the required frame. Follow the link .

+2
source

Source: https://habr.com/ru/post/1793809/


All Articles