开发者

Is there a possibility to play 2 videos simultaneously by url

开发者 https://www.devze.com 2023-02-11 14:45 出处:网络
Before start my task i want to know the possibilities for playing 2 videos simultaneously(together) by using url.

Before start my task i want to know the possibilities for playing 2 videos simultaneously(together) by using url.

Code that i'm tried for play the video in a partial screen:

player = [[MPMoviePlayerController alloc] initWithContentURL:[self movieURL]];
player.view.frame = CGRectMake(100, 150, 250, 300);
[self.view addSubview:player.view];
[[NSNotificationCenter defaultCenter]addObserver:self
                                        selector:@selector(movieFinishedCallback:)
                                            name:MPMoviePlayerPlaybackDidFinishNotification
                                          object:player];
[player play];

Error: error:request开发者_开发技巧 for member 'view' in somthing not a structure or union

Anyone Helpme...


Not normally. MPMoviePlayerController works by connecting to a separate server process, which does the actual video decompression. It only decompresses one stream at a time, so only one movie view can have playing content at once.

Your best bet is to use your favorite video editing software to combine both movies into a single movie, side by side. Obviously this is no good if you want to play/pause/rewind them separately. Or, if one of the movies is very small, convert it to still frames and use UIImageView's multi-image animation feature. Playing h.264 from a remote URL is right out, though.

[Edited to add:]

This was true for iOS 3.x, but iOS 4 and later have video support in AVFoundation, specifically, the AVPlayer and AVPlayerLayer classes. If you use them to construct movie views, you can have more than one going at once, independently. What you don't get are the stock MPMoviePlayerController transport controls (play/pause/scrub bar); with AVFoundation you have to roll your own if you want something similar.


Yeah sure, you can play two videos simultaneaously, even on each other

Checkout this url & get an idea.

0

精彩评论

暂无评论...
验证码 换一张
取 消