Instance Method


Inserts all of the tracks in a specified time range of an asset into a movie.


func insertTimeRange(_ timeRange: CMTimeRange, of asset: AVAsset, at startTime: CMTime, copySampleData: Bool) throws



The time range of the asset to be inserted.


An AVAsset object indicating the source of the inserted media. This value can't be nil.


The time in the target movie at which the media is to be inserted.


A Boolean value that indicates whether sample data is to be copied from the source to the destination during edits.


An error that describes the nature of the failure.

Return Value

A Boolean value that indicates whether the tracks were successfully inserted.


This method may add new tracks to the target movie to ensure that all tracks of the asset are represented in the inserted time range.

See Also

Modifying Time Ranges

func insertEmptyTimeRange(CMTimeRange)

Adds an empty time range to a movie.

func removeTimeRange(CMTimeRange)

Removes the specified time range from a movie.

func scale(CMTimeRange, toDuration: CMTime)

Changes the duration of a time range in a movie.