Documentation Archive Developer
Search

AVFoundation Changes for Swift

AVFoundation

Declaration
From
class AVMetadataGroup : NSObject {
    var items: [AVMetadataItem] { get }
}
To
class AVMetadataGroup : NSObject {
    var items: [AVMetadataItem] { get }
}
extension AVMetadataGroup {
    var classifyingLabel: String? { get }
    var uniqueID: String? { get }
}

Modified AVPlayerItem
Declaration
From
class AVPlayerItem : NSObject, NSCopying {
    convenience init()
     init(URL URL: NSURL)
    class func playerItemWithURL(_ URL: NSURL) -> AVPlayerItem
     init(asset asset: AVAsset)
    class func playerItemWithAsset(_ asset: AVAsset) -> AVPlayerItem
     init(asset asset: AVAsset, automaticallyLoadedAssetKeys automaticallyLoadedAssetKeys: [String]?)
    class func playerItemWithAsset(_ asset: AVAsset, automaticallyLoadedAssetKeys automaticallyLoadedAssetKeys: [String]?) -> AVPlayerItem
    convenience init(URL URL: NSURL)
    convenience init(asset asset: AVAsset)
    init(asset asset: AVAsset, automaticallyLoadedAssetKeys automaticallyLoadedAssetKeys: [String]?)
    var status: AVPlayerItemStatus { get }
    var error: NSError? { get }
}
extension AVPlayerItem {
    var asset: AVAsset { get }
    var tracks: [AVPlayerItemTrack] { get }
    var duration: CMTime { get }
    var presentationSize: CGSize { get }
    var timedMetadata: [AVMetadataItem]? { get }
    var automaticallyLoadedAssetKeys: [String] { get }
}
extension AVPlayerItem {
    var canPlayFastForward: Bool { get }
    var canPlaySlowForward: Bool { get }
    var canPlayReverse: Bool { get }
    var canPlaySlowReverse: Bool { get }
    var canPlayFastReverse: Bool { get }
    var canStepForward: Bool { get }
    var canStepBackward: Bool { get }
}
extension AVPlayerItem {
    func currentTime() -> CMTime
    var forwardPlaybackEndTime: CMTime
    var reversePlaybackEndTime: CMTime
    var seekableTimeRanges: [NSValue] { get }
    func seekToTime(_ time: CMTime)
    func seekToTime(_ time: CMTime, completionHandler completionHandler: (Bool) -> Void)
    func seekToTime(_ time: CMTime, toleranceBefore toleranceBefore: CMTime, toleranceAfter toleranceAfter: CMTime)
    func seekToTime(_ time: CMTime, toleranceBefore toleranceBefore: CMTime, toleranceAfter toleranceAfter: CMTime, completionHandler completionHandler: (Bool) -> Void)
    func cancelPendingSeeks()
    func currentDate() -> NSDate?
    func seekToDate(_ date: NSDate) -> Bool
    func seekToDate(_ date: NSDate, completionHandler completionHandler: (Bool) -> Void) -> Bool
    func stepByCount(_ stepCount: Int)
    var timebase: CMTimebase? { get }
}
extension AVPlayerItem {
    @NSCopying var videoComposition: AVVideoComposition?
    var customVideoCompositor: AVVideoCompositing? { get }
    var seekingWaitsForVideoCompositionRendering: Bool
    var textStyleRules: [AVTextStyleRule]?
}
extension AVPlayerItem {
    var audioTimePitchAlgorithm: String
    @NSCopying var audioMix: AVAudioMix?
}
extension AVPlayerItem {
    var loadedTimeRanges: [NSValue] { get }
    var playbackLikelyToKeepUp: Bool { get }
    var playbackBufferFull: Bool { get }
    var playbackBufferEmpty: Bool { get }
    var canUseNetworkResourcesForLiveStreamingWhilePaused: Bool
}
extension AVPlayerItem {
    var preferredPeakBitRate: Double
}
extension AVPlayerItem {
    func selectMediaOption(_ mediaSelectionOption: AVMediaSelectionOption?, inMediaSelectionGroup mediaSelectionGroup: AVMediaSelectionGroup)
    func selectMediaOptionAutomaticallyInMediaSelectionGroup(_ mediaSelectionGroup: AVMediaSelectionGroup)
    func selectedMediaOptionInMediaSelectionGroup(_ mediaSelectionGroup: AVMediaSelectionGroup) -> AVMediaSelectionOption?
    var currentMediaSelection: AVMediaSelection { get }
}
extension AVPlayerItem {
    func accessLog() -> AVPlayerItemAccessLog?
    func errorLog() -> AVPlayerItemErrorLog?
}
extension AVPlayerItem {
    func addOutput(_ output: AVPlayerItemOutput)
    func removeOutput(_ output: AVPlayerItemOutput)
    var outputs: [AVPlayerItemOutput] { get }
}
To
class AVPlayerItem : NSObject, NSCopying {
    convenience init()
     init(URL URL: NSURL)
    class func playerItemWithURL(_ URL: NSURL) -> AVPlayerItem
     init(asset asset: AVAsset)
    class func playerItemWithAsset(_ asset: AVAsset) -> AVPlayerItem
     init(asset asset: AVAsset, automaticallyLoadedAssetKeys automaticallyLoadedAssetKeys: [String]?)
    class func playerItemWithAsset(_ asset: AVAsset, automaticallyLoadedAssetKeys automaticallyLoadedAssetKeys: [String]?) -> AVPlayerItem
    convenience init(URL URL: NSURL)
    convenience init(asset asset: AVAsset)
    init(asset asset: AVAsset, automaticallyLoadedAssetKeys automaticallyLoadedAssetKeys: [String]?)
    var status: AVPlayerItemStatus { get }
    var error: NSError? { get }
}
extension AVPlayerItem {
    var asset: AVAsset { get }
    var tracks: [AVPlayerItemTrack] { get }
    var duration: CMTime { get }
    var presentationSize: CGSize { get }
    var timedMetadata: [AVMetadataItem]? { get }
    var automaticallyLoadedAssetKeys: [String] { get }
}
extension AVPlayerItem {
    var canPlayFastForward: Bool { get }
    var canPlaySlowForward: Bool { get }
    var canPlayReverse: Bool { get }
    var canPlaySlowReverse: Bool { get }
    var canPlayFastReverse: Bool { get }
    var canStepForward: Bool { get }
    var canStepBackward: Bool { get }
}
extension AVPlayerItem {
    func currentTime() -> CMTime
    var forwardPlaybackEndTime: CMTime
    var reversePlaybackEndTime: CMTime
    var seekableTimeRanges: [NSValue] { get }
    func seekToTime(_ time: CMTime)
    func seekToTime(_ time: CMTime, completionHandler completionHandler: (Bool) -> Void)
    func seekToTime(_ time: CMTime, toleranceBefore toleranceBefore: CMTime, toleranceAfter toleranceAfter: CMTime)
    func seekToTime(_ time: CMTime, toleranceBefore toleranceBefore: CMTime, toleranceAfter toleranceAfter: CMTime, completionHandler completionHandler: (Bool) -> Void)
    func cancelPendingSeeks()
    func currentDate() -> NSDate?
    func seekToDate(_ date: NSDate) -> Bool
    func seekToDate(_ date: NSDate, completionHandler completionHandler: (Bool) -> Void) -> Bool
    func stepByCount(_ stepCount: Int)
    var timebase: CMTimebase? { get }
}
extension AVPlayerItem {
    @NSCopying var videoComposition: AVVideoComposition?
    var customVideoCompositor: AVVideoCompositing? { get }
    var seekingWaitsForVideoCompositionRendering: Bool
    var textStyleRules: [AVTextStyleRule]?
}
extension AVPlayerItem {
    var audioTimePitchAlgorithm: String
    @NSCopying var audioMix: AVAudioMix?
}
extension AVPlayerItem {
    var loadedTimeRanges: [NSValue] { get }
    var playbackLikelyToKeepUp: Bool { get }
    var playbackBufferFull: Bool { get }
    var playbackBufferEmpty: Bool { get }
    var canUseNetworkResourcesForLiveStreamingWhilePaused: Bool
}
extension AVPlayerItem {
    var preferredPeakBitRate: Double
}
extension AVPlayerItem {
    func selectMediaOption(_ mediaSelectionOption: AVMediaSelectionOption?, inMediaSelectionGroup mediaSelectionGroup: AVMediaSelectionGroup)
    func selectMediaOptionAutomaticallyInMediaSelectionGroup(_ mediaSelectionGroup: AVMediaSelectionGroup)
    func selectedMediaOptionInMediaSelectionGroup(_ mediaSelectionGroup: AVMediaSelectionGroup) -> AVMediaSelectionOption?
    var currentMediaSelection: AVMediaSelection { get }
}
extension AVPlayerItem {
    func accessLog() -> AVPlayerItemAccessLog?
    func errorLog() -> AVPlayerItemErrorLog?
}
extension AVPlayerItem {
    func addOutput(_ output: AVPlayerItemOutput)
    func removeOutput(_ output: AVPlayerItemOutput)
    var outputs: [AVPlayerItemOutput] { get }
}
extension AVPlayerItem {
    func addMediaDataCollector(_ collector: AVPlayerItemMediaDataCollector)
    func removeMediaDataCollector(_ collector: AVPlayerItemMediaDataCollector)
    var mediaDataCollectors: [AVPlayerItemMediaDataCollector] { get }
}