Contents

isObservationEnabled

AVPlayer and other AVFoundation types can optionally be observed using Swift Observation.

Declaration

nonisolated class var isObservationEnabled: Bool { get set }

Discussion

When set to YES, new instances of AVPlayer, AVQueuePlayer, AVPlayerItem, and AVPlayerItemTrack are observable with Swift Observation. The default value is NO (not observable). An exception is thrown if this property is set YES after initializing any objects of these types, or if it is set to NO after any observable objects are initialized. In other words, all objects of these types must either be observable or not observable in an application instance.

For more information regarding management of class objects in SwiftUI, please refer to https://developer.apple.com/documentation/swiftui/state.