Contents

init(contentType:)

Creates an object that outputs segment data in a specified container format.

Declaration

init(contentType outputContentType: UTType)

Parameters

  • outputContentType:

    A type that indicates the format of the segment data to output.

Discussion

Use this initializer to create an asset writer that outputs segment data to an adopter of the AVAssetWriterDelegate protocol. For example, you can create an asset writer object to write an MPEG-4 file as shown below:

// Create a UTType for the MP4 file type.
guard let contentType = UTType(AVFileType.mp4.rawValue) else { return }
let assetWriter = AVAssetWriter(contentType: contentType)

See Also

Creating an asset writer