append(_:)
Appends a sample buffer to an input to write to the output file.
Declaration
func append(_ sampleBuffer: CMSampleBuffer) -> BoolParameters
- sampleBuffer:
The sample buffer to append.
Return Value
true if the input successfully appends the sample buffer; otherwise, false.
Discussion
Order the samples you append according to storage requirements. For example, if you’re working with sample buffers containing compressed video, order and append them according to their decode timestamp. The system uses the timing information in the sample buffer relative to the time you set in the call to startSession(atSourceTime:) to determine the timing of samples in the output file.
If this method returns false, check the value of the asset writer’s status property to determine whether the writing operation’s status is complete, failed, or canceled. If the status is AVAssetWriter.Status.failed, the asset writer’s error property contains an error object that describes the failure.