当我尝试播放实时流时,播放器被暂停。
这是我创建播放器的方式:
AVAsset *asset = [AVAsset assetWithURL:self.url];
AVPlayerItem *item = [[AVPlayerItem alloc] initWithAsset:asset];
self.audioPlayer = [[AVPlayer alloc] initWithPlayerItem:item];
if (@available(iOS 10.0, *)){
self.audioPlayer.automaticallyWaitsToMinimizeStalling = NO;
}
然后播放:
if (@available(iOS 10.0, *)){
[self.audioPlayer playImmediatelyAtRate:1.0];
} else {
[self.audioPlayer play];
}
当我用timeControlStatus
和status
做KVO时
我在日志中看到了这一点:
PLAYER: AVPlayerStatusReadyToPlay
PLAYER: AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate
<AVPlayerItem: 0x2812c88c0, asset = <AVURLAsset: 0x2810f6e40, URL = https://*****128.mp3>>
PLAYER: AVPlayerWaitingWithNoItemToPlayReason
PLAYER: AVPlayerTimeControlStatusPause