iPhone 应用程序:如何使用 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];
如果我传递本地目录的网址,它正在播放视频
NSString* filePath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Video.mp4"];
NSURL* url = [[[NSURL alloc] initFileURLWithPath:filePath] autorelease];
如何直接从 youtube url 播放视频到 MPMoviePlayerController?
IphoneDevSDk 上有一个很棒的线程。
他们使用隐藏的 UIWebView:http://www.iphonedevsdk.com/forum/iphone-sdk-development/61447-how-play-youtube-movie.html http://www.iphonedevsdk.com/forum/iphone-sdk-development/61447-how-play-youtube-movie.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)