Is it possible to play 2 video file simultaneously in the same view?
Is it possible to play 2 video files simultaneously in the same view?
I want to do have them both playing over half the screen, a little like this:
_ _ _ _ _ _ _ _ _ _ | | | | | 开发者_JS百科 VIDEO | | | |_ _ _ _ _ _ _ _ _ _| | | | | | VIDEO | | | |_ _ _ _ _ _ _ _ _ _|
How would I go about accomplishing this?
Thanks :)
apple's document said:
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.
so,you know...
Play 2 video's at a time is possible..
STEPS:
1.create 2 instance of MPMoviePlayer
2.set frame for 2 player by using CGRectMake
3.Add 2 players to the view(self.view)
I hope above steps are helpful for u.
setting frame for player only supported in iOS 3.2 and above versions.
Let me know you have any doubt.
Sample Code:
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];
You can use AVPlayer to play two video simultaneously seeting frame of Layer you can get the required frame Please follow following link.
精彩评论