iOS如何用AVPlayer达到4.0的播放率?

How to achieve a playback rate of 4.0 with AVPlayer in iOS?

player.rate = 4.0 对我不起作用。

使用 AVPlayer 达到 4.0 的速率是否是一个好方法,还是有更好的方法?

使用[AVComposition scaleTimeRange:toDuration:]制作快动作AVAsset

float rate = 4.0;
AVAsset *asset = [AVAsset assetWithURL:someURL];
AVMutableComposition *composition = [AVMutableComposition composition];
NSError *error = nil;
[composition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset.duration)
                     ofAsset:asset
                      atTime:kCMTimeZero error:&error];
[composition scaleTimeRange:CMTimeRangeMake(kCMTimeZero, asset.duration)
                 toDuration:CMTimeMultiplyByFloat64(asset.duration, 1 / rate)];
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:composition];
AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem];