当前位置:编程学习 > wap >>

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];

 

补充:移动开发 , IOS ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,