play two video in iPhone simultaneously
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 MPMoviePlayerContr开发者_高级运维oller
. 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.
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 .
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 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.
精彩评论