加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

iphone – 如何在单一视图中显示多个视频?

发布时间:2020-12-14 19:22:31 所属栏目:百科 来源:网络整理
导读:我尝试使用以下代码在单帧中显示多个视频 NSBundle *bundle=[NSBundle mainBundle];NSString *moviePath1=[bundle pathForResource:@"tom1" ofType:@"mp4"];NSURL *movieUrl1=[NSURL fileURLWithPath:moviePath1];MPMoviePlayerController *movie1=[[MPMovie
我尝试使用以下代码在单帧中显示多个视频

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);
[videoScrollViewObj addSubview:movie2.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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读