Class: AVMutableComposition
- Inherits:
-
AVComposition
- Object
- NSObject
- AVAsset
- AVComposition
- AVMutableComposition
Overview
AVMutableComposition is a mutable subclass of AVComposition you use when you want to create a new composition from existing assets. You can add and remove tracks, and you can add, remove, and scale time ranges.
Instance Attribute Summary (collapse)
-
- tracks
readonly
An array of AVMutableCompositionTrack objects contained by the composition.
Attributes inherited from AVAsset
#availableChapterLocales, #availableMediaCharacteristicsWithMediaSelectionOptions, #availableMetadataFormats, #commonMetadata, #compatibleWithSavedPhotosAlbum, #composable, #creationDate, #duration, #exportable, #hasProtectedContent, #lyrics, #playable, #preferredRate, #preferredTransform, #preferredVolume, #providesPreciseDurationAndTiming, #readable, #referenceRestrictions
Class Method Summary (collapse)
-
+ composition
Returns a new, empty, mutable composition.
Instance Method Summary (collapse)
-
- addMutableTrackWithMediaType:preferredTrackID:
Adds an empty track to the receiver.
-
- insertEmptyTimeRange:
Adds or extends an empty timeRange within all tracks of the composition.
-
- insertTimeRange:ofAsset:atTime:error:
Inserts all the tracks within a given time range of a specified asset into the receiver.
-
- mutableTrackCompatibleWithTrack:
Returns a track in the receiver into which any time range of a given asset track can be inserted.
-
- removeTimeRange:
Removes a specified timeRange from all tracks of the composition.
-
- removeTrack:
Removes a specified track from the receiver.
-
- scaleTimeRange:toDuration:
Changes the duration of all tracks in a given time range.
Methods inherited from AVAsset
assetWithURL:, #cancelLoading, #chapterMetadataGroupsBestMatchingPreferredLanguages:, #chapterMetadataGroupsWithTitleLocale:containingItemsWithCommonKeys:, #mediaSelectionGroupForMediaCharacteristic:, #metadataForFormat:, #trackWithTrackID:, #tracksWithMediaCharacteristic:, #tracksWithMediaType:, #unusedTrackID
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Attribute Details
- (Array) tracks (readonly)
An array of AVMutableCompositionTrack objects contained by the composition. (read-only) In a mutable composition, the tracks are instances of AVMutableCompositionTrack, whereas in AVComposition the tracks are instances of AVCompositionTrack.
Class Method Details
+ (AVMutableComposition) composition
Returns a new, empty, mutable composition.
Instance Method Details
- (AVMutableCompositionTrack) addMutableTrackWithMediaType(mediaType, preferredTrackID:preferredTrackID)
Adds an empty track to the receiver. You can get the actual trackID of the new track through its @"trackID" key.
- (Object) insertEmptyTimeRange(timeRange)
Adds or extends an empty timeRange within all tracks of the composition. If you insert an empty time range into the composition, any media that was presented during that interval prior to the insertion will be presented instead immediately afterward. You can use this method to reserve an interval in which you want a subsequently created track to present its media.
- (Boolean) insertTimeRange(timeRange, ofAsset:asset, atTime:startTime, error:outError)
Inserts all the tracks within a given time range of a specified asset into the receiver. This method may add new tracks to ensure that all tracks of the asset are represented in the inserted time range.Existing content at the specified start time is pushed out by the duration of the time range. Media data for the inserted time range is presented at its natural duration; you can scale it to a different duration using scaleTimeRange:toDuration:.
- (AVMutableCompositionTrack) mutableTrackCompatibleWithTrack(track)
Returns a track in the receiver into which any time range of a given asset track can be inserted. For best performance, you should keep the number of tracks of a composition should be kept to a minimum, corresponding to the number for which media data must be presented in parallel. If you want to present media data of the same type serially, even from multiple assets, you should use a single track of that media type. You use this method to identify a suitable existing target track for an insertion.If there is no compatible track available, you can create a new track of the same media type as track using addMutableTrackWithMediaType:preferredTrackID:.This method is similar to compatibleTrackForCompositionTrack: (AVAsset).
- (Object) removeTimeRange(timeRange)
Removes a specified timeRange from all tracks of the composition. After removing, existing content after the time range will be pulled in.Removal of a time range does not cause any existing tracks to be removed from the composition, even if removing timeRange results in an empty track. Instead, it removes or truncates track segments that intersect with the time range.
- (Object) removeTrack(track)
Removes a specified track from the receiver. When it is removed track’s @“composition” key is set to nil. The values of its other keys remain intact, for arbitrary use.
- (Object) scaleTimeRange(timeRange, toDuration:duration)
Changes the duration of all tracks in a given time range. Each track segment affected by the scaling operation will be presented at a rate equal to source.duration / target.duration of its resulting time mapping.