iphone - 如何在单个 View 中显示多个视频?

标签 iphone objective-c xcode

我尝试使用以下代码在一帧中显示多个视频

NSBundle *bundle=[NSBundle mainBundle];
NSString *moviePath1=[bundle pathForResource:@"tom1" ofType:@"mp4"];
NSURL *movieUrl1=[NSURL fileURLWithPath:moviePath1];
MPMoviePlayerController *movie1=[[MPMoviePlayerController alloc]initWithContentURL:movieUrl1];
movie1.view.frame=CGRectMake(15, 15, 80, 80);

[videoScrollViewObj addSubview:movie1.view];


NSBundle *bundle1=[NSBundle mainBundle];
NSString *moviePath2=[bundle1 pathForResource:@"tom2" ofType:@"mp4"];
NSURL *movieUrl2=[NSURL fileURLWithPath:moviePath2];
MPMoviePlayerController *movie2=[[MPMoviePlayerController alloc]initWithContentURL:movieUrl2];
movie2.view.frame=CGRectMake(15, 110, 80, 80);
[videoScrollViewObj addSubview:movie2.view];'

但我只收到最后一个视频。

谁能告诉我如何在一个 View 中显示多个视频。谢谢你

最佳答案

Because documentation says :

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

关于iphone - 如何在单个 View 中显示多个视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9095252/

相关文章:

javascript - 用户界面自动化:iPhone app - how to tap "OK" button when an alert appears

ios - QuickBlox : didReceiveNewSession Method is not gettimg called in swift

objective-c - Objective-C - 如何访问 OS X 服务 "Summarize"

iphone - Storyboard中新 View Controller 的类

ios - 框架 "weak-link"是什么意思?

iphone - dealloc 的行为非常奇怪 - 没有被调用

iphone - 如何随机放置 UIButton 和值

objective-c - 为什么我必须在 __bridge_transfer 之后调用 CFRelease?

objective-c - 属性复制在Cocoa框架中意味着什么?(如UITabBar的items属性)

ios - 重新加载 Collection View 数据时对成员 'collectionView(_:numberOfItemsInSection:)' 的引用不明确