NextLevelSessionExporter

open class NextLevelSessionExporter : NSObject

🔄 NextLevelSessionExporter, export and transcode media in Swift

  • Input asset for export, provided when initialized.

    Declaration

    Swift

    public var asset: AVAsset?
  • Enables video composition and parameters for the session.

    Declaration

    Swift

    public var videoComposition: AVVideoComposition?
  • Enables audio mixing and parameters for the session.

    Declaration

    Swift

    public var audioMix: AVAudioMix?
  • Output file location for the session.

    Declaration

    Swift

    public var outputURL: URL?
  • Output file type. UTI string defined in AVMediaFormat.h.

    Declaration

    Swift

    public var outputFileType: AVFileType?
  • Time range or limit of an export from kCMTimeZero to kCMTimePositiveInfinity

    Declaration

    Swift

    public var timeRange: CMTimeRange
  • Indicates if an export session should expect media data in real time.

    Declaration

    Swift

    public var expectsMediaDataInRealTime: Bool
  • Indicates if an export should be optimized for network use.

    Declaration

    Swift

    public var optimizeForNetworkUse: Bool
  • Metadata to be added to an export.

    Declaration

    Swift

    public var metadata: [AVMetadataItem]?
  • Video input configuration dictionary, using keys defined in <CoreVideo/CVPixelBuffer.h>

    Declaration

    Swift

    public var videoInputConfiguration: [String : Any]?
  • Video output configuration dictionary, using keys defined in <AVFoundation/AVVideoSettings.h>

    Declaration

    Swift

    public var videoOutputConfiguration: [String : Any]?
  • Audio output configuration dictionary, using keys defined in <AVFoundation/AVAudioSettings.h>

    Declaration

    Swift

    public var audioOutputConfiguration: [String : Any]?
  • Export session status state.

    Declaration

    Swift

    public var status: AVAssetExportSession.Status { get }
  • Session exporting progress from 0 to 1.

    Declaration

    Swift

    public var progress: Float { get }
  • Initializes a session with an asset to export.

    Declaration

    Swift

    public convenience init(withAsset asset: AVAsset)

    Parameters

    asset

    The asset to export.

  • Undocumented

    Declaration

    Swift

    public override init()
  • Completion handler type for when an export finishes.

    Declaration

    Swift

    public typealias CompletionHandler = (Swift.Result<AVAssetExportSession.Status, Error>) -> Void
  • Progress handler type

    Declaration

    Swift

    public typealias ProgressHandler = (_ progress: Float) -> Void
  • Render handler type for frame processing

    Declaration

    Swift

    public typealias RenderHandler = (_ renderFrame: CVPixelBuffer, _ presentationTime: CMTime, _ resultingBuffer: CVPixelBuffer) -> Void
  • Initiates an export session.

    Throws

    Failure indication thrown when an error has occurred during export.

    Declaration

    Swift

    public func export(renderHandler: RenderHandler? = nil, progressHandler: ProgressHandler? = nil, completionHandler: CompletionHandler? = nil)

    Parameters

    completionHandler

    Handler called when an export session completes.

  • Cancels any export in progress.

    Declaration

    Swift

    public func cancelExport()