-1
我试图使用相同的按钮来播放和停止我的电台流,我的按钮播放良好,然后当我按下它停止,它只停止几秒钟,然后开始播放。MPMoviePlayerController停止按钮不起作用
这里是我使用的代码。
- (IBAction)playStream:(id)sender {
self.buttonPressed.selected = !self.buttonPressed.selected;
NSString *urlAddress = @"http://67.159.28.74:8730";
NSURL *url = [NSURL URLWithString:urlAddress];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc]initWithContentURL:url];
player.movieSourceType = MPMovieSourceTypeStreaming;
player.view.hidden = YES;
self.myPlayer = player;
[self.view addSubview:self.myPlayer.view];
if (player.playbackState == MPMoviePlaybackStateStopped){
[self.myPlayer play];}
else if (player.playbackState == MPMoviePlaybackStatePlaying){
[self.myPlayer stop];}
}
任何人反馈将不胜感激 – Luna