AVPlayer在开始播放音频直播后暂停

时间:2019-11-06 14:25:37

标签: ios avplayer

当我尝试播放实时流时,播放器被暂停。

这是我创建播放器的方式:

    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];
        }

当我用timeControlStatusstatus做KVO时 我在日志中看到了这一点:

PLAYER: AVPlayerStatusReadyToPlay

PLAYER: AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate

<AVPlayerItem: 0x2812c88c0, asset = <AVURLAsset: 0x2810f6e40, URL = https://*****128.mp3>>

PLAYER: AVPlayerWaitingWithNoItemToPlayReason

PLAYER: AVPlayerTimeControlStatusPause

0 个答案:

没有答案