-3

我想在我的 iOS 应用中播放视频。视频将从网络下载。

4

1 回答 1

1

这可能会帮助你

#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;
}
于 2013-02-18T06:55:03.473 回答