我嘗試使用此URL從Dropbox播放視頻:http://www.dropbox.com/s/usqbtrjgcxu0ac6/pandaw.m4v但是當我播放時,它變成黑色,我感到震驚。無法使用ios本地播放器從drobox播放視頻
誰能告訴我如何在這裏定義網址,我認爲我的網址是不正確的,爲什麼我不能玩。
我的代碼:
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:無]; // 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");
}
感謝您的幫助!