2014-10-27 78 views
0

我試圖在我的應用程序中創建一個功能,用戶可以通過「拖放」來更改已插入到AVMutableComposition軌道中的已修剪視頻的順序。更改AVMutableCompositionTrack段的順序

我可以通過使用「segments」屬性檢索包含軌道的每個段的NSArray,將此數組複製到另一個數組,對新數組進行必要的更改,但無法將新數組分配給AVMutableComposition軌道。

任何想法我該怎麼做?

任何幫助將不勝感激。

//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
/*! 
    @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; 

這應該給一些答案。