-1

我在服务器 url 中上传了视频,并将 URL 传递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];
4

2 回答 2

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];
于 2014-09-23T10:12:19.267 回答
0

我假设播放器不加载视频的原因是因为您应该http://在开头添加

于 2014-09-23T09:53:45.427 回答