我正在尝试在我的应用中创建一个功能,用户可以在其中拖放"更改已插入AVMutableComposition轨道的修剪视频的顺序。
我可以使用"段"来检索包含每个音轨片段的NSArray。 property,将此数组复制到另一个数组中,对新数组进行了必要的更改,但无法将新数组分配到AVMutableComposition轨道的segments数组中。
任何想法我该怎么做?
任何帮助将不胜感激。
//retrieving the segments array
NSMutableArray *compTracksArr = [[NSMutableArray alloc] initWithArray:compTrack.segments];
//making changes to the order
[compTracksArr replaceObjectAtIndex:0 withObject:[compTracksArr lastObject]];
//assigning changed array to segments array
compTrack.segments = [NSArray arrayWithArray:compTracksArr];
但是当我尝试通过NSLog()获取输出时,compTrack.segments不会显示组件顺序的任何变化。
答案 0 :(得分:0)
/*!
@method validateTrackSegments:error:
@abstract Tests an array of AVCompositionTrackSegments to determine whether they conform
to the timing rules noted above (see the property key @"trackSegments").
@param trackSegments
The array of AVCompositionTrackSegments to be validated.
@param error
If validation fais, returns information about the failure.
@discussion
The array is tested for suitability for setting as the value of the trackSegments property.
If a portion of an existing trackSegments array is to be modified, the modification can
be made via an instance of NSMutableArray, and the resulting array can be tested via
-validateTrackSegments:error:.
*/
- (BOOL)validateTrackSegments:(NSArray *)trackSegments error:(NSError **)error;
这应该给出一些答案。