Objective c 如何在iOS应用程序中播放网络视频?
我想在我的iOS应用程序中播放视频。视频将从网上下载。这可能会对您有所帮助Objective c 如何在iOS应用程序中播放网络视频?,objective-c,ios5,Objective C,Ios5,我想在我的iOS应用程序中播放视频。视频将从网上下载。这可能会对您有所帮助 #import <UIKit/UIKit.h> #import <MediaPlayer/MediaPlayer.h> @interface ViewController : UIViewController @property (nonatomic,strong)MPMoviePlayerController *moviePlayer; @end - (IBAction)playBu
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
@interface ViewController : UIViewController
@property (nonatomic,strong)MPMoviePlayerController *moviePlayer;
@end
- (IBAction)playButtonEvent:(id)sender
{
NSURL *url=[[NSURL alloc]initWithString:@"http://www.jplayer.org/video/m4v/Big_Bunny_Trailer.M4v"];
_moviePlayer=[[MPMoviePlayerController alloc]initWithContentURL:url];
[_moviePlayer.view setFrame:CGRectMake(20, 100, 380, 150)];
[self.view addSubview:_moviePlayer.view];
_moviePlayer.fullscreen=YES;
_moviePlayer.allowsAirPlay=YES;
_moviePlayer.shouldAutoplay=YES;
_moviePlayer.controlStyle=MPMovieControlStyleEmbedded;
}
查看教程。。此方法已弃用。查看从服务器URL播放视频的更新方式