知道何时可以播放AVPlayer对象
我正在尝试播放从上一个MP3传递到的文件(存储在变量中)。UIViewUIViewNSURL *fileURL 我正在初始化一个AVPlayer: player = [AVPlayer playerWithURL:fileURL]; NSLog(@"Player created:%d",player.status); 该NSLog打印Player created:0,我想通意味着它是还没准备好打。 当我单击该播放时UIButton,运行的代码是: -(IBAction)playButtonClicked { NSLog(@"Clicked Play. MP3:%@",[fileURL absoluteString]); if(([player status] == AVPlayerStatusReadyToPlay) && !isPlaying) // if(!isPlaying) { [player play]; NSLog(@"Playing:%@ with %d",[fileURL absoluteString], player.status); isPlaying = YES; } else if(isPlaying) { [player pause]; NSLog(@"Pausing:%@",[fileURL absoluteString]); isPlaying = NO; } else …