2

URL からオーディオをストリーミングするために MPMoviePlayerController を使用しています。より良いコントロールビューのためにフルスクリーンモードに設定しました

        MPMoviePlayerController *audioStreamer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:URL]];
//[audioStreamer.view  setFrame:CGRectMake(0,0,320,460)];
[audioStreamer.view  setFrame:self.view.bounds];

//[self.view addSubview: audioStreamer.view];
[self.view insertSubview:audioStreamer.view belowSubview:HUD.view];
[audioStreamer setFullscreen:YES animated:YES];

//[audioStreamer.view addSubview:HUD.view];

[[NSNotificationCenter defaultCenter] addObserver: self 
                                         selector: @selector(loadStateChanged:) 
                                             name: MPMoviePlayerLoadStateDidChangeNotification 
                                           object: audioStreamer];

[audioStreamer prepareToPlay];

ストリーミングと再生の準備中に、ユーザーがオーディオの読み込みを考えられるように、UIactivicty インジケーターを表示したいと考えています。全画面表示モードで MPMoviePlayerController の黒い画面を表示する際のアクティビティ インジケーターに関する提案またはコードが必要です。

4

1 に答える 1

1

これには独自の実装が必要です....

これはコントローラーなので、のビューを取得できますMPMoviePlayerController。を作成し、UIActivityIndicatorViewこれを のビューに配置するだけMPMoviePlayerControllerです。コードを参照してください。

UIActivityIndicatorView *activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
activityIndicator.frame = CGRectMake(140, 200, 50, 21);
[activityIndicator startAnimating];
[self.view addSubview:activityIndicator];
[activityIndicator release];   

デリゲート メソッドを通じてムービーが開始されたら、このインジケーターを停止します。

于 2012-05-23T08:51:43.727 に答える