MediaPlayerフレームワークを使用してライブビデオをストリーミングすることを知りたいのですが、ビデオがダウンロードされて再生が開始されるまで待機しますか、それとも同時に実行しますか?
どうもありがとう。
質問する
553 次
1 に答える
0
これを試してください:
-(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:strSelectedVideoUrl]];
player.scalingMode = MPMovieScalingModeFill;
player.movieSourceType = MPMovieSourceTypeFile;
player.view.frame = CGRectMake(0, 45, 320, 400);
player.shouldAutoplay = YES;
[player prepareToPlay];
[self.view addSubview:player.view];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:) name:MPMoviePlayerPlaybackDidFinishNotification object:player];
[player play];
}
- (void) movieFinishedCallback:(NSNotification*) aNotification
{
MPMoviePlayerController *player1 = [aNotification object];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player1];
[player1.view removeFromSuperview];
[player1 release];
player1 = nil;
[self.navigationController popViewControllerAnimated:YES];
}
于 2013-03-04T13:21:53.277 に答える