【发布时间】:2011-08-27 03:44:49
【问题描述】:
iPhone App :如何使用 MPMoviePlayerController 在应用中播放 Youtube 视频
为此我编写了代码:
NSString *urlAddress = @"http://www.youtube.com/xyz";
NSLog(@"URL ADDress : %@",urlAddress);
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];
movie = [[MPMoviePlayerController alloc] initWithContentURL:url];
movie.scalingMode=MPMovieScalingModeAspectFill;
movie.view.frame = CGRectMake(0.0, 0.0, 320.0, 460.0);
[self.view addSubview:movie.view];
[movie play];
如果我传递本地目录的 url,它正在播放视频
NSString* filePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Video.mp4"];
NSURL* url = [[[NSURL alloc] initFileURLWithPath:filePath] autorelease];
如何直接从 youtube url 播放视频到 MPMoviePlayerController?
【问题讨论】:
标签: iphone objective-c cocoa-touch youtube mpmovieplayercontroller