私はAVFoundation
オーディオのみを使用して作業しています。つまり、ビデオは使用せず、複数AVComposition
の を次々に結合して、1 つのAVComposition
.
例: 2 つだけAVComposition
。次のように AVPlayer を作成することで、それぞれが正常に再生されます。
_player = [AVPlayer playerWithPlayerItem:[AVPlayerItem playerItemWithAsset:comp]]
のcomp
インスタンスですAVMutableComposition
。(ちなみに、_player
ivar でなければならないことに注意してください。そうしないと、ARC は再生前に時期尚早にそれをリリースします - それを追跡するのにしばらく時間がかかりました。)
よかった - 実行中
[_player play]
comp
正常に再生されます。
ただし、これは失敗します。
(のカスタム サブクラスでself.segments
あるNSMutableArray
要素を含むAVMutableComposition
)
AVMutableComposition *comp = [AVMutableComposition composition];
NSError *err;
for (AVMutableComposition* c in self.segments) {
[comp insertTimeRange:CMTimeRangeMake(kCMTimeZero, segment.duration)
ofAsset:segment atTime:comp.duration error:&err];
DLog(@"Error was %@", segment, err);
}
このコードが実行されたときのすべての要素について、メソッドself.segments
を呼び出すときに次のエラーが発生します。insertTimeRange::::
Error was Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not
be completed" UserInfo=0x14e8e7f0 {NSLocalizedDescription=The operation could not be
completed, NSUnderlyingError=0x14d7f580 "The operation couldn’t be completed. (OSStatus
error -12780.)", NSLocalizedFailureReason=An unknown error occurred (-12780)}
このエラーが何を示しているかについての情報を見つけることができません。何か案は?