URL からビデオを再生しようとしています。再生したいビデオは、次のような iTunes プレビュー ビデオです: http://a236.v.phobos.apple.com/us/r1000/051/Video/ec/1d/ 7f/mzm.hwbfvfdq..640x480.h264lc.d2.p.m4v iPhone で試してみて、プレーヤーを開くと、バッファが読み込まれていることがわかりますが、再生しても何も表示されません。 ...これはコードです:
- (void) moviePlayBackDidFinish:(NSNotification*)notification {
MPMoviePlayerController *moviePlayer = [notification object];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
if ([moviePlayer
respondsToSelector:@selector(setFullscreen:animated:)])
{
[moviePlayer.view removeFromSuperview];
}
[moviePlayer release];
}
- (IBAction)playVideo:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://a236.v.phobos.apple.com/us/r1000/051/Video/ec/1d/7f/mzm.hwbfvfdq..640x480.h264lc.d2.p.m4v"];
MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];
}