AVQueuePlayer无法从远程URL平滑播放wav文件。它起伏不定,停在中间

时间:2017-06-16 14:37:21

标签: ios objective-c avplayer

这是初始化AVQueuePlayer的代码。

AVQueuePlayer *queuePlayer = [[AVQueuePlayer alloc] init];
    queuePlayer.actionAtItemEnd = AVPlayerActionAtItemEndNone;

    if ([queuePlayer respondsToSelector:@selector(automaticallyWaitsToMinimizeStalling)])
            queuePlayer.automaticallyWaitsToMinimizeStalling = NO;

    AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:url];

    if (playerItem)
            [queuePlayer insertItem:playerItem afterItem:nil];

    if ([queuePlayer respondsToSelector:@selector(playImmediatelyAtRate:)])
                [queuePlayer playImmediatelyAtRate:1.0];
    else [queuePlayer play];

0 个答案:

没有答案