我尝试使用以下 URL 播放来自 Dropbox 的视频:http ://www.dropbox.com/s/usqbtrjgcxu0ac6/pandaw.m4v但是当我播放时,它变成黑色并且我被打动了。
谁能告诉我如何在这里定义网址,我认为我的网址不正确,为什么我不能玩。
我的代码:
self.moviePlayerController =
[[MPMoviePlayerController alloc] initWithContentURL:[[NSURL alloc] initWithString:@"http://www.dropbox.com/s/usqbtrjgcxu0ac6/pandaw.m4v"]];//http://www.youtube.com/watch?v=x3TIBhQy3XY
// NSString *videoFileName = [[NSBundle mainBundle] pathForResource:@"pandaw" ofType:@"m4v" inDirectory:nil]; // self.moviePlayerController = // [[MPMoviePlayerController alloc] initWithContentURL: [NSURL fileURLWithPath:videoFileName]];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayerDidExitFullscreen:)
name:MPMoviePlayerDidExitFullscreenNotification
object:nil];
[self.moviePlayerController prepareToPlay];
self.moviePlayerController.backgroundView.backgroundColor=[UIColor purpleColor];
[self.moviePlayerController setFullscreen:YES];
self.moviePlayerController.useApplicationAudioSession = NO;
self.moviePlayerController.movieSourceType=MPMovieSourceTypeStreaming;
[self.moviePlayerController.view setFrame:self.view.bounds];
[self.view addSubview:self.moviePlayerController.view];
if (self.moviePlayerController.isPreparedToPlay==YES) {
[self.moviePlayerController play];
}else{
NSLog(@"not yet finish in preparing");
}
感谢您的帮助 !