-1
NSURL *url= [NSURL URLWithString:@"http://www.dailymotion.com/video/x109z02"];
MPMoviePlayerController  *theMoviPlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
theMoviPlayer.scalingMode = MPMovieScalingModeFill;
theMoviPlayer.view.frame = CGRectMake(0, 60, 320, 350);
[self.view addSubview:theMoviPlayer.view];
[self.theMoviPlayer play];

框架也在.h文件中添加和导入,但视频没有在iphone中播放(互联网连接也可以)

4

2 回答 2

2
NSURL *url   = [NSURL URLWithString:@"http://www.ebookfrenzy.com/ios_book/movie/movie.mov"];
_moviePlayer = [[MPMoviePlayerController alloc]
                                          initWithContentURL:url];

[[NSNotificationCenter defaultCenter] addObserver:self
                                      selector:@selector(moviePlayBackDidFinish:)
                                      name:MPMoviePlayerPlaybackDidFinishNotification
                                      object:_moviePlayer];

_moviePlayer.controlStyle   = MPMovieControlStyleDefault;
_moviePlayer.shouldAutoplay = YES;
[self.view addSubview:_moviePlayer.view];
[_moviePlayer setFullscreen:YES animated:YES];
于 2013-05-29T06:50:36.003 回答
1

使用UIWebView,一个非常简单易行的方法。

于 2013-05-29T06:53:31.893 回答