您的位置:首页 > 产品设计 > 产品经理

MPMoviePlayerController

2016-02-06 14:32 591 查看
NSString *urlStr = [[NSBundle
mainBundle] pathForResource:@"1"
ofType:@"mp4"];

NSURL *url = [NSURL
fileURLWithPath:urlStr];

self.moviePlayer = [[MPMoviePlayerController
alloc]initWithContentURL:url];

self.view.frame =
self.moviePlayer.view.frame;

[self.view
addSubview:self.moviePlayer.view];

// UIViewAutoresizingFlexibleWidth
自动调整自己的宽度,保证与superView左边和右边的距离不变。

// UIViewAutoresizingFlexibleHeight
自动调整自己的高度,保证与superView顶部和底部的距离不变。

self.moviePlayer.view.autoresizingMask
= UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;

//
重新播放

self.moviePlayer.repeatMode =
NO;

[self.moviePlayer
play];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: