utk*_*tel 6 iphone mpmovieplayercontroller ios ios7
NSString *path = [[NSBundle mainBundle] pathForResource:@"PTCL" ofType:@"mp4"];
NSURL *videoURL = [NSURL URLWithString:path];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[moviePlayerController.view setFrame:self.view.frame];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.controlStyle=MPMediaTypeAnyVideo;
moviePlayerController.fullscreen = YES;
[moviePlayerController prepareToPlay];
[moviePlayerController play];
Run Code Online (Sandbox Code Playgroud)
NSString *path = [[NSBundle mainBundle] pathForResource:@"PTCL" ofType:@"mp4"];
path=[NSString stringWithFormat:@"file:/%@",path];
NSURL *videoURL = [NSURL URLWithString:path];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[moviePlayerController.view setFrame:self.view.frame];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.shouldAutoplay=YES;
moviePlayerController.controlStyle=MPMediaTypeAnyVideo;
moviePlayerController.fullscreen = YES;
[moviePlayerController prepareToPlay];
[moviePlayerController play];
Run Code Online (Sandbox Code Playgroud)
我得到第一个代码的videURL路径
我正在获取第二个代码的videURL路径.
我有alos使用
NSURL *videoURL = [[NSURL alloc]init];
videoURL = [[NSBundle mainBundle] URLForResource:@"PTCL" withExtension:@"mp4"];
Run Code Online (Sandbox Code Playgroud)
但我的视频播放器总是显示文件正在加载,没有任何反应.我知道一些我在做错的地方,但我的运气不好.请更正我的错误或告诉我是否有其他方式播放本地视频文件.请.

| 归档时间: |
|
| 查看次数: |
8426 次 |
| 最近记录: |