你好,歡迎來到IOS教程網

 Ios教程網 >> IOS編程開發 >> IOS開發綜合 >> IOS 視頻播放--

IOS 視頻播放--

編輯:IOS開發綜合

[cpp] view plaincopyprint?在.h文件導入庫文件 

在.h文件導入庫文件[cpp]
#import <MediaPlayer/MPMoviePlayerViewController.h> 

#import <MediaPlayer/MPMoviePlayerViewController.h>
[cpp] view plaincopyprint?在.m實現文件中 

在.m實現文件中[cpp]
NSString *path=[[NSBundle mainBundle] pathForResource:@"name" ofType:@"mp4"]; 
NSURL *URL = [[NSURL alloc] initFileURLWithPath:path]; 
 
MPMoviePlayerViewController *_moviePlayerController = [[MPMoviePlayerViewController alloc] initWithContentURL:URL]; 
[[self GetViewController:self.view] presentMoviePlayerViewControllerAnimated:_moviePlayerController]; 
[_moviePlayerController.moviePlayer play]; 

NSString *path=[[NSBundle mainBundle] pathForResource:@"name" ofType:@"mp4"];
NSURL *URL = [[NSURL alloc] initFileURLWithPath:path];

MPMoviePlayerViewController *_moviePlayerController = [[MPMoviePlayerViewController alloc] initWithContentURL:URL];
[[self GetViewController:self.view] presentMoviePlayerViewControllerAnimated:_moviePlayerController];
[_moviePlayerController.moviePlayer play];

 

  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved