Initiates a sample-writing session for the output asset.
SDKs
- iOS 4.1+
- macOS 10.7+
- tvOS 9.0+
Framework
- AVFoundation
Declaration
func startSession(atSourceTime startTime: CMTime)
Parameters
startTime
The starting asset time for the sample-writing session, in the timeline of the source samples.
Discussion
Sequences of sample data appended to the asset writer inputs are considered to fall within “sample-writing sessions.” You must call this method to begin one of these sessions.
Each writing session has a start time which, where allowed by the file format being written, defines the mapping from the timeline of source samples onto the file's timeline. In the case of the QuickTime movie file format, the first session begins at movie time 0, so a sample appended with timestamp T will be played at movie time (T-start
). Samples with timestamps before start
will still be added to the output media but will be edited out of the movie. If the earliest buffer for an input is later than start
, an empty edit will be inserted to preserve synchronization between tracks of the output asset.
Special Considerations
It is an error to invoke this method twice in a row without invoking end
: in between.