Type Method

determineCompatibility(ofExportPreset:with:outputFileType:completionHandler:)

Reports the compatibility of an export present, asset, and output file type to the specified block.

Declaration

class func determineCompatibility(ofExportPreset presetName: String, with asset: AVAsset, outputFileType: AVFileType?, completionHandler handler: @escaping (Bool) -> Void)

Parameters

presetName

The name of the preset template for the export operation.

For possible values, see Export Preset Names for Device-Appropriate QuickTime Files, Export Preset Names for QuickTime Files of a Given Size, AVAssetExportSession.Status.cancelled, Export Preset Name for iTunes Audio, and Export Preset Name for Pass-Through.

asset

The asset object that you are planning to export.

outputFileType

The UTI string corresponding to the file type. For example, to specify a QuickTime movie file format, you could specify the constant mov. For a list of constants specifying UTIs for standard file types, see AVFoundation Constants.

handler

The block to execute with the results. This method makes a copy of the specified block. This parameter must not be nil.

This block takes a single Boolean parameter and returns no result. The parameter contains the value true if the combination of options is compatible or false if they are not.

Discussion

Because not all export presets are compatible with all assets and file types, you can use this method to query the compatibility of specific combos before using them. To ensure that the export operation succeeds, you should not make any significant changes to the asset between the time of calling this method and performing the export operation.

This method performs its checks asynchronously on a secondary thread and returns immediately. The results are similarly reported to the specified block on a secondary thread.

See Also

Configuring Export Presets

var presetName: String

The name of the preset used to initialize the session.

class func allExportPresets() -> [String]

Returns all available export preset names.

class func exportPresets(compatibleWith: AVAsset) -> [String]

Returns the identifiers compatible with a given asset.

Export Preset Names for Device-Appropriate QuickTime Files

You use these export options to produce QuickTime movie files with video size appropriate to the current device.

Export Preset Names for QuickTime Files of a Given Size

You use these export options to produce QuickTime movie files with a specified video size.

Export Preset Name for iTunes Audio

You use this export option to produce an audio-only MPEG 4 Audio file with appropriate iTunes gapless playback data.

Export Preset Names for Apple Devices

You use these export options to produce playable files for use on specific Apple devices.

Export Preset Name for Pass Through

You use this export option to let all tracks pass through as formatted unless otherwise prohibited.

func determineCompatibleFileTypes(completionHandler: ([AVFileType]) -> Void)

Reports the compatible file types for the current export session to the specified block.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software