ページ

2011年5月28日土曜日

iPhoneシミュレータでサーバー上にあるVideoを再生する

iPhoneシミュレータでサーバー上にあるVideoを再生する

サーバー上にあるファイルを再生する方法を調べてみた。



moviePlayerServerViewController.h
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>

@interface moviePlayerServerViewController : UIViewController {

 
}

-(IBAction) playMovie:(id)sender;

@end


#import "moviePlayerServerViewController.h"

@implementation moviePlayerServerViewController


-(IBAction) playMovie:(id)sender{


 NSString *path = @"http://192.168.1.243/media/video.mp4";
 NSURL *mMovieURL = [[NSURL URLWithString: path] retain];
 MPMoviePlayerController *theMovie = [[MPMoviePlayerController alloc] initWithContentURL:mMovieURL];
 theMovie.scalingMode = MPMovieScalingModeAspectFill;
 [theMovie play];
 MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:mMovieURL];
 [self presentMoviePlayerViewControllerAnimated:moviePlayer];
 
}

- (void)didReceiveMemoryWarning {
 // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
 
 // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
 // Release any retained subviews of the main view.
 // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

@end


参考


Play vlc video on iphone - iPhone Dev SDK Forum
http://www.iphonedevsdk.com/forum/iphone-sdk-development/70243-play-vlc-video-iphone.html

0 件のコメント:

コメントを投稿