4つの異なるビデオクリップに対応する左側に4つのボタンがあるiPadアプリがあります。ユーザーが見たいビデオをタップすると、右側に表示されます。読み込み中のように見せたい(インターネット経由でストリーミングしているように)。黒のビデオフレームの中央にUIActivityIndicatorを追加し、3秒間一時停止するスレッドを作成しました。ただし、前のビデオを含むプレーヤーは消えません。前のビデオの最後のフレームで3秒間フリーズし(アクティビティインジケーターが非表示)、新しいビデオが表示されます。
プレイヤーを一時的に非表示にする方法について何かアイデアはありますか?助けてくれてありがとう。これが私のコードです:
-(IBAction) videoButton1{
[player stop];
[player release];
[self.activityIndicator startAnimating];
NSString *url = [[NSBundle mainBundle] pathForResource:@"video1" ofType:@"mov"];
[self setupVideoPlayer:url];
}
-(void) setupVideoPlayer: (NSString *) url{
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url)];
player.view.frame = CGRectMake(487, 205, 478, 320);
[self.view addSubview:player.view];
[NSThread sleepForTimeInterval:3.0];
self.activityIndicator stopAnimating];
[player play];
}