New
38extension
AVAssetVideoTrackPlan
NewiOSmacOStvOSextension AVAssetVideoTrackPlan
Declaration
extension AVAssetVideoTrackPlan {
/// Creates an instance of AVAssetVideoTrackPlan.
///
/// This initializer throws NSInvalidArgumentException in the following cases:
/// 1. mediaType is not supported. Supported media types are AVMediaTypeVideo and AVMediaTypeAuxiliaryPicture
/// 2. The encoder specified by videoCodecType and encoderSpecification does not support video encoding in segments
///
/// - Parameters:
/// - videoCodecType: Video codec type of the track.
/// - encoderSpecification: A dictionary describing the characteristics of a video encoder to use. Pass nil to let the system choose an encoder. If the client provides a specification, it should omit the following keys: kVTCompressionPropertyKey_SourceFrameCount, kVTCompressionPropertyKey_MoreFramesBeforeStart, and kVTCompressionPropertyKey_MoreFramesAfterEnd, since such keys will be overwritten by the underlying implementation.
/// - mediaType: Media type of the track. Only AVMediaTypeVideo and AVMediaTypeAuxiliaryPicture are supported.
/// - segmentConfigurations: Segment configurations of the track.
/// - assemblyTrackID: The trackID that identifies this track in the assemblyComposition the planner passes to the completion handler of the incremental writing session.
public convenience init(videoCodecType: AVVideoCodecType, encoderSpecification: [String : any Sendable]? = nil, mediaType: AVMediaType, segmentConfigurations: [AVPlannedVideoSegmentConfiguration], assemblyTrackID: CMPersistentTrackID)
}
extension
AVAssetWritingPlanner
NewiOSmacOStvOSextension AVAssetWritingPlanner
Declaration
extension AVAssetWritingPlanner {
/// Creates an instance of AVAssetWritingPlanner given a unique file directory to host all incremental segment files and other intermediate files.
///
/// The `directoryForTemporaryFiles` must differ between export operations, but remain identical when resuming the same export operation.
/// The client is responsible for ensuring that this URL can be re-synthesized exactly across multiple launches of the app and device reboots (if desired).
/// For example, if there are multiple source assets that need to be exported concurrently, these should result in unique URLs so that the planner can correctly identify each one.
/// Another example is if the same source asset is being output with different compression configurations, they also should be uniquely identifiable so that they do not alias to the same output file.
///
/// A resuming planner instance can only find the files from a previous planner instance if presented with the identical URL. All intermediate segment files and metadata files are stored in the specified `directoryForTemporaryFiles`.
///
/// Source assets, compression configs, and video composition settings should all be taken into account when generating the unique URL.
///
/// - Parameter directoryForTemporaryFiles: The file directory to host all incremental segment files and other intermediate files for the current AVAssetWritingPlanner operation.
/// - Throws: An error if `directoryForTemporaryFiles` does not exist, or it is not writable, or it contains a corrupted AVAssetWritingPlanner incremental state file.
public convenience init(directoryForTemporaryFiles: URL) throws
/// Returns segment boundary guidelines that help clients determine how to segment compression video tracks with best results.
///
/// The encoderSpecification parameter here is the same encoder specification the client uses to compress the video track.
///
/// - Parameters:
/// - codecType: The output video codec type for the video track.
/// - encoderSpecification: A dictionary of kVTVideoEncoderSpecification_* keys describing the video encoder. This is the same specification the client uses to compress the video track.
/// - Returns: An AVAssetWritingPlanner.SegmentBoundaryGuidelines with the minimum frame count and duration for the given codec and encoder.
public static func segmentBoundaryGuidelinesForVideo(codecType: AVVideoCodecType, encoderSpecification: [String : any Sendable]) -> AVAssetWritingPlanner.SegmentBoundaryGuidelines
/// Result type for manual segment completion control.
///
/// Return this type from the segment handler to explicitly control how each segment completes,
/// including saving custom client state for resumable exports or canceling segments.
///
/// ## Topics
///
/// ### Completion Options
/// - ``success``
/// - ``successWithState(_:)``
/// - ``cancelled``
public enum SegmentResult {
/// Finish the segment successfully without saving state.
///
/// Use this case when the segment completed successfully and you don't need to
/// save any custom state for resumption.
///
/// This is equivalent to calling `finish()` on the segment request.
case success
/// Finish the segment successfully with custom client state.
///
/// Use this case to save custom state data that will be restored if the export
/// session is interrupted and later resumed. The client state is available via
/// ``AVPlannedSegmentWritingRequest/clientStateToRestore`` when the segment is
/// resumed.
/// Only the last successful state data is persisted. Any previous state data will be overwritten.
///
/// - Parameter clientState: Custom data to save for this segment. Commonly used
/// to save algorithm state, progress information, or metadata needed for resumption.
case successWithState(Data)
/// Cancel the current segment while allowing future resumption.
///
/// Use this case when the segment should be canceled (for example, due to background
/// task expiration) but you expect to resume the export later. This preserves the
/// ability to restart from this segment in a future export session.
///
/// This is equivalent to calling `cancel()` on the segment request.
///
/// ## Use Cases
/// - Background task expiration handler called
/// - System resources unavailable
/// - User-initiated pause operation
case cancelled
}
/// Adds a track plan with manual segment completion control.
///
/// This variant provides fine-grained control over segment completion, allowing you to
/// return a ``SegmentResult`` that explicitly controls how the segment completes.
///
Truncated.
enum
AVAudioMixInputParametersTrackID
NewiOSmacOStvOSwatchOSpublic enum AVAudioMixInputParametersTrackID : CMPersistentTrackID, @unchecked Sendable
Declaration
public enum AVAudioMixInputParametersTrackID : CMPersistentTrackID, @unchecked Sendable {
case mixID = 0
}
protocol
AVCaptureBroadcastVideoOutputDelegate
NewiOSmacOStvOSpublic protocol AVCaptureBroadcastVideoOutputDelegate : NSObjectProtocol
Protocol for receiving broadcast video output events and data.
Objects conforming to this protocol can be set as delegates to receive notifications about broadcast video output operations, including dropped frames and ancillary data processing.
Declaration
public protocol AVCaptureBroadcastVideoOutputDelegate : NSObjectProtocol {
/// Called when a video frame is dropped during broadcast video output processing.
///
/// This method is called whenever the broadcast video output system needs to drop a video frame due to performance constraints, destination issues, buffer overruns, or encoding failures.
///
/// - Parameter output: The ``AVCaptureBroadcastVideoOutput`` instance that dropped the video frame.
/// - Parameter presentationTimeStamp: The presentation timestamp (PTS) of the dropped video frame.
/// - Parameter connection: The ``AVCaptureConnection`` associated with the dropped video frame.
optional func broadcastVideoOutput(_ output: AVCaptureBroadcastVideoOutput, didDropVideoFrameWithPresentationTimeStamp presentationTimeStamp: CMTime, from connection: AVCaptureConnection)
}
extension
AVPartialAsyncProperty
NewmacOSextension AVPartialAsyncProperty where Root : AVAsset
Declaration
extension AVPartialAsyncProperty where Root : AVAsset {
/**
The list of file URLs used by the MediaExtension that constitute the asset.
The list of file URLs that constitute the asset are returned only for QuickTime reference movies, or if the MediaExtension format reader implements this property [MEFileInfo setConstituentFileNames:].
*/
public static var constituentFileURLs: AVAsyncProperty<Root, [URL]> { get }
}
extension
AVPlannedVideoSegmentWritingRequest
NewiOSmacOStvOSextension AVPlannedVideoSegmentWritingRequest
Declaration
extension AVPlannedVideoSegmentWritingRequest {
/// Helper function to create a VTCompressionSession that restores the video encoder state persisted at the end of the previous segment.
///
/// Clients using VTCompressionSession directly to produce encoded video samples for writing the segment must use this method to create the session.
/// The client should perform additional configurations on the returned compression session, but must apply the same configurations for each segment of the track.
///
/// Client cannot call this method more than once on a writing request object.
/// For the same segment writing request, this method and the makeResumableWriterInput method are mutually exclusive. The client can call either one of the two, but not both.
/// This method fails (returns nil) with error if the parameters differ from the previous segment.
///
/// The client should release the session after use.
/// The writing request retains the compression session but does not mutate the session after this method is returned.
///
/// - Parameters:
/// - width: The pixel width of video frames.
/// - height: The pixel height of video frames.
/// - codecType: The codec type.
/// - encoderSpecification: A dictionary describing the characteristics of a video encoder to use. Pass nil to let the system choose an encoder. If the client provides a specification, it should omit the following keys kVTCompressionPropertyKey_SourceFrameCount, kVTCompressionPropertyKey_MoreFramesBeforeStart, kVTCompressionPropertyKey_MoreFramesAfterEnd since such keys will be overwritten by the underlying implementation.
/// - sourceImageBufferAttributes: Required attributes for source pixel buffers, used when creating a pixel buffer pool for source frames. If you don't want the system to create one for you, pass nil.
/// Using pixel buffers not allocated by the system increases the chance that you'll have to copy image data.
/// - outputHandler: The handler to invoke with compressed frames. The system may call this function asynchronously, on a different thread from the one that calls VTCompressionSessionEncodeFrame.
/// - Returns: A configured VTCompressionSession ready for encoding this segment.
/// - Throws: An error if the session cannot be created or if parameters differ from previous segment.
public func createResumableCompressionSession(width: Int32, height: Int32, codecType: CMVideoCodecType, encoderSpecification: [String : any Sendable]? = nil, sourceImageBufferAttributes: [String : any Sendable]? = nil, outputHandler: @escaping @Sendable (OSStatus, VTEncodeInfoFlags, CMSampleBuffer?) -> Void) throws -> VTCompressionSession
}
extension
AVPlayerItemSampleBufferOutput
NewiOSmacOStvOSwatchOSextension AVPlayerItemSampleBufferOutput
Declaration
extension AVPlayerItemSampleBufferOutput {
/// Holds the information necessary for processing generated sample buffers.
public struct SampleBufferInSequence : Sendable {
/// Sample buffer containing media data.
public var sampleBuffer: CMReadySampleBuffer<CMSampleBuffer.DynamicContent>
/// Indicates the very first buffer in a new sequence produced by this output. Seeking or changing playback
/// direction will start a new sequence of buffers. If you have any sample buffers queued from the previous
/// sequence, these should be discarded.
public var sequenceWasRestarted: Bool
public init(sampleBuffer: CMReadySampleBuffer<CMSampleBuffer.DynamicContent>, sequenceWasRestarted: Bool)
}
/// Returns the next sample buffer if it is already available.
///
/// If no sample buffers are ready, this method will return nil immediately.
///
/// This method will race with ``nextSampleBuffer()`` for grabbing the generated sample buffer.
public func nextAvailableSampleBuffer() -> AVPlayerItemSampleBufferOutput.SampleBufferInSequence?
/// Returns next sample buffer once it becomes available.
///
/// This method will wait indefinitely for the next sample buffer to become available. This method returns nil if the
/// current task is cancelled or if this method is called from a different task.
///
/// This method will race with ``nextAvailableSampleBuffer()`` for grabbing the generated sample buffer.
nonisolated public func nextSampleBuffer() async -> AVPlayerItemSampleBufferOutput.SampleBufferInSequence?
}
let
AVSampleBufferVideoRendererRequiresFlushToResumeDecodingDidChangeNotificationRequiresFlushKey
NewiOSmacOStvOSvisionOSpublic let AVSampleBufferVideoRendererRequiresFlushToResumeDecodingDidChangeNotificationRequiresFlushKey: String
var
canBeFulfilledWithAdvisoryKey
NewiOStvOSopen var canBeFulfilledWithAdvisoryKey: Bool { get }
Indicates whether this key request was initiated for an advisory key.
This property is set to true when:
1. Advisory key loading is enabled on the parent AVContentKeySession
2. The key was previously loaded as an advisory key and cached by FairPlay
3. A subsequent request for the same key is made
When canBeFulfilledWithAdvisoryKey is true and makeStreamingContentKeyRequestData returns nil for the key request data, this indicates FairPlay has already cached the key. No request to the key server for a key response is necessary, and the application should simply return from the completion handler.
This property should be checked in the completion handler of makeStreamingContentKeyRequestData(forApp:contentIdentifier:options:completionHandler:) whenever the key request data is nil to distinguish advisory keys from actual errors.
func
makeOptionalStreamingContentKeyRequestData
NewiOStvOSopen func makeOptionalStreamingContentKeyRequestData(forApp appIdentifier: Data, contentIdentifier: Data?, options: [String : Any]? = nil, completionHandler: @escaping @Sendable (Data?, (any Error)?) -> Void)
Obtains an optional content key request data for a specific combination of application and content.
This method generates key request data to be sent to a key server, with support for advisory key handling. When advisory keys are enabled (supportsAdvisoryKeys = YES), this method may return nil data without error if the requested key is already cached by the system, avoiding redundant server requests.
IMPORTANT: When supportsAdvisoryKeys is set to YES, this method MUST be used for all content key requests. The non-advisory variant is not compatible with advisory key handling and an exception will be thrown otherwise.
When the completion handler is called with nil data and nil error, check the canBeFulfilledWithAdvisoryKey
property. A return value of YES indicates the key is already cached and no server communication is required.
Parameters
appIdentifier- An opaque identifier for the application. The contents and format are determined by the content protection system in use. An exception will be thrown if appIdentifier is nil.
contentIdentifier- An optional opaque identifier for the content. The contents and format are determined by the content protection system in use.
options- A dictionary of additional parameters required to obtain the key, or nil if none are needed. See AVContentKeyRequest Key constants.
completionHandler- A block invoked when the request completes. Called with key request data for server communication or nil data if already fulfilled by an advisory key response; error, if creating the key request data failed. An exception will be thrown if completionHandler is nil.
func
makeOptionalStreamingContentKeyRequestData
NewiOStvOSopen func makeOptionalStreamingContentKeyRequestData(forApp appIdentifier: Data, contentIdentifier: Data?, options: [String : Any]? = nil) async throws -> Data
Obtains an optional content key request data for a specific combination of application and content.
This method generates key request data to be sent to a key server, with support for advisory key handling. When advisory keys are enabled (supportsAdvisoryKeys = YES), this method may return nil data without error if the requested key is already cached by the system, avoiding redundant server requests.
IMPORTANT: When supportsAdvisoryKeys is set to YES, this method MUST be used for all content key requests. The non-advisory variant is not compatible with advisory key handling and an exception will be thrown otherwise.
When the completion handler is called with nil data and nil error, check the canBeFulfilledWithAdvisoryKey
property. A return value of YES indicates the key is already cached and no server communication is required.
Parameters
appIdentifier- An opaque identifier for the application. The contents and format are determined by the content protection system in use. An exception will be thrown if appIdentifier is nil.
contentIdentifier- An optional opaque identifier for the content. The contents and format are determined by the content protection system in use.
options- A dictionary of additional parameters required to obtain the key, or nil if none are needed. See AVContentKeyRequest Key constants.
completionHandler- A block invoked when the request completes. Called with key request data for server communication or nil data if already fulfilled by an advisory key response; error, if creating the key request data failed. An exception will be thrown if completionHandler is nil.
var
reasonsNotRecommendedForCaptureUse
NewiOSmacOStvOSopen var reasonsNotRecommendedForCaptureUse: Set<AVExternalStorageDevice.ReasonNotRecommendedForCaptureUse> { get }
var
supportsAdvisoryKeys
NewiOStvOSopen var supportsAdvisoryKeys: Bool
Boolean indicating whether advisory keys are enabled on the client.
Set to true to enable advisory key loading. False by default. Note that this is a one-way operation—once set to true, this property cannot be set back to false.
Advisory key loading allows applications to make use of content keys provided speculatively by the key server. When enabled, FairPlay may cache these keys and return them immediately on subsequent requests without requiring a round-trip to the key server.
The delegate must be prepared to handle advisory key requests by checking the canBeFulfilledWithAdvisoryKey property on AVContentKeyRequest objects.
When an advisory key is already cached by FairPlay, makeStreamingContentKeyRequestData will return nil for the key request data, and canBeFulfilledWithAdvisoryKey will return true. In this case, no request to the key server is necessary.
struct
AVAssetExportSession.ResumptionFailureReason
NewiOSmacOStvOSpublic struct ResumptionFailureReason : Hashable, Equatable, RawRepresentable, @unchecked Sendable
Declaration
public struct ResumptionFailureReason : Hashable, Equatable, RawRepresentable, @unchecked Sendable {
public init(_ rawValue: String)
public init(rawValue: String)
}
let
AVAssetExportSession.ResumptionFailureReason.incompatiblePreset
NewiOSmacOStvOSpublic static let incompatiblePreset: AVAssetExportSession.ResumptionFailureReason
let
AVAssetExportSession.ResumptionFailureReason.incompatibleSessionSettings
NewiOSmacOStvOSpublic static let incompatibleSessionSettings: AVAssetExportSession.ResumptionFailureReason
let
AVAssetExportSession.ResumptionFailureReason.incompatibleTemporaryDirectoryContents
NewiOSmacOStvOSpublic static let incompatibleTemporaryDirectoryContents: AVAssetExportSession.ResumptionFailureReason
let
AVAssetExportSession.ResumptionFailureReason.temporaryDirectoryDoesNotExist
NewiOSmacOStvOSpublic static let temporaryDirectoryDoesNotExist: AVAssetExportSession.ResumptionFailureReason
let
AVAssetExportSession.ResumptionFailureReason.unsupportedForPresetOnPlatform
NewiOSmacOStvOSpublic static let unsupportedForPresetOnPlatform: AVAssetExportSession.ResumptionFailureReason
var
AVAssetWriter.isProVideoStorageSupported
NewiOSmacOStvOSopen var isProVideoStorageSupported: Bool { get }
Indicates whether the receiver supports writing to pre-allocated storage on this device for high data rate video capture formats such as ProRes.
Check this value prior to setting the usesProVideoStorage property to avoid exceptions when pre-allocated storage is not supported.
var
AVAssetWriter.usesProVideoStorage
NewiOSmacOStvOSopen var usesProVideoStorage: Bool
Indicates whether to use pre-allocated storage.
The default value is NO. See more detailed description of ProVideoStorage in AVProVideoStorage.h.
An exception will be thrown if clients try to set YES if the value of the proVideoStorageSupported property is NO.
An exception will be thrown if clients try to set this property after -startWriting has been called on the receiver.
struct
AVAssetWritingPlanner.SegmentBoundaryGuidelines
NewiOSmacOStvOSpublic struct SegmentBoundaryGuidelines
Declaration
public struct SegmentBoundaryGuidelines {
public init()
public init(minimumFrameCount: Int, minimumDuration: CMTime)
public var minimumFrameCount: Int
public var minimumDuration: CMTime
}
enum
AVCaptureBroadcastVideoOutput.DroppedFrameReplacementPolicy
NewiOSmacOStvOSpublic enum DroppedFrameReplacementPolicy : Int, @unchecked Sendable
Constants indicating the replacement policy when a video frame is dropped.
These constants specify how the broadcast video output should handle dropped frames by providing replacement content.
Declaration
public enum DroppedFrameReplacementPolicy : Int, @unchecked Sendable {
/// Repeat the previous frame as replacement.
/// When a frame is dropped, the most recent successfully output frame is repeated at the expected presentation time. This is the default behavior and provides smoother visual continuity.
case repeatPreviousFrame = 0
/// Insert a black frame as replacement.
/// When a frame is dropped, a black frame is inserted at the expected presentation time. This maintains output timing continuity while providing a clear visual indication of the dropped frame.
case blackFrame = 1
}
var
AVCaptureMovieFileOutput.isProVideoStorageSupported
NewiOSmacOStvOSopen var isProVideoStorageSupported: Bool { get }
Whether this movie file output supports writing to Pro Video Storage in its current configuration.
A value of YES indicates that Pro Video Storage support is enabled for this output while NO indicates it is not. Check this value prior to setting property usesProVideoStorage to avoid exceptions when Pro Video Storage support is not enabled.
var
AVCaptureMovieFileOutput.usesProVideoStorage
NewiOSmacOStvOSopen var usesProVideoStorage: Bool
Whether this movie file output is configured to write to Pro Video Storage.
Default is NO. Raises an exception if set to YES while proVideoStorageSupported is NO.
var
AVError.externalSyncDeviceFrequencyHigherThanSpecified
NewiOSpublic static var externalSyncDeviceFrequencyHigherThanSpecified: AVError.Code { get }
var
AVError.externalSyncDeviceFrequencyLowerThanSpecified
NewiOSpublic static var externalSyncDeviceFrequencyLowerThanSpecified: AVError.Code { get }
var
AVError.followExternalSyncFailed
NewiOSpublic static var followExternalSyncFailed: AVError.Code { get }
case
AVError.Code.externalSyncDeviceFrequencyHigherThanSpecified
NewiOScase externalSyncDeviceFrequencyHigherThanSpecified = -11895
case
AVError.Code.externalSyncDeviceFrequencyLowerThanSpecified
NewiOScase externalSyncDeviceFrequencyLowerThanSpecified = -11896
case
AVError.Code.followExternalSyncFailed
NewiOScase followExternalSyncFailed = -11894
struct
AVExternalStorageDevice.ReasonNotRecommendedForCaptureUse
NewiOSmacOStvOSpublic struct ReasonNotRecommendedForCaptureUse : Hashable, Equatable, RawRepresentable, @unchecked Sendable
Declaration
public struct ReasonNotRecommendedForCaptureUse : Hashable, Equatable, RawRepresentable, @unchecked Sendable {
public init(rawValue: String)
}
let
AVExternalStorageDevice.ReasonNotRecommendedForCaptureUse.encrypted
NewiOSmacOStvOSpublic static let encrypted: AVExternalStorageDevice.ReasonNotRecommendedForCaptureUse
let
AVExternalStorageDevice.ReasonNotRecommendedForCaptureUse.slowWritingSpeed
NewiOSmacOStvOSpublic static let slowWritingSpeed: AVExternalStorageDevice.ReasonNotRecommendedForCaptureUse
let
AVExternalStorageDevice.ReasonNotRecommendedForCaptureUse.unknownWritingSpeed
NewiOSmacOStvOSpublic static let unknownWritingSpeed: AVExternalStorageDevice.ReasonNotRecommendedForCaptureUse
let
AVExternalStorageDevice.ReasonNotRecommendedForCaptureUse.unsupportedFileSystem
NewiOSmacOStvOSpublic static let unsupportedFileSystem: AVExternalStorageDevice.ReasonNotRecommendedForCaptureUse
var
AVPlayer.disconnectedFromSystemAudio
NewiOStvOSwatchOSnonisolated open var disconnectedFromSystemAudio: Bool { get }
Indicates whether the player is disconnected from system audio.
When NO (the default), the player is connected to system audio and coordinates with the application's shared AVAudioSession. This implies that the player will activate the audio session when playback starts, render audio, and automatically reconfigure itself after events like route changes.
When YES, the player is disconnected from system audio and will not interact with the audio session. It will not activate the audio session when starting and it does not reconfigure after route changes. Specifically, this implies that such a player will not play audio until the property changes back to NO.
The value of this property can be changed dynamically during playback using setDisconnectedFromSystemAudio:completionHandler:.
func
AVPlayerItem.selectableMediaSelectionOptions
NewiOSmacOStvOSwatchOSopen func selectableMediaSelectionOptions(in mediaSelectionGroup: AVMediaSelectionGroup) -> [AVMediaSelectionOption]
Returns the media selection options in the specified media selection group that can produce content.
Some media selection options depend on other options to produce content. For example, a subtitle option generated via audio transcription may require that the source audio option is currently selected. This method filters the options in the specified group to only those that can produce content given the current state of the player item's media selection.
Parameters
mediaSelectionGroup- A media selection group obtained from the receiver's asset.
ReturnsAn array containing the media selection options from the group that can produce content. Options in the group that are not in this array can still be selected, but will produce no content.
Deprecated
84func
add
DeprecatediOSmacOStvOSvisionOSopen func add(_ output: AVAssetReaderOutput)
func
add
DeprecatediOSmacOStvOSvisionOSopen func add(_ input: AVAssetWriterInput)
func
aggregateAssetDownloadTask
DeprecatediOSmacOSvisionOSopen func aggregateAssetDownloadTask(with URLAsset: AVURLAsset, mediaSelections: [AVMediaSelection], assetTitle title: String, assetArtworkData artworkData: Data?, options: [String : Any]? = nil) -> AVAggregateAssetDownloadTask?
DeprecatedUse assetDownloadTaskWithConfiguration: instead
Creates and initializes an AVAggregateAssetDownloadTask to download multiple AVMediaSelections on an AVURLAsset.
This method may return nil if the URLSession has been invalidated. The value of AVAssetDownloadTaskMediaSelectionKey will be ignored.
Parameters
URLAsset- The AVURLAsset to download locally.
mediaSelections- A list of AVMediaSelections. Each AVMediaSelection will correspond to a childAssetDownloadTask. Use -[AVAsset allMediaSelections] to download all AVMediaSelections on this AVAsset.
title- A human readable title for this asset, expected to be as suitable as possible for the user's preferred languages. Will show up in the usage pane of the settings app.
artworkData- Artwork data for this asset. Optional. Will show up in the usage pane of the settings app.
options- See AVAssetDownloadTask*Key above. Configures non-default behavior for the download task.
var
alwaysCopiesSampleData
DeprecatediOSmacOStvOSvisionOSopen var alwaysCopiesSampleData: Bool
DeprecatedIt is not necessary to copy the sample data in order to make it safe to use the vended buffer
func
append
DeprecatediOSmacOStvOSvisionOSopen func append(_ sampleBuffer: CMSampleBuffer) -> Bool
Appends samples to the receiver.
The timing information in the sample buffer, considered relative to the time passed to -[AVAssetWriter startSessionAtSourceTime:], will be used to determine the timing of those samples in the output file.
For track types other than audio tracks, to determine the duration of all samples in the output file other than the very last sample that's appended, the difference between the sample buffer's output DTS and the following sample buffer's output DTS will be used. The duration of the last sample is determined as follows: 1. If a marker sample buffer with kCMSampleBufferAttachmentKey_EndsPreviousSampleDuration is appended following the last media-bearing sample, the difference between the output DTS of the marker sample buffer and the output DTS of the last media-bearing sample will be used. 2. If the marker sample buffer is not provided and if the output duration of the last media-bearing sample is valid, it will be used. 3. if the output duration of the last media-bearing sample is not valid, the duration of the second-to-last sample will be used.
For audio tracks, the properties of each appended sample buffer are used to determine corresponding output durations.
The receiver will retain the CMSampleBuffer until it is done with it, and then release it. Do not modify a CMSampleBuffer or its contents after you have passed it to this method.
If the sample buffer contains audio data and the AVAssetWriterInput was intialized with an outputSettings dictionary then the format must be linear PCM. If the outputSettings dictionary was nil then audio data can be provided in a compressed format, and it will be passed through to the output without any re-compression. Note that advanced formats like AAC will have encoder delay present in their bitstreams. This data is inserted by the encoder and is necessary for proper decoding, but it is not meant to be played back. Clients who provide compressed audio bitstreams must use kCMSampleBufferAttachmentKey_TrimDurationAtStart to mark the encoder delay (generally restricted to the first sample buffer). Packetization can cause there to be extra audio frames in the last packet which are not meant to be played back. These remainder frames should be marked with kCMSampleBufferAttachmentKey_TrimDurationAtEnd. CMSampleBuffers obtained from AVAssetReader will already have the necessary trim attachments. Please see http://developer.apple.com/mac/library/technotes/tn2009/tn2258.html for more information about encoder delay. When attaching trims make sure that the output PTS of the sample buffer is what you expect. For example if you called -[AVAssetWriter startSessionAtSourceTime:kCMTimeZero] and you want your audio to start at time zero in the output file then make sure that the output PTS of the first non-fully trimmed audio sample buffer is kCMTimeZero.
If the sample buffer contains a CVPixelBuffer then the choice of pixel format will affect the performance and quality of the encode. For optimal performance the format of the pixel buffer should match one of the native formats supported by the selected video encoder. Below are some recommendations:
The H.264 and HEVC encoders natively support kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange and kCVPixelFormatType_420YpCbCr8BiPlanarFullRange, which should be used with 8-bit 4:2:0 video and full range input respectively; other related pixel formats in CoreVideo/CVPixelBuffer.h are ideal for 4:2:2 and 4:4:4 (and for HEVC, 10-bit). The JPEG encoder on iOS and Apple Silicon macOS natively supports kCVPixelFormatType_422YpCbCr8FullRange. If you need to work in the RGB domain then kCVPixelFormatType_32BGRA is recommended on iOS and macOS.
Pixel buffers not in a natively supported format will be converted internally prior to encoding when possible. Pixel format conversions within the same range (video or full) are generally faster than conversions between different ranges.
The ProRes encoders can preserve high bit depth sources, supporting up to 12bits/ch. ProRes 4444 can contain a mathematically lossless alpha channel and it doesn't do any chroma subsampling. This makes ProRes 4444 ideal for quality critical applications. If you are working with 8bit sources ProRes is also a good format to use due to its high image quality. Use either of the recommended pixel formats above. Note that RGB pixel formats by definition have 4:4:4 chroma sampling.
If you are working with high bit depth sources the following yuv pixel formats are recommended when encoding to ProRes: kCVPixelFormatType_4444AYpCbCr16, kCVPixelFormatType_422YpCbCr16, and kCVPixelFormatType_422YpCbCr10. When working in the RGB domain kCVPixelFormatType_64ARGB is recommended. Scaling and color matching are not currently supported when using AVAssetWriter with any of these high bit depth pixel formats. Please make sure that your track's output settings dictionary specifies the same width and height as the buffers you will be appending. Do not include AVVideoScalingModeKey or AVVideoColorPropertiesKey.
As of macOS 10.10 and iOS 8.0, this method can be used to add sample buffers that reference existing data in a file instead of containing media data to be appended to the file. This can be used to generate tracks that are not self-contained. In order to append such a sample reference to the track create a CMSampleBufferRef with a NULL dataBuffer and dataReady set to true and set the kCMSampleBufferAttachmentKey_SampleReferenceURL and kCMSampleBufferAttachmentKey_SampleReferenceByteOffset attachments on the sample buffer. Further documentation on how to create such a "sample reference" sample buffer can be found in the description of the kCMSampleBufferAttachmentKey_SampleReferenceURL and kCMSampleBufferAttachmentKey_SampleReferenceByteOffset attachment keys in the CMSampleBuffer documentation.
Before calling this method, you must ensure that the receiver is attached to an AVAssetWriter via a prior call to -addInput: and that -startWriting has been called on the asset writer. It is an error to invoke this method before starting a session (via -[AVAssetWriter startSessionAtSourceTime:]) or after ending a session (via -[AVAssetWriter endSessionAtSourceTime:]).
This method throws an exception if the sample buffer's media type does not match the asset writer input's media type.
Parameters
sampleBuffer- The CMSampleBuffer to be appended.
ReturnsA BOOL value indicating success of appending the sample buffer. If a result of NO is returned, clients can check the value of AVAssetWriter.status to determine whether the writing operation completed, failed, or was cancelled. If the status is AVAssetWriterStatusFailed, AVAsset.error will contain an instance of NSError that describes the failure.
func
audiovisualTypes
DeprecatediOSmacOStvOSvisionOSwatchOSopen class func audiovisualTypes() -> [AVFileType]
DeprecatedUse audiovisualContentTypes instead
Provides the file types the AVURLAsset class understands.
ReturnsAn NSArray of UTIs identifying the file types the AVURLAsset class understands.
let
AVAssetDownloadTaskMediaSelectionKey
DeprecatediOSmacOSvisionOSpublic let AVAssetDownloadTaskMediaSelectionKey: String
DeprecatedUse AVAssetDownloadConfiguration:mediaSelections instead
The media selection for this download. The value for this key should be an AVMediaSelection.
By default, media selections for AVAssetDownloadTask will be automatically selected.
let
AVAssetDownloadTaskMediaSelectionPrefersMultichannelKey
DeprecatediOSmacOSvisionOSpublic let AVAssetDownloadTaskMediaSelectionPrefersMultichannelKey: String
DeprecatedUse AVAssetDownloadConfiguration:variantQualifiers with predicateForChannelCount instead
Download the specified media selections with or without support for multichannel playback. The value for this key should be an NSNumber representing a BOOL.
By default AVAssetDownloadTask will prefer multichannel by downloading the most capable multichannel rendition available in additon to stereo.
let
AVAssetDownloadTaskMinimumRequiredMediaBitrateKey
DeprecatediOSmacOSvisionOSpublic let AVAssetDownloadTaskMinimumRequiredMediaBitrateKey: String
DeprecatedUse AVAssetDownloadConfiguration:variantQualifiers with assetVariantQualifierWithPredicate using desired comparison value against averageBitRate/peakBitRate instead
The lowest media bitrate greater than or equal to this value will be selected. Value should be a NSNumber in bps. If no suitable media bitrate is found, the highest media bitrate will be selected. The value for this key should be a NSNumber.
By default, the highest media bitrate will be selected for download.
let
AVAssetDownloadTaskMinimumRequiredPresentationSizeKey
DeprecatediOSmacOSvisionOSpublic let AVAssetDownloadTaskMinimumRequiredPresentationSizeKey: String
DeprecatedUse AVAssetDownloadConfiguration:variantQualifiers with predicateForPresentationWidth and predicateForPresentationHeight instead
The lowest media presentation size greater than or equal to this value will be selected. If no suitable media presentation size is found, the highest media presentation size will be selected. The value for this key should be a NSValue of CGSize.
By default, the highest media presentation size will be selected for download.
let
AVAssetDownloadTaskPrefersHDRKey
DeprecatediOSmacOSvisionOSpublic let AVAssetDownloadTaskPrefersHDRKey: String
DeprecatedUse AVAssetDownloadConfiguration:variantQualifiers with assetVariantQualifierWithPredicate using [NSPredicate predicateWithFormat:@'videoAttributes.videoRange == %@', AVVideoRangePQ]
Download the specified media selections with or without HDR content. The value for this key should be an NSNumber representing a BOOL.
By default AVAssetDownloadTask will prefer HDR content.
let
AVAssetDownloadTaskPrefersLosslessAudioKey
DeprecatediOSmacOSvisionOSpublic let AVAssetDownloadTaskPrefersLosslessAudioKey: String
DeprecatedUse AVAssetDownloadConfiguration:variantQualifiers with assetVariantQualifierWithPredicate using [NSPredicate predicateWithFormat:@'%d in audioAttributes.formatIDs', kAudioFormatAppleLossless]
Download the specified media selections in lossless audio representation. The value for this key should be an NSNumber representing a BOOL.
By default AVAssetDownloadTask will prefer lossy audio representation.
let
AVMovieShouldSupportAliasDataReferencesKey
DeprecatediOSvisionOSwatchOSpublic let AVMovieShouldSupportAliasDataReferencesKey: String
DeprecatedAVMovieShouldSupportAliasDataReferencesKey is not supported on this platform
enum
AVQueuedSampleBufferRenderingStatus
DeprecatediOSmacOStvOSvisionOSwatchOSpublic enum AVQueuedSampleBufferRenderingStatus : Int, @unchecked Sendable
Declaration
public enum AVQueuedSampleBufferRenderingStatus : Int, @unchecked Sendable {
case unknown = 0
case rendering = 1
case failed = 2
}
func
AVSampleBufferAttachContentKey
DeprecatediOSmacOStvOSvisionOSwatchOSpublic func AVSampleBufferAttachContentKey(_ sbuf: CMSampleBuffer, _ contentKey: AVContentKey, _ outError: NSErrorPointer) -> Bool
Attaches an AVContentKey to a CMSampleBuffer for the purpose of content decryption.
The client is expected to attach AVContentKeys to CMSampleBuffers that have been created by the client for enqueueing with AVSampleBufferDisplayLayer or AVSampleBufferAudioRenderer, for which the AVContentKeySpecifier matches indications of suitability that are available to the client according to the content key system that's in use.
Parameters
sbuf- The sample buffer to which the content key is to be attached.
contentKey- The content key to be attached.
outError- If the result is NO and errorOut is non-NULL, the location referenced by errorOut receives an instance of NSError that describes the reason for failure to attach the content key.
let
AVSampleBufferAudioRendererFlushTimeKey
DeprecatediOSmacOStvOSvisionOSwatchOSpublic let AVSampleBufferAudioRendererFlushTimeKey: String
let
AVSampleBufferVideoRendererRequiresFlushToResumeDecodingDidChangeNotificationRequiresFlushKey
DeprecatediOSmacOStvOSvisionOSpublic let AVSampleBufferVideoRendererRequiresFlushToResumeDecodingDidChangeNotificationRequiresFlushKey: String
func
cancelExport
DeprecatediOSmacOStvOSvisionOSopen func cancelExport()
func
copyNextSampleBuffer
DeprecatediOSmacOStvOSvisionOSopen func copyNextSampleBuffer() -> CMSampleBuffer?
func
copyPixelBuffer
DeprecatediOSmacOStvOSvisionOSopen func copyPixelBuffer(forItemTime itemTime: CMTime, itemTimeForDisplay outItemTimeForDisplay: UnsafeMutablePointer<CMTime>?) -> CVPixelBuffer?
var
defaultPixelBufferAttributes
DeprecatediOSmacOStvOSvisionOSwatchOSopen var defaultPixelBufferAttributes: [String : Any]?
func
displayedPixelBuffer
DeprecatediOSmacOStvOSvisionOSopen func displayedPixelBuffer() -> CVPixelBuffer?
var
error
DeprecatediOSmacOStvOSvisionOSwatchOSopen var error: (any Error)? { get }
var
expectsMediaDataInRealTime
DeprecatediOSmacOStvOSvisionOSopen var expectsMediaDataInRealTime: Bool
Indicates whether the input should tailor its processing of media data for real-time sources.
Clients appending media data to an input from a real-time source, such as an AVCaptureOutput, should set expectsMediaDataInRealTime to YES. This will ensure that readyForMoreMediaData is calculated appropriately for real-time usage.
For best results, do not set both this property and performsMultiPassEncodingIfSupported to YES.
This property cannot be set after writing on the receiver's AVAssetWriter has started.
func
finish
DeprecatediOSmacOStvOSvisionOSopen func finish(withComposedVideoFrame composedVideoFrame: CVPixelBuffer)
The method that the custom compositor calls when composition succeeds.
Parameters
composedVideoFrame- The video frame to finish with. Call finishWithComposedTaggedBufferGroup: instead if outputBufferDescription is non-nil.
func
flush
DeprecatediOSmacOStvOSvisionOSopen func flush(removingDisplayedImage removeDisplayedImage: Bool, completionHandler handler: (@Sendable () -> Void)? = nil)
func
flush
DeprecatediOSmacOStvOSvisionOSopen func flush(removingDisplayedImage removeDisplayedImage: Bool) async
init
init
DeprecatediOSmacOStvOSvisionOSpublic init(pixelBufferAttributes: [String : any Sendable]? = nil)
init
init
DeprecatediOSmacOStvOSvisionOSwatchOSpublic init?(sampleBuffer: CMSampleBuffer)
init
init
DeprecatediOSmacOStvOSvisionOSpublic convenience init(postProcessingAsVideoLayer videoLayer: CALayer, in animationLayer: CALayer)
Compose the composited video frames with the Core Animation layer
Place composited video frames in videoLayer and render animationLayer to produce the final frame. Normally videoLayer should be in animationLayer's sublayer tree. The animationLayer should not come from, or be added to, another layer tree. Be aware that on iOS, CALayers backing a UIView usually have their content flipped (as defined by the -contentsAreFlipped method). It may be required to insert a CALayer with its geometryFlipped property set to YES in the layer hierarchy to get the same result when attaching a CALayer to a AVVideoCompositionCoreAnimationTool as when using it to back a UIView.
var
isNotRecommendedForCaptureUse
DeprecatediOSmacOStvOSopen var isNotRecommendedForCaptureUse: Bool { get }
DeprecatedUse reasonsNotRecommendedForCaptureUse instead
var
isReadyForMoreMediaData
DeprecatediOSmacOStvOSvisionOSopen var isReadyForMoreMediaData: Bool { get }
Indicates the readiness of the input to accept more media data.
When there are multiple inputs, AVAssetWriter tries to write media data in an ideal interleaving pattern for efficiency in storage and playback. Each of its inputs signals its readiness to receive media data for writing according to that pattern via the value of readyForMoreMediaData. You can append media data to an input only while its readyForMoreMediaData property is YES.
Clients writing media data from a non-real-time source, such as an instance of AVAssetReader, should hold off on generating or obtaining more media data to append to an input when the value of readyForMoreMediaData is NO. To help with control of the supply of non-real-time media data, such clients can use -requestMediaDataWhenReadyOnQueue:usingBlock in order to specify a block that the input should invoke whenever it's ready for input to be appended.
Clients writing media data from a real-time source, such as an instance of AVCaptureOutput, should set the input's expectsMediaDataInRealTime property to YES to ensure that the value of readyForMoreMediaData is calculated appropriately. When expectsMediaDataInRealTime is YES, readyForMoreMediaData will become NO only when the input cannot process media samples as quickly as they are being provided by the client. If readyForMoreMediaData becomes NO for a real-time source, the client may need to drop samples or consider reducing the data rate of appended samples.
When the value of canPerformMultiplePasses is YES for any input attached to this input's asset writer, the value for this property may start as NO and/or be NO for long periods of time.
The value of readyForMoreMediaData will often change from NO to YES asynchronously, as previously supplied media data is processed and written to the output. It is possible for all of an AVAssetWriter's AVAssetWriterInputs temporarily to return NO for readyForMoreMediaData.
This property is key value observable. Observers should not assume that they will be notified of changes on a specific thread.
var
loadedTimeRanges
DeprecatediOSmacOSvisionOSopen var loadedTimeRanges: [NSValue] { get }
DeprecatedUse NSURLSessionTask.progress instead
This property provides a collection of time ranges for which the download task has media data already downloaded and playable. The ranges provided might be discontinuous.
Returns an NSArray of NSValues containing CMTimeRanges.
func
makeAssetDownloadTask
DeprecatediOSmacOSvisionOSopen func makeAssetDownloadTask(asset URLAsset: AVURLAsset, assetTitle title: String, assetArtworkData artworkData: Data?, options: [String : Any]? = nil) -> AVAssetDownloadTask?
DeprecatedUse assetDownloadTaskWithConfiguration: instead
Creates and initializes an AVAssetDownloadTask to be used with this AVAssetDownloadURLSession.
This method may return nil if the URLSession has been invalidated.
Parameters
URLAsset- The AVURLAsset to download locally.
title- A human readable title for this asset, expected to be as suitable as possible for the user's preferred languages. Will show up in the usage pane of the settings app.
artworkData- NSData representing artwork data for this asset. Optional. Will show up in the usage pane of the settings app. Must work with +[UIImage imageWithData:].
options- See AVAssetDownloadTask*Key above. Configures non-default behavior for the download task. Using this parameter is required for downloading non-default media selections for HLS assets.
func
newPixelBuffer
DeprecatediOSmacOStvOSvisionOSopen func newPixelBuffer() -> CVPixelBuffer?
Vends a CVPixelBuffer to use for rendering
The buffer will have its kCVImageBufferCleanApertureKey and kCVImageBufferPixelAspectRatioKey attachments set to match the current composition processor properties.
var
options
DeprecatediOSmacOSvisionOSopen var options: [String : Any]? { get }
DeprecatedUse AVAssetDownloadConfiguration instead
The options supplied to the download task upon initialization.
var
outputFileType
DeprecatediOSmacOStvOSvisionOSopen var outputFileType: AVFileType?
var
outputURL
DeprecatediOSmacOStvOSvisionOSopen var outputURL: URL?
var
pixelBuffer
DeprecatediOSmacOSopen var pixelBuffer: CVPixelBuffer { get }
DeprecatedUse readOnlyPixelBuffer instead
func
requestMediaDataWhenReady
DeprecatediOSmacOStvOSvisionOSopen func requestMediaDataWhenReady(on queue: dispatch_queue_t, using block: @escaping @Sendable () -> Void)
Instructs the receiver to invoke a client-supplied block repeatedly, at its convenience, in order to gather media data for writing to the output file.
The block should append media data to the input either until the input's readyForMoreMediaData property becomes NO or until there is no more media data to supply (at which point it may choose to mark the input as finished via -markAsFinished). The block should then exit. After the block exits, if the input has not been marked as finished, once the input has processed the media data it has received and becomes ready for more media data again, it will invoke the block again in order to obtain more.
A typical use of this method, with a block that supplies media data to an input while respecting the input's readyForMoreMediaData property, might look like this:
[myAVAssetWriterInput requestMediaDataWhenReadyOnQueue:myInputSerialQueue usingBlock:^{
while ([myAVAssetWriterInput isReadyForMoreMediaData])
{
CMSampleBufferRef nextSampleBuffer = [self copyNextSampleBufferToWrite];
if (nextSampleBuffer)
{
[myAVAssetWriterInput appendSampleBuffer:nextSampleBuffer];
CFRelease(nextSampleBuffer);
}
else
{
[myAVAssetWriterInput markAsFinished];
break;
}
}
}];
This method is not recommended for use with a push-style buffer source, such as AVCaptureAudioDataOutput or AVCaptureVideoDataOutput, because such a combination will likely require intermediate queueing of buffers. Instead, this method is better suited to a pull-style buffer source such as AVAssetReaderOutput, as illustrated in the above example.
When using a push-style buffer source, it is generally better to immediately append each buffer to the AVAssetWriterInput, directly via -[AVAssetWriter appendSampleBuffer:], as it is received. Using this strategy, it is often possible to avoid having to queue up buffers in between the buffer source and the AVAssetWriterInput. Note that many of these push-style buffer sources also produce buffers in real-time, in which case the client should set expectsMediaDataInRealTime to YES.
Before calling this method, you must ensure that the receiver is attached to an AVAssetWriter via a prior call to -addInput: and that -startWriting has been called on the asset writer.
This method throws an exception if this method is called more than once.
Parameters
queue- The queue on which the block should be invoked.
block- The block the input should invoke to obtain media data.
var
requiresFlushToResumeDecoding
DeprecatediOSmacOStvOSvisionOSopen var requiresFlushToResumeDecoding: Bool { get }
func
sourceFrame
DeprecatediOSmacOStvOSvisionOSopen func sourceFrame(byTrackID trackID: CMPersistentTrackID) -> CVPixelBuffer?
Returns the source CVPixelBufferRef for the given track ID
If the track contains tagged buffers, a pixel buffer from one of the tagged buffers will be returned.
Parameters
trackID- The track ID for the requested source frame
func
sourceSampleBuffer
DeprecatediOSmacOStvOSvisionOSopen func sourceSampleBuffer(byTrackID trackID: CMPersistentTrackID) -> CMSampleBuffer?
Returns the source CMSampleBufferRef for the given track ID
Parameters
trackID- The track ID for the requested source sample buffer
func
startReading
DeprecatediOSmacOStvOSvisionOSopen func startReading() -> Bool
func
startWriting
DeprecatediOSmacOStvOSvisionOSopen func startWriting() -> Bool
var
status
DeprecatediOSmacOStvOSvisionOSwatchOSopen var status: AVQueuedSampleBufferRenderingStatus { get }
func
AVAssetDownloadDelegate.urlSession
DeprecatediOSmacOSvisionOSwatchOSoptional func urlSession(_ session: URLSession, assetDownloadTask: AVAssetDownloadTask, didFinishDownloadingTo location: URL)
DeprecatedUse URLSession:assetDownloadTask:willDownloadToURL: instead
Sent when a download task that has completed a download.
Unlike NSURLSessionDownloadDelegate, the delegate should NOT move the file from this directory after it has been called. Downloaded assets must remain at the system provided URL. URLSession:task:didCompleteWithError: will still be called.
Parameters
session- The session the asset download task is on.
assetDownloadTask- The AVAssetDownloadTask whose downloaded completed.
location- The location the asset has been downloaded to.
func
AVAssetDownloadDelegate.urlSession
DeprecatediOSmacOSvisionOSoptional func urlSession(_ session: URLSession, assetDownloadTask: AVAssetDownloadTask, didLoad timeRange: CMTimeRange, totalTimeRangesLoaded loadedTimeRanges: [NSValue], timeRangeExpectedToLoad: CMTimeRange)
DeprecatedUse NSURLSessionTask.progress instead
Method to adopt to subscribe to progress updates of an AVAssetDownloadTask.
Parameters
session- The session the asset download task is on.
assetDownloadTask- The AVAssetDownloadTask which is being updated.
timeRange- A CMTimeRange indicating the time range loaded since the last time this method was called.
loadedTimeRanges- A NSArray of NSValues of CMTimeRanges indicating all the time ranges loaded by this asset download task.
timeRangeExpectedToLoad- A CMTimeRange indicating the single time range that is expected to be loaded when the download is complete.
func
AVAssetDownloadDelegate.urlSession
DeprecatediOSmacOSvisionOSoptional func urlSession(_ session: URLSession, aggregateAssetDownloadTask: AVAggregateAssetDownloadTask, willDownloadTo location: URL)
DeprecatedUse URLSession:assetDownloadTask:willDownloadToURL: instead
Method called when the aggregate download task determines the location this asset will be downloaded to.
This URL should be saved for future instantiations of AVAsset. While an AVAsset already exists for this content, it is advisable to re-use that instance.
Parameters
session- The session the aggregate asset download task is on.
aggregateAssetDownloadTask- The AVAggregateAssetDownloadTask.
location- The file URL this task will download media data to.
func
AVAssetDownloadDelegate.urlSession
DeprecatediOSmacOSvisionOSoptional func urlSession(_ session: URLSession, aggregateAssetDownloadTask: AVAggregateAssetDownloadTask, didCompleteFor mediaSelection: AVMediaSelection)
DeprecatedUse the NSURLSessionDownloadDelegate method instead, URLSession:task:didCompleteWithError:
Method called when a child AVAssetDownloadTask completes.
Parameters
session- The session the aggregate asset download task is on.
aggregateAssetDownloadTask- The AVAggregateAssetDownloadTask.
mediaSelection- The AVMediaSelection which is now fully available for offline use.
func
AVAssetDownloadDelegate.urlSession
DeprecatediOSmacOSvisionOSoptional func urlSession(_ session: URLSession, aggregateAssetDownloadTask: AVAggregateAssetDownloadTask, didLoad timeRange: CMTimeRange, totalTimeRangesLoaded loadedTimeRanges: [NSValue], timeRangeExpectedToLoad: CMTimeRange, for mediaSelection: AVMediaSelection)
DeprecatedUse NSURLSessionTask.progress: instead
Method to adopt to subscribe to progress updates of an AVAggregateAssetDownloadTask
Parameters
session- The session the asset download task is on.
aggregateAssetDownloadTask- The AVAggregateAssetDownloadTask.
timeRange- A CMTimeRange indicating the time range loaded for the media selection being downloaded.
loadedTimeRanges- A NSArray of NSValues of CMTimeRanges indicating all the time ranges loaded for the media selection being downloaded.
timeRangeExpectedToLoad- A CMTimeRange indicating the single time range that is expected to be loaded when the download is complete for the media selection being downloaded.
mediaSelection- The media selection which has additional media data loaded for offline use.
func
AVAssetReaderOutput.markConfigurationAsFinal
DeprecatediOSmacOStvOSvisionOSopen func markConfigurationAsFinal()
func
AVAssetReaderOutput.reset
DeprecatediOSmacOStvOSvisionOSopen func reset(forReadingTimeRanges timeRanges: [NSValue])
var
AVAssetReaderOutput.supportsRandomAccess
DeprecatediOSmacOStvOSvisionOSopen var supportsRandomAccess: Bool
func
AVMutableMovieTrack.append
DeprecatediOSmacOSvisionOSwatchOSopen func append(_ sampleBuffer: CMSampleBuffer, decodeTime outDecodeTime: UnsafeMutablePointer<CMTime>?, presentationTime outPresentationTime: UnsafeMutablePointer<CMTime>?) throws
func
AVPlayerItem.accessLog
DeprecatediOSmacOStvOSvisionOSwatchOSnonisolated open func accessLog() -> AVPlayerItemAccessLog?
DeprecatedUse fetchAccessLogWithCompletionHandler:
Returns an object that represents a snapshot of the network access log. Can be nil.
An AVPlayerItemAccessLog provides methods to retrieve the network access log in a format suitable for serialization. If nil is returned then there is no logging information currently available for this AVPlayerItem. An AVPlayerItemNewAccessLogEntryNotification will be posted when new logging information becomes available. However, accessLog might already return a non-nil value even before the first notification is posted.
In certain situations, this method may temporarily block the calling thread during the ongoing log collection process. It is strongly recommended that the caller take appropriate measures to prevent blocking essential services such as the user interface, for example, by avoiding calling this method in the main thread.
ReturnsAn autoreleased AVPlayerItemAccessLog instance.
func
AVPlayerItem.errorLog
DeprecatediOSmacOStvOSvisionOSwatchOSnonisolated open func errorLog() -> AVPlayerItemErrorLog?
DeprecatedUse fetchErrorLogWithCompletionHandler:
Returns an object that represents a snapshot of the error log. Can be nil.
An AVPlayerItemErrorLog provides methods to retrieve the error log in a format suitable for serialization. If nil is returned then there is no logging information currently available for this AVPlayerItem.
In certain situations, this method may temporarily block the calling thread during the ongoing log collection process. It is strongly recommended that the caller take appropriate measures to prevent blocking essential services such as the user interface, for example, by avoiding calling this method in the main thread.
ReturnsAn autoreleased AVPlayerItemErrorLog instance.
func
AVPlayerVideoOutput.taggedBuffers
DeprecatediOSmacOStvOSvisionOSwatchOSpublic func taggedBuffers(forHostTime hostTime: CMTime) -> (taggedBufferGroup: [CMTaggedBuffer], presentationTime: CMTime, activeConfiguration: AVPlayerVideoOutput.Configuration)?
DeprecatedUse AVPlayerVideoOutput.sample instead
func
AVQueuedSampleBufferRendering.enqueue
DeprecatediOSmacOStvOSvisionOSwatchOSfunc enqueue(_ sampleBuffer: CMSampleBuffer)
func
AVQueuedSampleBufferRendering.flush
DeprecatediOSmacOStvOSvisionOSwatchOSfunc flush()
var
AVQueuedSampleBufferRendering.hasSufficientMediaDataForReliablePlaybackStart
DeprecatediOSmacOStvOSvisionOSwatchOSvar hasSufficientMediaDataForReliablePlaybackStart: Bool { get }
DeprecatedFor smooth playback, attach the renderer to a render synchronizer and set the synchronizer's delaysRateChangeUntilHasSufficientMediaData property to true instead
var
AVQueuedSampleBufferRendering.isReadyForMoreMediaData
DeprecatediOSmacOStvOSvisionOSwatchOSvar isReadyForMoreMediaData: Bool { get }
func
AVQueuedSampleBufferRendering.requestMediaDataWhenReady
DeprecatediOSmacOStvOSvisionOSwatchOSfunc requestMediaDataWhenReady(on queue: dispatch_queue_t, using block: @escaping @Sendable () -> Void)
func
AVQueuedSampleBufferRendering.stopRequestingMediaData
DeprecatediOSmacOStvOSvisionOSwatchOSfunc stopRequestingMediaData()
DeprecatedCancel the receiver's Task instead
func
AVSampleBufferAudioRenderer.flush
DeprecatediOSmacOStvOSvisionOSwatchOSopen func flush(fromSourceTime time: CMTime, completionHandler: @escaping @Sendable (Bool) -> Void)
func
AVSampleBufferAudioRenderer.flush
DeprecatediOSmacOStvOSvisionOSwatchOSopen func flush(fromSourceTime time: CMTime) async -> Bool
func
AVSampleBufferRenderSynchronizer.addRenderer
DeprecatediOSmacOStvOSvisionOSwatchOSopen func addRenderer(_ renderer: any AVQueuedSampleBufferRendering)
Adds a renderer to the list of renderers under the synchronizer's control.
Adds a renderer to begin operating with the synchronizer's timebase.
This method can be called while rate is non-0.0.
Parameters
renderer- An object conforming to AVQueuedSampleBufferRendering to be synchronized by this synchronizer.
func
AVSampleBufferRenderSynchronizer.removeRenderer
DeprecatediOSmacOStvOSvisionOSwatchOSopen func removeRenderer(_ renderer: any AVQueuedSampleBufferRendering, at time: CMTime, completionHandler: (@Sendable (Bool) -> Void)? = nil)
Removes a renderer from the list of renderers under the synchronizer's control.
This method can be called while rate is non-0.0.
time is used to schedule future removals. If the time is in the past, the renderer will be removed immediately. kCMTimeInvalid can also be used to force immediate removal.
This method removes the renderer asynchronously. The method can be called more than once, with a subsequent scheduled removal replacing a previously scheduled removal.
Clients may provide an optional completionHandler block to be notified when the scheduled removal completes. If provided, completionHandler will always be called with the following values for didRemoveRenderer:
- If the renderer has not been added to this synchronizer, completionHandler will be called and didRemoveRenderer will be NO.
- If a removal of a particular renderer is scheduled after another removal of that same renderer has already been scheduled but not yet occurred, the previously-scheduled removal's completionHandler will be called and didRemoveRenderer will be NO. The new scheduled removal's completionHandler will not be called until it is replaced by another scheduled removal or the renderer is actually removed.
- When the renderer is removed due to a scheduled removal, the completionHandler provided when that removal was scheduled will be called and didRemoveRenderer will be YES.
Parameters
renderer- An object conforming to AVQueuedSampleBufferRendering currently synchronized by this synchronizer to no longer be synchronized by the synchronizer.
time- The time on the timebase's timeline at which the renderer should be removed.
completionHandler- Optional. A block called when the renderer is removed from the synchronizer. If provided, this block will always be called with didRemoveRenderer indicating whether the renderer was removed by this scheduled removal.
func
AVSampleBufferRenderSynchronizer.removeRenderer
DeprecatediOSmacOStvOSvisionOSwatchOSopen func removeRenderer(_ renderer: any AVQueuedSampleBufferRendering, at time: CMTime) async -> Bool
Removes a renderer from the list of renderers under the synchronizer's control.
This method can be called while rate is non-0.0.
time is used to schedule future removals. If the time is in the past, the renderer will be removed immediately. kCMTimeInvalid can also be used to force immediate removal.
This method removes the renderer asynchronously. The method can be called more than once, with a subsequent scheduled removal replacing a previously scheduled removal.
Clients may provide an optional completionHandler block to be notified when the scheduled removal completes. If provided, completionHandler will always be called with the following values for didRemoveRenderer:
- If the renderer has not been added to this synchronizer, completionHandler will be called and didRemoveRenderer will be NO.
- If a removal of a particular renderer is scheduled after another removal of that same renderer has already been scheduled but not yet occurred, the previously-scheduled removal's completionHandler will be called and didRemoveRenderer will be NO. The new scheduled removal's completionHandler will not be called until it is replaced by another scheduled removal or the renderer is actually removed.
- When the renderer is removed due to a scheduled removal, the completionHandler provided when that removal was scheduled will be called and didRemoveRenderer will be YES.
Parameters
renderer- An object conforming to AVQueuedSampleBufferRendering currently synchronized by this synchronizer to no longer be synchronized by the synchronizer.
time- The time on the timebase's timeline at which the renderer should be removed.
completionHandler- Optional. A block called when the renderer is removed from the synchronizer. If provided, this block will always be called with didRemoveRenderer indicating whether the renderer was removed by this scheduled removal.
var
AVSampleBufferRenderSynchronizer.renderers
DeprecatediOSmacOStvOSvisionOSwatchOSopen var renderers: [any AVQueuedSampleBufferRendering] { get }
DeprecatedAccessing non-Sendable renderers concurrently risks causing data races
Array of id<AVQueuedSampleBufferRendering> currently attached to the synchronizer.
A list of renderers added to and not removed from the synchronizer. The list also includes renderers that have been scheduled to be removed but have not yet been removed.
This property is not KVO observable.
let
AVSampleBufferVideoRenderer.didFailToDecodeNotification
DeprecatediOSmacOStvOSvisionOSpublic class let didFailToDecodeNotification: NSNotification.Name
let
AVSampleBufferVideoRenderer.didFailToDecodeNotificationErrorKey
DeprecatediOSmacOStvOSvisionOSpublic class let didFailToDecodeNotificationErrorKey: String
let
AVSampleBufferVideoRenderer.requiresFlushToResumeDecodingDidChangeNotification
DeprecatediOSmacOStvOSvisionOSpublic class let requiresFlushToResumeDecodingDidChangeNotification: NSNotification.Name
func
AVVideoComposition.videoComposition
DeprecatediOSmacOStvOSvisionOSopen class func videoComposition(with asset: AVAsset, applyingCIFiltersWithHandler applier: @escaping @Sendable (AVAsynchronousCIImageFilteringRequest) -> Void, completionHandler: @escaping @Sendable (AVVideoComposition?, (any Error)?) -> Void)
Vends a new instance of AVVideoComposition with values and instructions that will apply the specified handler block to video frames represented as instances of CIImage.
The new AVVideoComposition will cause the specified handler block to be called to filter each frame of the asset's first enabled video track. The handler block should use the properties of the provided AVAsynchronousCIImageFilteringRequest and respond using finishWithImage:context: with a "filtered" new CIImage (or the provided source image for no affect). In the event of an error, respond to the request using finishWithError:. The error can be observed via AVPlayerItemFailedToPlayToEndTimeNotification, see AVPlayerItemFailedToPlayToEndTimeErrorKey in notification payload.
NOTE: The returned AVVideoComposition's properties are private and support only CIFilter-based operations. Mutations are not supported, either in the values of properties of the AVVideoComposition itself or in its private instructions. If rotations or other transformations are desired, they must be accomplished via the application of CIFilters during the execution of your specified handler.
The video composition will also have the following values for its properties:
- The original timing of the asset's first enabled video track will be used.
- A renderSize that encompasses the asset's first enabled video track respecting the track's preferredTransform.
- A renderScale of 1.0.
The default CIContext has the following properties:
- iOS: Device RGB color space
- macOS: sRGB color space
Example usage:
[AVVideoComposition videoCompositionWithAsset:srcAsset applyingCIFiltersWithHandler:
^(AVAsynchronousCIImageFilteringRequest *request)
{
NSError *err = nil;
CIImage *filtered = myRenderer(request, &err);
if (filtered)
[request finishWithImage:filtered context:nil];
else
[request finishWithError:err];
} completionHandler:
^(AVVideoComposition * _Nullable videoComposition, NSError * _Nullable error)
{
if (videoComposition != nil) {
playerItem.videoComposition = videoComposition
else {
// handle error
}];
Parameters
asset- An instance of AVAsset.
completionHandler- A block that is invoked when the new video composition has finished being created. If the
videoComposition parameter is nil, the error parameter describes the failure that occurred.
func
AVVideoComposition.videoComposition
DeprecatediOSmacOStvOSvisionOSopen class func videoComposition(with asset: AVAsset, applyingCIFiltersWithHandler applier: @escaping @Sendable (AVAsynchronousCIImageFilteringRequest) -> Void) async throws -> AVVideoComposition
Vends a new instance of AVVideoComposition with values and instructions that will apply the specified handler block to video frames represented as instances of CIImage.
The new AVVideoComposition will cause the specified handler block to be called to filter each frame of the asset's first enabled video track. The handler block should use the properties of the provided AVAsynchronousCIImageFilteringRequest and respond using finishWithImage:context: with a "filtered" new CIImage (or the provided source image for no affect). In the event of an error, respond to the request using finishWithError:. The error can be observed via AVPlayerItemFailedToPlayToEndTimeNotification, see AVPlayerItemFailedToPlayToEndTimeErrorKey in notification payload.
NOTE: The returned AVVideoComposition's properties are private and support only CIFilter-based operations. Mutations are not supported, either in the values of properties of the AVVideoComposition itself or in its private instructions. If rotations or other transformations are desired, they must be accomplished via the application of CIFilters during the execution of your specified handler.
The video composition will also have the following values for its properties:
- The original timing of the asset's first enabled video track will be used.
- A renderSize that encompasses the asset's first enabled video track respecting the track's preferredTransform.
- A renderScale of 1.0.
The default CIContext has the following properties:
- iOS: Device RGB color space
- macOS: sRGB color space
Example usage:
[AVVideoComposition videoCompositionWithAsset:srcAsset applyingCIFiltersWithHandler:
^(AVAsynchronousCIImageFilteringRequest *request)
{
NSError *err = nil;
CIImage *filtered = myRenderer(request, &err);
if (filtered)
[request finishWithImage:filtered context:nil];
else
[request finishWithError:err];
} completionHandler:
^(AVVideoComposition * _Nullable videoComposition, NSError * _Nullable error)
{
if (videoComposition != nil) {
playerItem.videoComposition = videoComposition
else {
// handle error
}];
Parameters
asset- An instance of AVAsset.
completionHandler- A block that is invoked when the new video composition has finished being created. If the
videoComposition parameter is nil, the error parameter describes the failure that occurred.
func
AVVideoOutputSpecification.setOutputPixelBufferAttributes
DeprecatediOSmacOStvOSvisionOSwatchOSpublic func setOutputPixelBufferAttributes(_ pixelBufferAttributes: [String : Any]?, for tagCollection: [CMTag])
DeprecatedUse setOutputSettings instead
var
NSNotification.Name.AVPlayerItemDidPlayToEndTime
DeprecatediOSmacOStvOSvisionOSwatchOSpublic static var AVPlayerItemDidPlayToEndTime: NSNotification.Name { get }
DeprecatedUse AVPlayerItem.didPlayToEndTimeNotification instead.
var
NSNotification.Name.AVPlayerItemFailedToPlayToEndTime
DeprecatediOSmacOStvOSvisionOSwatchOSpublic static var AVPlayerItemFailedToPlayToEndTime: NSNotification.Name { get }
DeprecatedUse AVPlayerItem.failedToPlayToEndTimeNotification instead.
var
NSNotification.Name.AVPlayerItemNewAccessLogEntry
DeprecatediOSmacOStvOSvisionOSwatchOSpublic static var AVPlayerItemNewAccessLogEntry: NSNotification.Name { get }
DeprecatedUse AVPlayerItem.newAccessLogEntryNotification instead.
var
NSNotification.Name.AVPlayerItemNewErrorLogEntry
DeprecatediOSmacOStvOSvisionOSwatchOSpublic static var AVPlayerItemNewErrorLogEntry: NSNotification.Name { get }
DeprecatedUse AVPlayerItem.newErrorLogEntryNotification instead.
var
NSNotification.Name.AVPlayerItemPlaybackStalled
DeprecatediOSmacOStvOSvisionOSwatchOSpublic static var AVPlayerItemPlaybackStalled: NSNotification.Name { get }
DeprecatedUse AVPlayerItem.playbackStalledNotification instead.
var
NSNotification.Name.AVPlayerItemTimeJumped
DeprecatediOSmacOStvOSvisionOSwatchOSpublic static var AVPlayerItemTimeJumped: NSNotification.Name { get }
DeprecatedUse AVPlayerItem.timeJumpedNotification instead.
let
NSNotification.Name.AVSampleBufferAudioRendererOutputConfigurationDidChange
DeprecatediOSmacOStvOSvisionOSwatchOSpublic static let AVSampleBufferAudioRendererOutputConfigurationDidChange: NSNotification.Name
let
NSNotification.Name.AVSampleBufferAudioRendererWasFlushedAutomatically
DeprecatediOSmacOStvOSvisionOSwatchOSpublic static let AVSampleBufferAudioRendererWasFlushedAutomatically: NSNotification.Name
No APIs match your filter.