Contents

startSession(atSourceTime:)

Starts an asset-writing session.

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

You must call this method after you call startWriting(), but before you append sample data to asset writer inputs.

Each writing session has a start time that, where allowed by the file format you’re writing, defines the mapping from the timeline of source samples to the timeline of the written file. In the case of the QuickTime movie file format, the first session begins at movie time 0, so a sample you append with timestamp T plays at movie time (T-startTime). The writer adds samples with timestamps earlier than the start time to the output file, but they don’t display during playback. If the earliest sample for an input has a timestamp later than the start time, the system inserts an empty edit to preserve synchronization between tracks of the output asset.

To end a session, call endSession(atSourceTime:)or finishWriting(completionHandler:)

See Also

Managing writing sessions