我在服务器网址上传了视频,并将网址传递给MPMoviePlayerController
以自动播放视频,但视频没有播放,我正在收到黑页。当我使用本地视频时,它正在播放。
NSURL *fileURL = [NSURL URLWithString:@"server.net/projects/media/videos/023.mp4"];
NSLog(@"Magento url is %@", fileURL);
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[[moviePlayerController view] setFrame:CGRectMake(100,200, 600, 500)];
[moviePlayerController setShouldAutoplay:YES];
[moviePlayerController setControlStyle:MPMovieControlStyleEmbedded];
[[moviePlayerController backgroundView] setBackgroundColor:[UIColor clearColor]];
[moviePlayerController prepareToPlay];
[self.view addSubview:moviePlayerController.view];
答案 0 :(得分:0)
我假设玩家没有加载视频的原因是因为您应该在开头添加http://
答案 1 :(得分:0)
试试这个
#import <MediaPlayer/MediaPlayer.h>
//MPMoviePlayer
NSURL *fileURL = [NSURL URLWithString:@"http://www.ebookfrenzy.com/ios_book/movie/movie.mov"];
NSLog(@"Magento url is %@", fileURL);
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[[moviePlayerController view] setFrame:CGRectMake(0, 0, 320, 568)];
[moviePlayerController setShouldAutoplay:YES];
[moviePlayerController setControlStyle:MPMovieControlStyleEmbedded];
[[moviePlayerController backgroundView] setBackgroundColor:[UIColor clearColor]];
[moviePlayerController prepareToPlay];
[self.view addSubview:moviePlayerController.view];
[moviePlayerController play];