2

我正在使用 MPMoviePlayerController 从 URL 流式传输音频。我将其设置为全屏模式以获得更好的控制视图

        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 回答