objc2_av_foundation/generated/
AVPlayerItem.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-media")]
9use objc2_core_media::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern "C" {
15    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemtimejumpednotification?language=objc)
16    pub static AVPlayerItemTimeJumpedNotification: &'static NSNotificationName;
17}
18
19extern "C" {
20    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemdidplaytoendtimenotification?language=objc)
21    pub static AVPlayerItemDidPlayToEndTimeNotification: &'static NSNotificationName;
22}
23
24extern "C" {
25    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemfailedtoplaytoendtimenotification?language=objc)
26    pub static AVPlayerItemFailedToPlayToEndTimeNotification: &'static NSNotificationName;
27}
28
29extern "C" {
30    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemplaybackstallednotification?language=objc)
31    pub static AVPlayerItemPlaybackStalledNotification: &'static NSNotificationName;
32}
33
34extern "C" {
35    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemnewaccesslogentrynotification?language=objc)
36    pub static AVPlayerItemNewAccessLogEntryNotification: &'static NSNotificationName;
37}
38
39extern "C" {
40    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemnewerrorlogentrynotification?language=objc)
41    pub static AVPlayerItemNewErrorLogEntryNotification: &'static NSNotificationName;
42}
43
44extern "C" {
45    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemrecommendedtimeoffsetfromlivedidchangenotification?language=objc)
46    pub static AVPlayerItemRecommendedTimeOffsetFromLiveDidChangeNotification:
47        &'static NSNotificationName;
48}
49
50extern "C" {
51    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemmediaselectiondidchangenotification?language=objc)
52    pub static AVPlayerItemMediaSelectionDidChangeNotification: &'static NSNotificationName;
53}
54
55extern "C" {
56    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemfailedtoplaytoendtimeerrorkey?language=objc)
57    pub static AVPlayerItemFailedToPlayToEndTimeErrorKey: &'static NSString;
58}
59
60extern "C" {
61    /// Indicates a time jump was caused by another participant connected through AVPlayerPlaybackCoordinator.
62    ///
63    /// Informs the receiver of an AVPlayerItemTimeJumpedNotification that a time jump originated from another AVCoordinatedPlaybackParticipant connected through AVPlayerPlaybackCoordinator. This can be used to inform UI showing why the current time changed. The type of the value for this key is an AVCoordinatedPlaybackParticipant, which is part of the AVPlayerPlaybackCoordinator.otherParticipants array.
64    ///
65    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemtimejumpedoriginatingparticipantkey?language=objc)
66    pub static AVPlayerItemTimeJumpedOriginatingParticipantKey: &'static NSString;
67}
68
69/// These constants are returned by the AVPlayerItem status property to indicate whether it can successfully be played.
70///
71///
72/// Indicates that the status of the player item is not yet known because it has not tried to load new media resources
73/// for playback.
74///
75/// Indicates that the player item is ready to be played.
76///
77/// Indicates that the player item can no longer be played because of an error. The error is described by the value of
78/// the player item's error property.
79///
80/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemstatus?language=objc)
81// NS_ENUM
82#[repr(transparent)]
83#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
84pub struct AVPlayerItemStatus(pub NSInteger);
85impl AVPlayerItemStatus {
86    #[doc(alias = "AVPlayerItemStatusUnknown")]
87    pub const Unknown: Self = Self(0);
88    #[doc(alias = "AVPlayerItemStatusReadyToPlay")]
89    pub const ReadyToPlay: Self = Self(1);
90    #[doc(alias = "AVPlayerItemStatusFailed")]
91    pub const Failed: Self = Self(2);
92}
93
94unsafe impl Encode for AVPlayerItemStatus {
95    const ENCODING: Encoding = NSInteger::ENCODING;
96}
97
98unsafe impl RefEncode for AVPlayerItemStatus {
99    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
100}
101
102extern_class!(
103    /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritem?language=objc)
104    #[unsafe(super(NSObject))]
105    #[thread_kind = MainThreadOnly]
106    #[derive(Debug, PartialEq, Eq, Hash)]
107    pub struct AVPlayerItem;
108);
109
110unsafe impl NSCopying for AVPlayerItem {}
111
112unsafe impl CopyingHelper for AVPlayerItem {
113    type Result = Self;
114}
115
116unsafe impl NSObjectProtocol for AVPlayerItem {}
117
118impl AVPlayerItem {
119    extern_methods!(
120        #[unsafe(method(init))]
121        #[unsafe(method_family = init)]
122        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
123
124        #[unsafe(method(new))]
125        #[unsafe(method_family = new)]
126        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
127
128        /// Returns an instance of AVPlayerItem for playing a resource at the specified location.
129        ///
130        /// Parameter `URL`:
131        /// Returns: An instance of AVPlayerItem.
132        ///
133        /// Equivalent to +playerItemWithAsset:, passing [AVAsset assetWithURL:URL] as the value of asset.
134        #[unsafe(method(playerItemWithURL:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn playerItemWithURL(url: &NSURL, mtm: MainThreadMarker) -> Retained<Self>;
137
138        #[cfg(feature = "AVAsset")]
139        /// Returns an instance of AVPlayerItem for playing an AVAsset.
140        ///
141        /// Parameter `asset`:
142        /// Returns: An instance of AVPlayerItem.
143        ///
144        /// Equivalent to +playerItemWithAsset:automaticallyLoadedAssetKeys:, passing
145        /// @
146        /// [
147        /// "
148        /// duration" ] as the value of automaticallyLoadedAssetKeys.
149        ///
150        /// This method, along with the companion `asset` property, is MainActor-isolated for Swift clients because AVAsset is not Sendable.  If you are using a Sendable subclass of AVAsset, such as AVURLAsset, an overload of this initializer will be chosen automatically to allow you to initialize an AVPlayerItem while not running on the main actor.
151        #[unsafe(method(playerItemWithAsset:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn playerItemWithAsset(asset: &AVAsset, mtm: MainThreadMarker)
154            -> Retained<Self>;
155
156        #[cfg(feature = "AVAsset")]
157        /// Returns an instance of AVPlayerItem for playing an AVAsset.
158        ///
159        /// Parameter `asset`:
160        /// Parameter `automaticallyLoadedAssetKeys`: An NSArray of NSStrings, each representing a property key defined by AVAsset. See AVAsset.h for property keys, e.g. duration.
161        ///
162        /// Returns: An instance of AVPlayerItem.
163        ///
164        /// The value of each key in automaticallyLoadedAssetKeys will be automatically be loaded by the underlying AVAsset before the receiver achieves the status AVPlayerItemStatusReadyToPlay; i.e. when the item is ready to play, the value of -[[AVPlayerItem asset] statusOfValueForKey:error:] will be one of the terminal status values greater than AVKeyValueStatusLoading.
165        ///
166        /// This method, along with the companion `asset` property, is MainActor-isolated for Swift clients because AVAsset is not Sendable.  If you are using a Sendable subclass of AVAsset, such as AVURLAsset, you can use `init(asset:automaticallyLoadedAssetKeys:)` to initialize an AVPlayerItem while not running on the main actor.
167        #[unsafe(method(playerItemWithAsset:automaticallyLoadedAssetKeys:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn playerItemWithAsset_automaticallyLoadedAssetKeys(
170            asset: &AVAsset,
171            automatically_loaded_asset_keys: Option<&NSArray<NSString>>,
172            mtm: MainThreadMarker,
173        ) -> Retained<Self>;
174
175        /// Initializes an AVPlayerItem with an NSURL.
176        ///
177        /// Parameter `URL`:
178        /// Returns: An instance of AVPlayerItem
179        ///
180        /// Equivalent to -initWithAsset:, passing [AVAsset assetWithURL:URL] as the value of asset.
181        #[unsafe(method(initWithURL:))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
184
185        #[cfg(feature = "AVAsset")]
186        /// Initializes an AVPlayerItem with an AVAsset.
187        ///
188        /// Parameter `asset`:
189        /// Returns: An instance of AVPlayerItem
190        ///
191        /// Equivalent to -initWithAsset:automaticallyLoadedAssetKeys:, passing
192        /// @
193        /// [
194        /// "
195        /// duration" ] as the value of automaticallyLoadedAssetKeys.
196        ///
197        /// This method, along with the companion `asset` property, is MainActor-isolated for Swift clients because AVAsset is not Sendable.  If you are using a Sendable subclass of AVAsset, such as AVURLAsset, an overload of this initializer will be chosen automatically to allow you to initialize an AVPlayerItem while not running on the main actor.
198        #[unsafe(method(initWithAsset:))]
199        #[unsafe(method_family = init)]
200        pub unsafe fn initWithAsset(this: Allocated<Self>, asset: &AVAsset) -> Retained<Self>;
201
202        #[cfg(feature = "AVAsset")]
203        /// Initializes an AVPlayerItem with an AVAsset.
204        ///
205        /// Parameter `asset`: An instance of AVAsset.
206        ///
207        /// Parameter `automaticallyLoadedAssetKeys`: An NSArray of NSStrings, each representing a property key defined by AVAsset. See AVAsset.h for property keys, e.g. duration.
208        ///
209        /// Returns: An instance of AVPlayerItem
210        ///
211        /// The value of each key in automaticallyLoadedAssetKeys will be automatically be loaded by the underlying AVAsset before the receiver achieves the status AVPlayerItemStatusReadyToPlay; i.e. when the item is ready to play, the value of -[[AVPlayerItem asset] statusOfValueForKey:error:] will be one of the terminal status values greater than AVKeyValueStatusLoading.
212        ///
213        /// This method, along with the companion `asset` property, is MainActor-isolated for Swift clients because AVAsset is not Sendable.  If you are using a Sendable subclass of AVAsset, such as AVURLAsset, you can use `init(asset:automaticallyLoadedAssetKeys:)` to initialize an AVPlayerItem while not running on the main actor.
214        #[unsafe(method(initWithAsset:automaticallyLoadedAssetKeys:))]
215        #[unsafe(method_family = init)]
216        pub unsafe fn initWithAsset_automaticallyLoadedAssetKeys(
217            this: Allocated<Self>,
218            asset: &AVAsset,
219            automatically_loaded_asset_keys: Option<&NSArray<NSString>>,
220        ) -> Retained<Self>;
221
222        #[unsafe(method(copyWithZone:))]
223        #[unsafe(method_family = copy)]
224        pub unsafe fn copyWithZone(&self, zone: *mut NSZone) -> Retained<AnyObject>;
225
226        #[unsafe(method(copy))]
227        #[unsafe(method_family = copy)]
228        pub unsafe fn copy(&self) -> Retained<AnyObject>;
229
230        /// The ability of the receiver to be used for playback.
231        ///
232        ///
233        /// The value of this property is an AVPlayerItemStatus that indicates whether the receiver can be used for playback.
234        /// When the value of this property is AVPlayerItemStatusFailed, the receiver can no longer be used for playback and
235        /// a new instance needs to be created in its place. When this happens, clients can check the value of the error
236        /// property to determine the nature of the failure. The value of this property will not be updated after the receiver
237        /// is removed from an AVPlayer. This property is key value observable.
238        #[unsafe(method(status))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn status(&self) -> AVPlayerItemStatus;
241
242        /// If the receiver's status is AVPlayerItemStatusFailed, this describes the error that caused the failure.
243        ///
244        ///
245        /// The value of this property is an NSError that describes what caused the receiver to no longer be able to be played.
246        /// If the receiver's status is not AVPlayerItemStatusFailed, the value of this property is nil.
247        #[unsafe(method(error))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn error(&self) -> Option<Retained<NSError>>;
250    );
251}
252
253/// AVPlayerItemInspection.
254impl AVPlayerItem {
255    extern_methods!(
256        #[cfg(feature = "AVAsset")]
257        /// Accessor for underlying AVAsset.
258        #[unsafe(method(asset))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn asset(&self) -> Retained<AVAsset>;
261
262        #[cfg(feature = "AVPlayerItemTrack")]
263        /// Provides array of AVPlayerItem tracks. Observable (can change dynamically during playback).
264        ///
265        ///
266        /// The value of this property will accord with the properties of the underlying media resource when the receiver becomes ready to play.
267        /// Before the underlying media resource has been sufficiently loaded, its value is an empty NSArray. Use key-value observation to obtain
268        /// a valid array of tracks as soon as it becomes available.
269        #[unsafe(method(tracks))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn tracks(&self) -> Retained<NSArray<AVPlayerItemTrack>>;
272
273        #[cfg(feature = "objc2-core-media")]
274        /// Indicates the duration of the item, not considering either its forwardPlaybackEndTime or reversePlaybackEndTime.
275        ///
276        ///
277        /// This property is observable. The duration of an item can change dynamically during playback.
278        ///
279        /// Unless you omit
280        /// "
281        /// duration" from the array of asset keys you pass to +playerItemWithAsset:automaticallyLoadedAssetKeys: or
282        /// -initWithAsset:automaticallyLoadedAssetKeys:, the value of this property will accord with the properties of the underlying
283        /// AVAsset and the current state of playback once the receiver becomes ready to play.
284        ///
285        /// Before the underlying duration has been loaded, the value of this property is kCMTimeIndefinite. Use key-value observation to
286        /// obtain a valid duration as soon as it becomes available. (Note that the value of duration may remain kCMTimeIndefinite,
287        /// e.g. for live streams.)
288        #[unsafe(method(duration))]
289        #[unsafe(method_family = none)]
290        pub unsafe fn duration(&self) -> CMTime;
291
292        #[cfg(feature = "objc2-core-foundation")]
293        /// The size of the receiver as presented by the player.
294        ///
295        ///
296        /// Indicates the size at which the visual portion of the item is presented by the player; can be scaled from this
297        /// size to fit within the bounds of an AVPlayerLayer via its videoGravity property. Can be scaled arbitrarily for presentation
298        /// via the frame property of an AVPlayerLayer.
299        ///
300        /// The value of this property will accord with the properties of the underlying media resource when the receiver becomes ready to play.
301        /// Before the underlying media resource is sufficiently loaded, its value is CGSizeZero. Use key-value observation to obtain a valid
302        /// presentationSize as soon as it becomes available. (Note that the value of presentationSize may remain CGSizeZero, e.g. for audio-only items.)
303        #[unsafe(method(presentationSize))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn presentationSize(&self) -> CGSize;
306
307        #[cfg(feature = "AVMetadataItem")]
308        /// Provides an NSArray of AVMetadataItems representing the timed metadata encountered most recently within the media as it plays. May be nil.
309        ///
310        /// Notifications of changes are available via key-value observation.
311        /// As an optimization for playback, AVPlayerItem may omit the processing of timed metadata when no observer of this property is registered. Therefore, when no such observer is registered, the value of the timedMetadata property may remain nil regardless of the contents of the underlying media.
312        ///
313        /// This property must be accessed on the main thread/queue.
314        #[deprecated = "Use AVPlayerItemMetadataOutput to obtain timed metadata"]
315        #[unsafe(method(timedMetadata))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn timedMetadata(&self) -> Option<Retained<NSArray<AVMetadataItem>>>;
318
319        /// An array of property keys defined on AVAsset. The value of each key in the array is automatically loaded while the receiver is being made ready to play.
320        ///
321        /// The value of each key in automaticallyLoadedAssetKeys will be automatically be loaded by the underlying AVAsset before the receiver achieves the status AVPlayerItemStatusReadyToPlay; i.e. when the item is ready to play, the value of -[[AVPlayerItem asset] statusOfValueForKey:error:] will be AVKeyValueStatusLoaded. If loading of any of the values fails, the status of the AVPlayerItem will change instead to AVPlayerItemStatusFailed..
322        #[unsafe(method(automaticallyLoadedAssetKeys))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn automaticallyLoadedAssetKeys(&self) -> Retained<NSArray<NSString>>;
325    );
326}
327
328/// AVPlayerItemRateAndSteppingSupport.
329impl AVPlayerItem {
330    extern_methods!(
331        #[unsafe(method(canPlayFastForward))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn canPlayFastForward(&self) -> bool;
334
335        #[unsafe(method(canPlaySlowForward))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn canPlaySlowForward(&self) -> bool;
338
339        #[unsafe(method(canPlayReverse))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn canPlayReverse(&self) -> bool;
342
343        #[unsafe(method(canPlaySlowReverse))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn canPlaySlowReverse(&self) -> bool;
346
347        #[unsafe(method(canPlayFastReverse))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn canPlayFastReverse(&self) -> bool;
350
351        #[unsafe(method(canStepForward))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn canStepForward(&self) -> bool;
354
355        #[unsafe(method(canStepBackward))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn canStepBackward(&self) -> bool;
358
359        #[cfg(feature = "objc2-core-media")]
360        /// Indicates how close to the latest content in a live stream playback will begin after a live start or a seek to kCMTimePositiveInfinity.
361        ///
362        /// For non-live assets this value is kCMTimeInvalid.
363        #[unsafe(method(configuredTimeOffsetFromLive))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn configuredTimeOffsetFromLive(&self) -> CMTime;
366
367        #[cfg(feature = "objc2-core-media")]
368        /// Setter for [`configuredTimeOffsetFromLive`][Self::configuredTimeOffsetFromLive].
369        #[unsafe(method(setConfiguredTimeOffsetFromLive:))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn setConfiguredTimeOffsetFromLive(
372            &self,
373            configured_time_offset_from_live: CMTime,
374        );
375
376        #[cfg(feature = "objc2-core-media")]
377        /// A recommended value for configuredTimeOffsetFromLive, based on observed network conditions.
378        ///
379        /// For non-live assets this value is kCMTimeInvalid.
380        #[unsafe(method(recommendedTimeOffsetFromLive))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn recommendedTimeOffsetFromLive(&self) -> CMTime;
383
384        /// Indicates that after the player spends a period of time buffering media, it will skip forward if necessary to restore the playhead's distance from the live edge of the presentation to what it was when buffering began.
385        ///
386        /// If the value of this property is YES and the player must buffer media from the network in order to resume playback, the player will seek forward if necessary before resuming playback to restore the position that the playhead had when rebuffering began, relative to the end of the current AVPlayerItem's seekableTimeRange.
387        ///
388        /// This behavior applies to media buffering that occurs as a consequence of starting playback, seeking, and recovering from a playback stall.
389        ///
390        /// Note that if the network cannot deliver media quickly enough to maintain the playback rate, playback may stall interminably.
391        ///
392        /// This property value has no effect if the asset is not a live stream. The default value of this property is NO.
393        #[unsafe(method(automaticallyPreservesTimeOffsetFromLive))]
394        #[unsafe(method_family = none)]
395        pub unsafe fn automaticallyPreservesTimeOffsetFromLive(&self) -> bool;
396
397        /// Setter for [`automaticallyPreservesTimeOffsetFromLive`][Self::automaticallyPreservesTimeOffsetFromLive].
398        #[unsafe(method(setAutomaticallyPreservesTimeOffsetFromLive:))]
399        #[unsafe(method_family = none)]
400        pub unsafe fn setAutomaticallyPreservesTimeOffsetFromLive(
401            &self,
402            automatically_preserves_time_offset_from_live: bool,
403        );
404    );
405}
406
407/// AVPlayerItemTimeControl.
408impl AVPlayerItem {
409    extern_methods!(
410        #[cfg(feature = "objc2-core-media")]
411        /// Returns the current time of the item.
412        ///
413        /// Returns: A CMTime
414        ///
415        /// Returns the current time of the item. Not key-value observable; use -[AVPlayer addPeriodicTimeObserverForInterval:queue:usingBlock:] instead.
416        #[unsafe(method(currentTime))]
417        #[unsafe(method_family = none)]
418        pub unsafe fn currentTime(&self) -> CMTime;
419
420        #[cfg(feature = "objc2-core-media")]
421        /// The end time for forward playback.
422        ///
423        ///
424        /// Specifies the time at which playback should end when the playback rate is positive (see AVPlayer's rate property).
425        /// The default value is kCMTimeInvalid, which indicates that no end time for forward playback is specified.
426        /// In this case, the effective end time for forward playback is the receiver's duration.
427        ///
428        /// When the end time is reached, the receiver will post AVPlayerItemDidPlayToEndTimeNotification and the AVPlayer will take
429        /// the action indicated by the value of its actionAtItemEnd property (see AVPlayerActionAtItemEnd in AVPlayer.h).
430        ///
431        /// The value of this property has no effect on playback when the rate is negative.
432        #[unsafe(method(forwardPlaybackEndTime))]
433        #[unsafe(method_family = none)]
434        pub unsafe fn forwardPlaybackEndTime(&self) -> CMTime;
435
436        #[cfg(feature = "objc2-core-media")]
437        /// Setter for [`forwardPlaybackEndTime`][Self::forwardPlaybackEndTime].
438        #[unsafe(method(setForwardPlaybackEndTime:))]
439        #[unsafe(method_family = none)]
440        pub unsafe fn setForwardPlaybackEndTime(&self, forward_playback_end_time: CMTime);
441
442        #[cfg(feature = "objc2-core-media")]
443        /// The end time for reverse playback.
444        ///
445        ///
446        /// Specifies the time at which playback should end when the playback rate is negative (see AVPlayer's rate property).
447        /// The default value is kCMTimeInvalid, which indicates that no end time for reverse playback is specified.
448        /// In this case, the effective end time for reverse playback is kCMTimeZero.
449        ///
450        /// When the end time is reached, the receiver will post AVPlayerItemDidPlayToEndTimeNotification and the AVPlayer will take
451        /// the action indicated by the value of its actionAtItemEnd property (see AVPlayerActionAtItemEnd in AVPlayer.h).
452        ///
453        /// The value of this property has no effect on playback when the rate is positive.
454        #[unsafe(method(reversePlaybackEndTime))]
455        #[unsafe(method_family = none)]
456        pub unsafe fn reversePlaybackEndTime(&self) -> CMTime;
457
458        #[cfg(feature = "objc2-core-media")]
459        /// Setter for [`reversePlaybackEndTime`][Self::reversePlaybackEndTime].
460        #[unsafe(method(setReversePlaybackEndTime:))]
461        #[unsafe(method_family = none)]
462        pub unsafe fn setReversePlaybackEndTime(&self, reverse_playback_end_time: CMTime);
463
464        /// This property provides a collection of time ranges that the player item can seek to. The ranges provided might be discontinous.
465        ///
466        /// Returns an NSArray of NSValues containing CMTimeRanges.
467        #[unsafe(method(seekableTimeRanges))]
468        #[unsafe(method_family = none)]
469        pub unsafe fn seekableTimeRanges(&self) -> Retained<NSArray<NSValue>>;
470
471        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
472        /// Moves the playback cursor and invokes the specified block when the seek operation has either been completed or been interrupted.
473        ///
474        /// Parameter `time`:
475        /// Parameter `completionHandler`:
476        /// Use this method to seek to a specified time for the item and to be notified when the seek operation is complete.
477        /// The completion handler for any prior seek request that is still in process will be invoked immediately with the finished parameter
478        /// set to NO. If the new request completes without being interrupted by another seek request or by any other operation the specified
479        /// completion handler will be invoked with the finished parameter set to YES.
480        /// If the seek time is outside of seekable time ranges as indicated by seekableTimeRanges property, the seek request will be cancelled and the completion handler will be invoked with the finished parameter set to NO.
481        ///
482        /// This method throws an exception if time is invalid or indefinite.
483        #[unsafe(method(seekToTime:completionHandler:))]
484        #[unsafe(method_family = none)]
485        pub unsafe fn seekToTime_completionHandler(
486            &self,
487            time: CMTime,
488            completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
489        );
490
491        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
492        /// Moves the playback cursor within a specified time bound and invokes the specified block when the seek operation has either been completed or been interrupted.
493        ///
494        /// Parameter `time`:
495        /// Parameter `toleranceBefore`:
496        /// Parameter `toleranceAfter`:
497        /// Parameter `completionHandler`:
498        /// Use this method to seek to a specified time for the item and to be notified when the seek operation is complete.
499        /// The time seeked to will be within the range [time-toleranceBefore, time+toleranceAfter] and may differ from the specified time for efficiency.
500        /// Pass kCMTimeZero for both toleranceBefore and toleranceAfter to request sample accurate seeking which may incur additional decoding delay.
501        /// Messaging this method with beforeTolerance:kCMTimePositiveInfinity and afterTolerance:kCMTimePositiveInfinity is the same as messaging seekToTime: directly.
502        /// The completion handler for any prior seek request that is still in process will be invoked immediately with the finished parameter set to NO. If the new
503        /// request completes without being interrupted by another seek request or by any other operation the specified completion handler will be invoked with the
504        /// finished parameter set to YES.
505        /// If the seek time is outside of seekable time ranges as indicated by seekableTimeRanges property, the seek request will be cancelled and the completion handler will be invoked with the finished parameter set to NO.
506        ///
507        /// This method throws an exception if time is invalid or indefinite or if tolerance before or tolerance after is invalid or negative.
508        #[unsafe(method(seekToTime:toleranceBefore:toleranceAfter:completionHandler:))]
509        #[unsafe(method_family = none)]
510        pub unsafe fn seekToTime_toleranceBefore_toleranceAfter_completionHandler(
511            &self,
512            time: CMTime,
513            tolerance_before: CMTime,
514            tolerance_after: CMTime,
515            completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
516        );
517
518        /// Cancel any pending seek requests and invoke the corresponding completion handlers if present.
519        ///
520        /// Use this method to cancel and release the completion handlers of pending seeks. The finished parameter of the completion handlers will
521        /// be set to NO.
522        #[unsafe(method(cancelPendingSeeks))]
523        #[unsafe(method_family = none)]
524        pub unsafe fn cancelPendingSeeks(&self);
525
526        /// If currentTime is mapped to a particular (real-time) date, return that date.
527        ///
528        /// Returns: Returns the date of current playback, or nil if playback is not mapped to any date.
529        #[unsafe(method(currentDate))]
530        #[unsafe(method_family = none)]
531        pub unsafe fn currentDate(&self) -> Option<Retained<NSDate>>;
532
533        #[cfg(feature = "block2")]
534        /// move playhead to a point corresponding to a particular date, and invokes the specified block when the seek operation has either been completed or been interrupted.
535        ///
536        /// For playback content that is associated with a range of dates, move the
537        /// playhead to point within that range and invokes the completion handler when the seek operation is complete.
538        /// Will fail if the supplied date is outside the range or if the content is not associated with a range of dates.
539        /// The completion handler for any prior seek request that is still in process will be invoked immediately with the finished parameter
540        /// set to NO. If the new request completes without being interrupted by another seek request or by any other operation, the specified
541        /// completion handler will be invoked with the finished parameter set to YES.
542        ///
543        /// Parameter `date`: The new position for the playhead.
544        ///
545        /// Parameter `completionHandler`: The block to invoke when seek operation is complete
546        ///
547        /// Returns: Returns true if the playhead was moved to the supplied date.
548        #[unsafe(method(seekToDate:completionHandler:))]
549        #[unsafe(method_family = none)]
550        pub unsafe fn seekToDate_completionHandler(
551            &self,
552            date: &NSDate,
553            completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
554        ) -> bool;
555
556        /// Moves player's current item's current time forward or backward by the specified number of steps.
557        ///
558        /// Parameter `stepCount`: The number of steps by which to move. A positive number results in stepping forward, a negative number in stepping backward.
559        ///
560        /// The size of each step depends on the enabled AVPlayerItemTracks of the AVPlayerItem.
561        ///
562        /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this method must be invoked on the main thread/queue.
563        #[unsafe(method(stepByCount:))]
564        #[unsafe(method_family = none)]
565        pub unsafe fn stepByCount(&self, step_count: NSInteger);
566
567        #[cfg(feature = "objc2-core-media")]
568        /// The item's timebase.
569        ///
570        /// You can examine the timebase to discover the relationship between the item's time and the source clock used for drift synchronization.
571        /// This timebase is read-only; you cannot set its time or rate to affect playback.
572        #[unsafe(method(timebase))]
573        #[unsafe(method_family = none)]
574        pub unsafe fn timebase(&self) -> Option<Retained<CMTimebase>>;
575    );
576}
577
578/// AVPlayerItemVisualPresentation.
579impl AVPlayerItem {
580    extern_methods!(
581        #[cfg(feature = "AVVideoComposition")]
582        /// Indicates the video composition settings to be applied during playback.
583        ///
584        /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this property must be accessed on the main thread/queue.
585        ///
586        /// This property throws an exception if a video composition is set with any of the following values:
587        /// - renderSize, renderScale, or frameDuration is less than or equal to zero
588        /// - sourceTrackIDForFrameTiming is less than or equal to zero
589        /// - uses AVVideoCompositionCoreAnimationTool (works for offline rendering only)
590        #[unsafe(method(videoComposition))]
591        #[unsafe(method_family = none)]
592        pub unsafe fn videoComposition(&self) -> Option<Retained<AVVideoComposition>>;
593
594        #[cfg(feature = "AVVideoComposition")]
595        /// Setter for [`videoComposition`][Self::videoComposition].
596        #[unsafe(method(setVideoComposition:))]
597        #[unsafe(method_family = none)]
598        pub unsafe fn setVideoComposition(&self, video_composition: Option<&AVVideoComposition>);
599
600        #[cfg(feature = "AVVideoCompositing")]
601        /// Indicates the custom video compositor instance.
602        ///
603        /// This property is nil if there is no video compositor, or if the internal video compositor is in use. This reference can be used to provide extra context to the custom video compositor instance if required.  The value of this property can change as a result of setting the `videoComposition` property.
604        ///
605        /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this property must be accessed on the main thread/queue.
606        #[unsafe(method(customVideoCompositor))]
607        #[unsafe(method_family = none)]
608        pub unsafe fn customVideoCompositor(
609            &self,
610        ) -> Option<Retained<ProtocolObject<dyn AVVideoCompositing>>>;
611
612        /// Indicates whether the item's timing follows the displayed video frame when seeking with a video composition
613        ///
614        /// By default, item timing is updated as quickly as possible, not waiting for media at new times to be rendered when seeking or
615        /// during normal playback. The latency that occurs, for example, between the completion of a seek operation and the display of a
616        /// video frame at a new time is negligible in most situations. However, when video compositions are in use, the processing of
617        /// video for any particular time may introduce noticeable latency. Therefore it may be desirable when a video composition is in
618        /// use for the item's timing be updated only after the video frame for a time has been displayed. This allows, for instance, an
619        /// AVSynchronizedLayer associated with an AVPlayerItem to remain in synchronization with the displayed video and for the
620        /// currentTime property to return the time of the displayed video.
621        ///
622        /// This property has no effect on items for which videoComposition is nil.
623        #[unsafe(method(seekingWaitsForVideoCompositionRendering))]
624        #[unsafe(method_family = none)]
625        pub unsafe fn seekingWaitsForVideoCompositionRendering(&self) -> bool;
626
627        /// Setter for [`seekingWaitsForVideoCompositionRendering`][Self::seekingWaitsForVideoCompositionRendering].
628        #[unsafe(method(setSeekingWaitsForVideoCompositionRendering:))]
629        #[unsafe(method_family = none)]
630        pub unsafe fn setSeekingWaitsForVideoCompositionRendering(
631            &self,
632            seeking_waits_for_video_composition_rendering: bool,
633        );
634
635        #[cfg(feature = "AVTextStyleRule")]
636        /// An array of AVTextStyleRules representing text styling that can be applied to subtitles and other legible media.
637        ///
638        /// The styling information contained in each AVTextStyleRule object in the array is used only when no equivalent styling information is provided by the media resource being played.  For example, if the text style rules specify Courier font but the media resource specifies Helvetica font, the text will be drawn using Helvetica font.
639        ///
640        /// This property has an effect only for tracks with media subtype kCMSubtitleFormatType_WebVTT.
641        #[unsafe(method(textStyleRules))]
642        #[unsafe(method_family = none)]
643        pub unsafe fn textStyleRules(&self) -> Option<Retained<NSArray<AVTextStyleRule>>>;
644
645        #[cfg(feature = "AVTextStyleRule")]
646        /// Setter for [`textStyleRules`][Self::textStyleRules].
647        #[unsafe(method(setTextStyleRules:))]
648        #[unsafe(method_family = none)]
649        pub unsafe fn setTextStyleRules(&self, text_style_rules: Option<&NSArray<AVTextStyleRule>>);
650
651        #[cfg(feature = "AVVideoSettings")]
652        /// Specifies the video aperture mode to apply during playback.
653        ///
654        /// See AVVideoApertureMode constants defined in AVVideoSettings.h. Default is AVVideoApertureModeCleanAperture.
655        #[unsafe(method(videoApertureMode))]
656        #[unsafe(method_family = none)]
657        pub unsafe fn videoApertureMode(&self) -> Retained<AVVideoApertureMode>;
658
659        #[cfg(feature = "AVVideoSettings")]
660        /// Setter for [`videoApertureMode`][Self::videoApertureMode].
661        #[unsafe(method(setVideoApertureMode:))]
662        #[unsafe(method_family = none)]
663        pub unsafe fn setVideoApertureMode(&self, video_aperture_mode: &AVVideoApertureMode);
664
665        /// Controls whether or not to apply the per frame HDR display metadata of the source during playback.
666        #[unsafe(method(appliesPerFrameHDRDisplayMetadata))]
667        #[unsafe(method_family = none)]
668        pub unsafe fn appliesPerFrameHDRDisplayMetadata(&self) -> bool;
669
670        /// Setter for [`appliesPerFrameHDRDisplayMetadata`][Self::appliesPerFrameHDRDisplayMetadata].
671        #[unsafe(method(setAppliesPerFrameHDRDisplayMetadata:))]
672        #[unsafe(method_family = none)]
673        pub unsafe fn setAppliesPerFrameHDRDisplayMetadata(
674            &self,
675            applies_per_frame_hdr_display_metadata: bool,
676        );
677    );
678}
679
680/// AVPlayerItemAudioProcessing.
681impl AVPlayerItem {
682    extern_methods!(
683        #[cfg(feature = "AVAudioProcessingSettings")]
684        /// Indicates the processing algorithm used to manage audio pitch at varying rates and for scaled audio edits.
685        ///
686        /// Constants for various time pitch algorithms, e.g. AVAudioTimePitchSpectral, are defined in AVAudioProcessingSettings.h.
687        /// The default value for applications linked on or after iOS 15.0 or macOS 12.0 is AVAudioTimePitchAlgorithmTimeDomain. For iOS versions prior to 15.0 the default value is AVAudioTimePitchAlgorithmLowQualityZeroLatency.
688        /// For macOS versions prior to 12.0 the default value is AVAudioTimePitchAlgorithmSpectral.
689        #[unsafe(method(audioTimePitchAlgorithm))]
690        #[unsafe(method_family = none)]
691        pub unsafe fn audioTimePitchAlgorithm(&self) -> Retained<AVAudioTimePitchAlgorithm>;
692
693        #[cfg(feature = "AVAudioProcessingSettings")]
694        /// Setter for [`audioTimePitchAlgorithm`][Self::audioTimePitchAlgorithm].
695        #[unsafe(method(setAudioTimePitchAlgorithm:))]
696        #[unsafe(method_family = none)]
697        pub unsafe fn setAudioTimePitchAlgorithm(
698            &self,
699            audio_time_pitch_algorithm: &AVAudioTimePitchAlgorithm,
700        );
701
702        /// Indicates whether audio spatialization is allowed
703        ///
704        /// When audio spatialization is allowed for an AVPlayerItem, the AVPlayer may render multichannel audio if available even if the output device doesn't support multichannel audio on its own, via use of a synthetic channel layout. When audio spatialization is not allowed, the AVPlayer must render audio with a channel layout that best matches the capabilities of the output device. This property is not observable. Defaults to YES.
705        #[deprecated = "Use allowedAudioSpatializationFormats instead"]
706        #[unsafe(method(isAudioSpatializationAllowed))]
707        #[unsafe(method_family = none)]
708        pub unsafe fn isAudioSpatializationAllowed(&self) -> bool;
709
710        /// Setter for [`isAudioSpatializationAllowed`][Self::isAudioSpatializationAllowed].
711        #[deprecated = "Use allowedAudioSpatializationFormats instead"]
712        #[unsafe(method(setAudioSpatializationAllowed:))]
713        #[unsafe(method_family = none)]
714        pub unsafe fn setAudioSpatializationAllowed(&self, audio_spatialization_allowed: bool);
715
716        #[cfg(feature = "AVAudioProcessingSettings")]
717        /// Indicates the source audio channel layouts allowed by the receiver for spatialization.
718        ///
719        /// Spatialization uses psychoacoustic methods to create a more immersive audio rendering when the content is played on specialized headphones and speaker arrangements. When an AVPlayerItem's allowedAudioSpatializationFormats property is set to AVAudioSpatializationFormatMonoAndStereo the AVPlayer will attempt to spatialize content tagged with a stereo channel layout, two-channel content with no layout specified as well as mono. It is considered incorrect to render a binaural recording with spatialization. A binaural recording is captured using two carefully placed microphones at each ear where the intent, when played on headphones, is to reproduce a naturally occurring spatial effect. Content tagged with a binaural channel layout will ignore this property value. When an AVPlayerItem's allowedAudioSpatializationFormats property is set to AVAudioSpatializationFormatMultichannel the AVPlayer will attempt to spatialize any decodable multichannel layout. Setting this property to AVAudioSpatializationFormatMonoStereoAndMultichannel indicates that the sender allows the AVPlayer to spatialize any decodable mono, stereo or multichannel layout. This property is not observable. The default value for this property with video content is AVAudioSpatializationFormatMonoStereoAndMultichannel. Otherwise, audio only content default value is AVAudioSpatializationFormatMultichannel.
720        #[unsafe(method(allowedAudioSpatializationFormats))]
721        #[unsafe(method_family = none)]
722        pub unsafe fn allowedAudioSpatializationFormats(&self) -> AVAudioSpatializationFormats;
723
724        #[cfg(feature = "AVAudioProcessingSettings")]
725        /// Setter for [`allowedAudioSpatializationFormats`][Self::allowedAudioSpatializationFormats].
726        #[unsafe(method(setAllowedAudioSpatializationFormats:))]
727        #[unsafe(method_family = none)]
728        pub unsafe fn setAllowedAudioSpatializationFormats(
729            &self,
730            allowed_audio_spatialization_formats: AVAudioSpatializationFormats,
731        );
732
733        #[cfg(feature = "AVAudioMix")]
734        /// Indicates the audio mix parameters to be applied during playback
735        ///
736        /// The inputParameters of the AVAudioMix must have trackIDs that correspond to a track of the receiver's asset. Otherwise they will be ignored. (See AVAudioMix.h for the declaration of AVAudioMixInputParameters and AVPlayerItem's asset property.)
737        #[unsafe(method(audioMix))]
738        #[unsafe(method_family = none)]
739        pub unsafe fn audioMix(&self) -> Option<Retained<AVAudioMix>>;
740
741        #[cfg(feature = "AVAudioMix")]
742        /// Setter for [`audioMix`][Self::audioMix].
743        #[unsafe(method(setAudioMix:))]
744        #[unsafe(method_family = none)]
745        pub unsafe fn setAudioMix(&self, audio_mix: Option<&AVAudioMix>);
746    );
747}
748
749/// AVPlayerItemPlayability.
750impl AVPlayerItem {
751    extern_methods!(
752        /// This property provides a collection of time ranges for which the player has the media data readily available. The ranges provided might be discontinuous.
753        ///
754        /// Returns an NSArray of NSValues containing CMTimeRanges.
755        #[unsafe(method(loadedTimeRanges))]
756        #[unsafe(method_family = none)]
757        pub unsafe fn loadedTimeRanges(&self) -> Retained<NSArray<NSValue>>;
758
759        /// Indicates whether the item will likely play through without stalling.
760        ///
761        /// This property communicates a prediction of playability. Factors considered in this prediction
762        /// include I/O throughput and media decode performance. It is possible for playbackLikelyToKeepUp to
763        /// indicate NO while the property playbackBufferFull indicates YES. In this event the playback buffer has
764        /// reached capacity but there isn't the statistical data to support a prediction that playback is likely to
765        /// keep up. It is left to the application programmer to decide to continue media playback or not.
766        /// See playbackBufferFull below.
767        #[unsafe(method(isPlaybackLikelyToKeepUp))]
768        #[unsafe(method_family = none)]
769        pub unsafe fn isPlaybackLikelyToKeepUp(&self) -> bool;
770
771        /// Indicates that the internal media buffer is full and that further I/O is suspended.
772        ///
773        /// This property reports that the data buffer used for playback has reach capacity.
774        /// Despite the playback buffer reaching capacity there might not exist sufficient statistical
775        /// data to support a playbackLikelyToKeepUp prediction of YES. See playbackLikelyToKeepUp above.
776        #[unsafe(method(isPlaybackBufferFull))]
777        #[unsafe(method_family = none)]
778        pub unsafe fn isPlaybackBufferFull(&self) -> bool;
779
780        #[unsafe(method(isPlaybackBufferEmpty))]
781        #[unsafe(method_family = none)]
782        pub unsafe fn isPlaybackBufferEmpty(&self) -> bool;
783
784        /// Indicates whether the player item can use network resources to keep playback state up to date while paused
785        ///
786        /// For live streaming content, the player item may need to use extra networking and power resources to keep playback state up to date when paused.  For example, when this property is set to YES, the seekableTimeRanges property will be periodically updated to reflect the current state of the live stream.
787        ///
788        /// For clients linked on or after macOS 10.11 or iOS 9.0, the default value is NO.  To minimize power usage, avoid setting this property to YES when you do not need playback state to stay up to date while paused.
789        #[unsafe(method(canUseNetworkResourcesForLiveStreamingWhilePaused))]
790        #[unsafe(method_family = none)]
791        pub unsafe fn canUseNetworkResourcesForLiveStreamingWhilePaused(&self) -> bool;
792
793        /// Setter for [`canUseNetworkResourcesForLiveStreamingWhilePaused`][Self::canUseNetworkResourcesForLiveStreamingWhilePaused].
794        #[unsafe(method(setCanUseNetworkResourcesForLiveStreamingWhilePaused:))]
795        #[unsafe(method_family = none)]
796        pub unsafe fn setCanUseNetworkResourcesForLiveStreamingWhilePaused(
797            &self,
798            can_use_network_resources_for_live_streaming_while_paused: bool,
799        );
800
801        /// Indicates the media duration the caller prefers the player to buffer from the network ahead of the playhead to guard against playback disruption.
802        ///
803        /// The value is in seconds. If it is set to 0, the player will choose an appropriate level of buffering for most use cases.
804        /// Note that setting this property to a low value will increase the chance that playback will stall and re-buffer, while setting it to a high value will increase demand on system resources.
805        /// Note that the system may buffer less than the value of this property in order to manage resource consumption.
806        #[unsafe(method(preferredForwardBufferDuration))]
807        #[unsafe(method_family = none)]
808        pub unsafe fn preferredForwardBufferDuration(&self) -> NSTimeInterval;
809
810        /// Setter for [`preferredForwardBufferDuration`][Self::preferredForwardBufferDuration].
811        #[unsafe(method(setPreferredForwardBufferDuration:))]
812        #[unsafe(method_family = none)]
813        pub unsafe fn setPreferredForwardBufferDuration(
814            &self,
815            preferred_forward_buffer_duration: NSTimeInterval,
816        );
817    );
818}
819
820/// These constants can be used in any combination as the value of variantPreferences.
821///
822///
823/// Indicates that only the basic behaviors of the player for choosing among variants should be applied, including considerations of available bandwidth, compatibility of the indicated codec or codecs, the dimensions of visual output, and the number of available audio output channels.
824///
825/// Directs the item to permit the use of variants with lossless audio encodings, if sufficient bandwidth is available for their use.
826///
827/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avvariantpreferences?language=objc)
828// NS_OPTIONS
829#[repr(transparent)]
830#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
831pub struct AVVariantPreferences(pub NSUInteger);
832bitflags::bitflags! {
833    impl AVVariantPreferences: NSUInteger {
834        #[doc(alias = "AVVariantPreferenceNone")]
835        const None = 0;
836        #[doc(alias = "AVVariantPreferenceScalabilityToLosslessAudio")]
837        const ScalabilityToLosslessAudio = 1<<0;
838    }
839}
840
841unsafe impl Encode for AVVariantPreferences {
842    const ENCODING: Encoding = NSUInteger::ENCODING;
843}
844
845unsafe impl RefEncode for AVVariantPreferences {
846    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
847}
848
849/// AVPlayerItemVariantControl.
850impl AVPlayerItem {
851    extern_methods!(
852        /// Indicates the desired limit of network bandwidth consumption for this item.
853        ///
854        ///
855        /// Set preferredPeakBitRate to non-zero to indicate that the player should attempt to limit item playback to that bit rate, expressed in bits per second.
856        ///
857        /// If network bandwidth consumption cannot be lowered to meet the preferredPeakBitRate, it will be reduced as much as possible while continuing to play the item.
858        #[unsafe(method(preferredPeakBitRate))]
859        #[unsafe(method_family = none)]
860        pub unsafe fn preferredPeakBitRate(&self) -> c_double;
861
862        /// Setter for [`preferredPeakBitRate`][Self::preferredPeakBitRate].
863        #[unsafe(method(setPreferredPeakBitRate:))]
864        #[unsafe(method_family = none)]
865        pub unsafe fn setPreferredPeakBitRate(&self, preferred_peak_bit_rate: c_double);
866
867        /// Indicates the desired limit of network bandwidth consumption for this item over expensive networks.
868        ///
869        ///
870        /// When preferredPeakBitRateForExpensiveNetworks is set to non-zero, the player will attempt to limit item playback to that bit rate
871        /// when streaming over an expensive network, such as when using a cellular data plan.  (See -[NWPath isExpensive])
872        ///
873        /// If network bandwidth consumption cannot be lowered to meet the preferredPeakBitRateForExpensiveNetworks, it will be reduced as much as possible while continuing to play the item.
874        ///
875        /// Note that preferredPeakBitRate still applies unconditionally.  If preferredPeakBitRateForExpensiveNetworks is less restrictive (greater) than preferredPeakBitRate,
876        /// preferredPeakBitRateForExpensiveNetworks has no practical effect.
877        #[unsafe(method(preferredPeakBitRateForExpensiveNetworks))]
878        #[unsafe(method_family = none)]
879        pub unsafe fn preferredPeakBitRateForExpensiveNetworks(&self) -> c_double;
880
881        /// Setter for [`preferredPeakBitRateForExpensiveNetworks`][Self::preferredPeakBitRateForExpensiveNetworks].
882        #[unsafe(method(setPreferredPeakBitRateForExpensiveNetworks:))]
883        #[unsafe(method_family = none)]
884        pub unsafe fn setPreferredPeakBitRateForExpensiveNetworks(
885            &self,
886            preferred_peak_bit_rate_for_expensive_networks: c_double,
887        );
888
889        #[cfg(feature = "objc2-core-foundation")]
890        /// Indicates a preferred upper limit on the resolution of the video to be downloaded (or otherwise transferred) and rendered by the player.
891        ///
892        /// The default value is CGSizeZero, which indicates that the client enforces no limit on video resolution. Other values indicate a preferred maximum video resolution.
893        /// It only applies to HTTP Live Streaming asset.
894        #[unsafe(method(preferredMaximumResolution))]
895        #[unsafe(method_family = none)]
896        pub unsafe fn preferredMaximumResolution(&self) -> CGSize;
897
898        #[cfg(feature = "objc2-core-foundation")]
899        /// Setter for [`preferredMaximumResolution`][Self::preferredMaximumResolution].
900        #[unsafe(method(setPreferredMaximumResolution:))]
901        #[unsafe(method_family = none)]
902        pub unsafe fn setPreferredMaximumResolution(&self, preferred_maximum_resolution: CGSize);
903
904        #[cfg(feature = "objc2-core-foundation")]
905        /// Indicates a preferred upper limit on the resolution of the video to be downloaded that applies only when the download occurs over expensive networks.
906        ///
907        /// The default value is CGSizeZero, which indicates that the client enforces no limit on video resolution. Other values indicate a preferred maximum video resolution.
908        /// This limit applies only when streaming over an expensive network, such as when using a cellular data plan.  (See -[NWPath isExpensive])
909        ///
910        /// It only applies to HTTP Live Streaming asset.
911        ///
912        /// Note that preferredMaximumResolution still applies unconditionally.  If preferredMaximumResolutionForExpensiveNetworks is less restrictive (higher resolution)
913        /// than preferredMaximumResolution, preferredMaximumResolutionForExpensiveNetworks has no practical effect.
914        #[unsafe(method(preferredMaximumResolutionForExpensiveNetworks))]
915        #[unsafe(method_family = none)]
916        pub unsafe fn preferredMaximumResolutionForExpensiveNetworks(&self) -> CGSize;
917
918        #[cfg(feature = "objc2-core-foundation")]
919        /// Setter for [`preferredMaximumResolutionForExpensiveNetworks`][Self::preferredMaximumResolutionForExpensiveNetworks].
920        #[unsafe(method(setPreferredMaximumResolutionForExpensiveNetworks:))]
921        #[unsafe(method_family = none)]
922        pub unsafe fn setPreferredMaximumResolutionForExpensiveNetworks(
923            &self,
924            preferred_maximum_resolution_for_expensive_networks: CGSize,
925        );
926
927        /// Directs the player to start playback with the first eligible variant  that appears in the stream's master playlist.
928        ///
929        /// This property influences AVPlayer's algorithm for selecting which of the eligible variant streams in an HTTP Live Streaming master playlist is selected when playback first begins.
930        /// In all cases, AVPlayer may switch to other variants during playback.
931        ///
932        /// On releases prior to macOS 10.15, iOS 13, tvOS 13 and watchOS 6, AVPlayer starts HLS playback with the first eligible variant in the master playlist.
933        /// On releases starting with macOS 10.15, iOS 13, tvOS 13 and watchOS 6, AVPlayer starts HLS playback by choosing an initial variant that optimizes the startup experience.
934        /// On releases starting with macOS 11.0, iOS 14, tvOS 14 and watchOS 7, applications may set this property to YES to request that AVPlayer use the previous behaviour of using the first eligible variant in the master playlist. This would be appropriate, for example, for applications which wish to control initial variant selection by ordering the variants in the master playlist.
935        ///
936        /// Note that changing this property may impact stream startup performance and quality. In order to be effective this property must be set before initial variant selection occurs.
937        /// This property only applies to HTTP Live Streaming assets. The default value of this property is NO.
938        #[unsafe(method(startsOnFirstEligibleVariant))]
939        #[unsafe(method_family = none)]
940        pub unsafe fn startsOnFirstEligibleVariant(&self) -> bool;
941
942        /// Setter for [`startsOnFirstEligibleVariant`][Self::startsOnFirstEligibleVariant].
943        #[unsafe(method(setStartsOnFirstEligibleVariant:))]
944        #[unsafe(method_family = none)]
945        pub unsafe fn setStartsOnFirstEligibleVariant(
946            &self,
947            starts_on_first_eligible_variant: bool,
948        );
949
950        /// Indicates preferences for variant switching.
951        ///
952        /// Changing variant preferences during playback may result in a variant switch.
953        /// The default value is AVVariantPreferenceNone.
954        #[unsafe(method(variantPreferences))]
955        #[unsafe(method_family = none)]
956        pub unsafe fn variantPreferences(&self) -> AVVariantPreferences;
957
958        /// Setter for [`variantPreferences`][Self::variantPreferences].
959        #[unsafe(method(setVariantPreferences:))]
960        #[unsafe(method_family = none)]
961        pub unsafe fn setVariantPreferences(&self, variant_preferences: AVVariantPreferences);
962    );
963}
964
965/// AVPlayerItemMediaSelection.
966impl AVPlayerItem {
967    extern_methods!(
968        #[cfg(feature = "AVMediaSelectionGroup")]
969        /// Selects the media option described by the specified instance of AVMediaSelectionOption in the specified AVMediaSelectionGroup and deselects all other options in that group.
970        ///
971        /// Parameter `mediaSelectionOption`: The option to select.
972        ///
973        /// Parameter `mediaSelectionGroup`: The media selection group, obtained from the receiver's asset, that contains the specified option.
974        ///
975        /// If the specified media selection option isn't a member of the specified media selection group, no change in presentation state will result.
976        /// If the value of the property allowsEmptySelection of the AVMediaSelectionGroup is YES, you can pass nil for mediaSelectionOption to deselect
977        /// all media selection options in the group.
978        /// Note that if multiple options within a group meet your criteria for selection according to locale or other considerations, and if these options are otherwise indistinguishable to you according to media characteristics that are meaningful for your application, content is typically authored so that the first available option that meets your criteria is appropriate for selection.
979        ///
980        /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this method must be invoked on the main thread/queue.
981        #[unsafe(method(selectMediaOption:inMediaSelectionGroup:))]
982        #[unsafe(method_family = none)]
983        pub unsafe fn selectMediaOption_inMediaSelectionGroup(
984            &self,
985            media_selection_option: Option<&AVMediaSelectionOption>,
986            media_selection_group: &AVMediaSelectionGroup,
987        );
988
989        #[cfg(feature = "AVMediaSelectionGroup")]
990        /// Selects the media option in the specified media selection group that best matches the AVPlayer's current automatic selection criteria. Also allows automatic selection to be re-applied to the specified group subsequently if the relevant criteria are changed.
991        ///
992        /// Parameter `mediaSelectionGroup`: The media selection group, obtained from the receiver's asset, that contains the specified option.
993        ///
994        /// Has no effect unless the appliesMediaSelectionCriteriaAutomatically property of the associated AVPlayer is YES and unless automatic media selection has previously been overridden via -[AVPlayerItem selectMediaOption:inMediaSelectionGroup:].
995        ///
996        /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this method must be invoked on the main thread/queue.
997        #[unsafe(method(selectMediaOptionAutomaticallyInMediaSelectionGroup:))]
998        #[unsafe(method_family = none)]
999        pub unsafe fn selectMediaOptionAutomaticallyInMediaSelectionGroup(
1000            &self,
1001            media_selection_group: &AVMediaSelectionGroup,
1002        );
1003
1004        #[cfg(feature = "AVMediaSelection")]
1005        /// Provides an instance of AVMediaSelection carrying current selections for each of the receiver's media selection groups.
1006        #[unsafe(method(currentMediaSelection))]
1007        #[unsafe(method_family = none)]
1008        pub unsafe fn currentMediaSelection(&self) -> Retained<AVMediaSelection>;
1009    );
1010}
1011
1012/// AVPlayerItemLogging.
1013impl AVPlayerItem {
1014    extern_methods!(
1015        /// Returns an object that represents a snapshot of the network access log. Can be nil.
1016        ///
1017        /// An AVPlayerItemAccessLog provides methods to retrieve the network access log in a format suitable for serialization.
1018        /// If nil is returned then there is no logging information currently available for this AVPlayerItem.
1019        /// 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.
1020        ///
1021        /// Returns: An autoreleased AVPlayerItemAccessLog instance.
1022        #[unsafe(method(accessLog))]
1023        #[unsafe(method_family = none)]
1024        pub unsafe fn accessLog(&self) -> Option<Retained<AVPlayerItemAccessLog>>;
1025
1026        /// Returns an object that represents a snapshot of the error log. Can be nil.
1027        ///
1028        /// An AVPlayerItemErrorLog provides methods to retrieve the error log in a format suitable for serialization.
1029        /// If nil is returned then there is no logging information currently available for this AVPlayerItem.
1030        ///
1031        /// Returns: An autoreleased AVPlayerItemErrorLog instance.
1032        #[unsafe(method(errorLog))]
1033        #[unsafe(method_family = none)]
1034        pub unsafe fn errorLog(&self) -> Option<Retained<AVPlayerItemErrorLog>>;
1035    );
1036}
1037
1038/// AVPlayerItemOutputs.
1039impl AVPlayerItem {
1040    extern_methods!(
1041        #[cfg(feature = "AVPlayerItemOutput")]
1042        /// Adds the specified instance of AVPlayerItemOutput to the receiver's collection of outputs.
1043        ///
1044        /// The class of AVPlayerItemOutput provided dictates the data structure that decoded samples are vended in.
1045        ///
1046        /// When an AVPlayerItemOutput is associated with an AVPlayerItem, samples are provided for a media type in accordance with the rules for mixing, composition, or exclusion that the AVPlayer honors among multiple enabled tracks of that media type for its own rendering purposes. For example, video media will be composed according to the instructions provided via AVPlayerItem.videoComposition, if present. Audio media will be mixed according to the parameters provided via AVPlayerItem.audioMix, if present.
1047        ///
1048        /// Parameter `output`: An instance of AVPlayerItemOutput
1049        #[unsafe(method(addOutput:))]
1050        #[unsafe(method_family = none)]
1051        pub unsafe fn addOutput(&self, output: &AVPlayerItemOutput);
1052
1053        #[cfg(feature = "AVPlayerItemOutput")]
1054        /// Removes the specified instance of AVPlayerItemOutput from the receiver's collection of outputs.
1055        ///
1056        /// Parameter `output`: An instance of AVPlayerItemOutput
1057        #[unsafe(method(removeOutput:))]
1058        #[unsafe(method_family = none)]
1059        pub unsafe fn removeOutput(&self, output: &AVPlayerItemOutput);
1060
1061        #[cfg(feature = "AVPlayerItemOutput")]
1062        /// The collection of associated outputs.
1063        #[unsafe(method(outputs))]
1064        #[unsafe(method_family = none)]
1065        pub unsafe fn outputs(&self) -> Retained<NSArray<AVPlayerItemOutput>>;
1066    );
1067}
1068
1069/// AVPlayerItemMediaDataCollectors.
1070impl AVPlayerItem {
1071    extern_methods!(
1072        #[cfg(feature = "AVPlayerItemMediaDataCollector")]
1073        /// Adds the specified instance of AVPlayerItemMediaDataCollector to the receiver's collection of mediaDataCollectors.
1074        ///
1075        /// This method may incur additional I/O to collect the requested media data asynchronously.
1076        ///
1077        /// Parameter `collector`: An instance of AVPlayerItemMediaDataCollector
1078        #[unsafe(method(addMediaDataCollector:))]
1079        #[unsafe(method_family = none)]
1080        pub unsafe fn addMediaDataCollector(&self, collector: &AVPlayerItemMediaDataCollector);
1081
1082        #[cfg(feature = "AVPlayerItemMediaDataCollector")]
1083        /// Removes the specified instance of AVPlayerItemMediaDataCollector from the receiver's collection of mediaDataCollectors.
1084        ///
1085        /// Parameter `collector`: An instance of AVPlayerItemMediaDataCollector
1086        #[unsafe(method(removeMediaDataCollector:))]
1087        #[unsafe(method_family = none)]
1088        pub unsafe fn removeMediaDataCollector(&self, collector: &AVPlayerItemMediaDataCollector);
1089
1090        #[cfg(feature = "AVPlayerItemMediaDataCollector")]
1091        /// The collection of associated mediaDataCollectors.
1092        #[unsafe(method(mediaDataCollectors))]
1093        #[unsafe(method_family = none)]
1094        pub unsafe fn mediaDataCollectors(
1095            &self,
1096        ) -> Retained<NSArray<AVPlayerItemMediaDataCollector>>;
1097    );
1098}
1099
1100/// AVPlayerItemDeprecated.
1101impl AVPlayerItem {
1102    extern_methods!(
1103        #[cfg(feature = "objc2-core-media")]
1104        /// Moves the playback cursor.
1105        ///
1106        /// Parameter `time`:
1107        /// Use this method to seek to a specified time for the item.
1108        /// The time seeked to may differ from the specified time for efficiency. For sample accurate seeking see seekToTime:toleranceBefore:toleranceAfter:.
1109        /// If the seek time is outside of seekable time ranges as indicated by seekableTimeRanges property, the seek request will be cancelled.
1110        #[deprecated = "Use -seekToTime:completionHandler:, passing nil for the completionHandler if you don't require notification of completion"]
1111        #[unsafe(method(seekToTime:))]
1112        #[unsafe(method_family = none)]
1113        pub unsafe fn seekToTime(&self, time: CMTime);
1114
1115        #[cfg(feature = "objc2-core-media")]
1116        /// Moves the playback cursor within a specified time bound.
1117        ///
1118        /// Parameter `time`:
1119        /// Parameter `toleranceBefore`:
1120        /// Parameter `toleranceAfter`:
1121        /// Use this method to seek to a specified time for the item.
1122        /// The time seeked to will be within the range [time-toleranceBefore, time+toleranceAfter] and may differ from the specified time for efficiency.
1123        /// Pass kCMTimeZero for both toleranceBefore and toleranceAfter to request sample accurate seeking which may incur additional decoding delay.
1124        /// Messaging this method with beforeTolerance:kCMTimePositiveInfinity and afterTolerance:kCMTimePositiveInfinity is the same as messaging seekToTime: directly.
1125        /// Seeking is constrained by the collection of seekable time ranges. If you seek to a time outside all of the seekable ranges the seek will result in a currentTime
1126        /// within the seekable ranges.
1127        /// If the seek time is outside of seekable time ranges as indicated by seekableTimeRanges property, the seek request will be cancelled.
1128        #[deprecated = "Use -seekToTime:toleranceBefore:toleranceAfter:completionHandler:, passing nil for the completionHandler if you don't require notification of completion"]
1129        #[unsafe(method(seekToTime:toleranceBefore:toleranceAfter:))]
1130        #[unsafe(method_family = none)]
1131        pub unsafe fn seekToTime_toleranceBefore_toleranceAfter(
1132            &self,
1133            time: CMTime,
1134            tolerance_before: CMTime,
1135            tolerance_after: CMTime,
1136        );
1137
1138        /// move playhead to a point corresponding to a particular date.
1139        ///
1140        /// For playback content that is associated with a range of dates, move the
1141        /// playhead to point within that range. Will fail if the supplied date is outside
1142        /// the range or if the content is not associated with a range of dates.
1143        ///
1144        /// Parameter `date`: The new position for the playhead.
1145        ///
1146        /// Returns: Returns true if the playhead was moved to the supplied date.
1147        #[deprecated = "Use -seekToDate:completionHandler:, passing nil for the completionHandler if you don't require notification of completion"]
1148        #[unsafe(method(seekToDate:))]
1149        #[unsafe(method_family = none)]
1150        pub unsafe fn seekToDate(&self, date: &NSDate) -> bool;
1151
1152        #[cfg(feature = "AVMediaSelectionGroup")]
1153        /// Indicates the media selection option that's currently selected from the specified group. May be nil.
1154        ///
1155        /// Parameter `mediaSelectionGroup`: A media selection group obtained from the receiver's asset.
1156        ///
1157        /// Returns: An instance of AVMediaSelectionOption that describes the currently selection option in the group.
1158        ///
1159        /// If the value of the property allowsEmptySelection of the AVMediaSelectionGroup is YES, the currently selected option in the group may be nil.
1160        #[deprecated = "Use currentMediaSelection to obtain an instance of AVMediaSelection, which encompasses the currently selected AVMediaSelectionOption in each of the available AVMediaSelectionGroups"]
1161        #[unsafe(method(selectedMediaOptionInMediaSelectionGroup:))]
1162        #[unsafe(method_family = none)]
1163        pub unsafe fn selectedMediaOptionInMediaSelectionGroup(
1164            &self,
1165            media_selection_group: &AVMediaSelectionGroup,
1166        ) -> Option<Retained<AVMediaSelectionOption>>;
1167    );
1168}
1169
1170extern_class!(
1171    /// An AVPlayerItemAccessLog provides methods to retrieve the access log in a format suitable for serialization.
1172    ///
1173    /// An AVPlayerItemAccessLog acculumulates key metrics about network playback and presents them as a collection
1174    /// of AVPlayerItemAccessLogEvent instances. Each AVPlayerItemAccessLogEvent instance collates the data
1175    /// that relates to each uninterrupted period of playback.
1176    ///
1177    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1178    ///
1179    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemaccesslog?language=objc)
1180    #[unsafe(super(NSObject))]
1181    #[derive(Debug, PartialEq, Eq, Hash)]
1182    pub struct AVPlayerItemAccessLog;
1183);
1184
1185unsafe impl Send for AVPlayerItemAccessLog {}
1186
1187unsafe impl Sync for AVPlayerItemAccessLog {}
1188
1189unsafe impl NSCopying for AVPlayerItemAccessLog {}
1190
1191unsafe impl CopyingHelper for AVPlayerItemAccessLog {
1192    type Result = Self;
1193}
1194
1195unsafe impl NSObjectProtocol for AVPlayerItemAccessLog {}
1196
1197impl AVPlayerItemAccessLog {
1198    extern_methods!(
1199        #[unsafe(method(init))]
1200        #[unsafe(method_family = init)]
1201        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1202
1203        #[unsafe(method(new))]
1204        #[unsafe(method_family = new)]
1205        pub unsafe fn new() -> Retained<Self>;
1206
1207        /// Serializes an AVPlayerItemAccessLog in the Extended Log File Format.
1208        ///
1209        /// This method converts the webserver access log into a textual format that conforms to the
1210        /// W3C Extended Log File Format for web server log files.
1211        /// For more information see: http://www.w3.org/pub/WWW/TR/WD-logfile.html
1212        ///
1213        /// Returns: An autoreleased NSData instance.
1214        #[unsafe(method(extendedLogData))]
1215        #[unsafe(method_family = none)]
1216        pub unsafe fn extendedLogData(&self) -> Option<Retained<NSData>>;
1217
1218        /// Returns the NSStringEncoding for extendedLogData, see above.
1219        ///
1220        /// A string suitable for console output is obtainable by:
1221        /// [[NSString alloc] initWithData:[myLog extendedLogData] encoding:[myLog extendedLogDataStringEncoding]]
1222        #[unsafe(method(extendedLogDataStringEncoding))]
1223        #[unsafe(method_family = none)]
1224        pub unsafe fn extendedLogDataStringEncoding(&self) -> NSStringEncoding;
1225
1226        /// An ordered collection of AVPlayerItemAccessLogEvent instances.
1227        ///
1228        /// An ordered collection of AVPlayerItemAccessLogEvent instances that represent the chronological
1229        /// sequence of events contained in the access log.
1230        /// This property is not observable.
1231        #[unsafe(method(events))]
1232        #[unsafe(method_family = none)]
1233        pub unsafe fn events(&self) -> Retained<NSArray<AVPlayerItemAccessLogEvent>>;
1234    );
1235}
1236
1237extern_class!(
1238    /// An AVPlayerItemErrorLog provides methods to retrieve the error log in a format suitable for serialization.
1239    ///
1240    /// An AVPlayerItemErrorLog provides data to identify if, and when, network resource playback failures occured.
1241    ///
1242    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1243    ///
1244    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemerrorlog?language=objc)
1245    #[unsafe(super(NSObject))]
1246    #[derive(Debug, PartialEq, Eq, Hash)]
1247    pub struct AVPlayerItemErrorLog;
1248);
1249
1250unsafe impl Send for AVPlayerItemErrorLog {}
1251
1252unsafe impl Sync for AVPlayerItemErrorLog {}
1253
1254unsafe impl NSCopying for AVPlayerItemErrorLog {}
1255
1256unsafe impl CopyingHelper for AVPlayerItemErrorLog {
1257    type Result = Self;
1258}
1259
1260unsafe impl NSObjectProtocol for AVPlayerItemErrorLog {}
1261
1262impl AVPlayerItemErrorLog {
1263    extern_methods!(
1264        #[unsafe(method(init))]
1265        #[unsafe(method_family = init)]
1266        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1267
1268        #[unsafe(method(new))]
1269        #[unsafe(method_family = new)]
1270        pub unsafe fn new() -> Retained<Self>;
1271
1272        /// Serializes an AVPlayerItemErrorLog in the Extended Log File Format.
1273        ///
1274        /// This method converts the webserver error log into a textual format that conforms to the
1275        /// W3C Extended Log File Format for web server log files.
1276        /// For more information see: http://www.w3.org/pub/WWW/TR/WD-logfile.html
1277        ///
1278        /// Returns: An autoreleased NSData instance.
1279        #[unsafe(method(extendedLogData))]
1280        #[unsafe(method_family = none)]
1281        pub unsafe fn extendedLogData(&self) -> Option<Retained<NSData>>;
1282
1283        /// Returns the NSStringEncoding for extendedLogData, see above.
1284        ///
1285        /// A string suitable for console output is obtainable by:
1286        /// [[NSString alloc] initWithData:[myLog extendedLogData] encoding:[myLog extendedLogDataStringEncoding]]
1287        #[unsafe(method(extendedLogDataStringEncoding))]
1288        #[unsafe(method_family = none)]
1289        pub unsafe fn extendedLogDataStringEncoding(&self) -> NSStringEncoding;
1290
1291        /// An ordered collection of AVPlayerItemErrorLogEvent instances.
1292        ///
1293        /// An ordered collection of AVPlayerItemErrorLogEvent instances that represent the chronological
1294        /// sequence of events contained in the error log.
1295        /// This property is not observable.
1296        #[unsafe(method(events))]
1297        #[unsafe(method_family = none)]
1298        pub unsafe fn events(&self) -> Retained<NSArray<AVPlayerItemErrorLogEvent>>;
1299    );
1300}
1301
1302extern_class!(
1303    /// An AVPlayerItemAccessLogEvent represents a single log entry.
1304    ///
1305    /// An AVPlayerItemAccessLogEvent provides named properties for accessing the data
1306    /// fields of each log event. None of the properties of this class are observable.
1307    ///
1308    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1309    ///
1310    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemaccesslogevent?language=objc)
1311    #[unsafe(super(NSObject))]
1312    #[derive(Debug, PartialEq, Eq, Hash)]
1313    pub struct AVPlayerItemAccessLogEvent;
1314);
1315
1316unsafe impl Send for AVPlayerItemAccessLogEvent {}
1317
1318unsafe impl Sync for AVPlayerItemAccessLogEvent {}
1319
1320unsafe impl NSCopying for AVPlayerItemAccessLogEvent {}
1321
1322unsafe impl CopyingHelper for AVPlayerItemAccessLogEvent {
1323    type Result = Self;
1324}
1325
1326unsafe impl NSObjectProtocol for AVPlayerItemAccessLogEvent {}
1327
1328impl AVPlayerItemAccessLogEvent {
1329    extern_methods!(
1330        #[unsafe(method(init))]
1331        #[unsafe(method_family = init)]
1332        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1333
1334        #[unsafe(method(new))]
1335        #[unsafe(method_family = new)]
1336        pub unsafe fn new() -> Retained<Self>;
1337
1338        /// A count of media segments downloaded.
1339        ///
1340        /// Value is negative if unknown. A count of media segments downloaded from the server to this client. Corresponds to "sc-count".
1341        /// This property is not observable.
1342        /// This property is deprecated. Use numberOfMediaRequests instead.
1343        #[deprecated]
1344        #[unsafe(method(numberOfSegmentsDownloaded))]
1345        #[unsafe(method_family = none)]
1346        pub unsafe fn numberOfSegmentsDownloaded(&self) -> NSInteger;
1347
1348        /// A count of media read requests.
1349        ///
1350        /// Value is negative if unknown. A count of media read requests from the server to this client. Corresponds to "sc-count".
1351        /// For HTTP live Streaming, a count of media segments downloaded from the server to this client.
1352        /// For progressive-style HTTP media downloads, a count of HTTP GET (byte-range) requests for the resource.
1353        /// This property is not observable.
1354        #[unsafe(method(numberOfMediaRequests))]
1355        #[unsafe(method_family = none)]
1356        pub unsafe fn numberOfMediaRequests(&self) -> NSInteger;
1357
1358        /// The date/time at which playback began for this event. Can be nil.
1359        ///
1360        /// If nil is returned the date is unknown. Corresponds to "date".
1361        /// This property is not observable.
1362        #[unsafe(method(playbackStartDate))]
1363        #[unsafe(method_family = none)]
1364        pub unsafe fn playbackStartDate(&self) -> Option<Retained<NSDate>>;
1365
1366        /// The URI of the playback item. Can be nil.
1367        ///
1368        /// If nil is returned the URI is unknown. Corresponds to "uri".
1369        /// This property is not observable.
1370        #[unsafe(method(URI))]
1371        #[unsafe(method_family = none)]
1372        pub unsafe fn URI(&self) -> Option<Retained<NSString>>;
1373
1374        /// The IP address of the server that was the source of the last delivered media segment. Can be nil.
1375        ///
1376        /// If nil is returned the address is unknown. Can be either an IPv4 or IPv6 address. Corresponds to "s-ip".
1377        /// This property is not observable.
1378        #[unsafe(method(serverAddress))]
1379        #[unsafe(method_family = none)]
1380        pub unsafe fn serverAddress(&self) -> Option<Retained<NSString>>;
1381
1382        /// A count of changes to the property serverAddress, see above, over the last uninterrupted period of playback.
1383        ///
1384        /// Value is negative if unknown. Corresponds to "s-ip-changes".
1385        /// This property is not observable.
1386        #[unsafe(method(numberOfServerAddressChanges))]
1387        #[unsafe(method_family = none)]
1388        pub unsafe fn numberOfServerAddressChanges(&self) -> NSInteger;
1389
1390        /// A GUID that identifies the playback session. This value is used in HTTP requests. Can be nil.
1391        ///
1392        /// If nil is returned the GUID is unknown. Corresponds to "cs-guid".
1393        /// This property is not observable.
1394        #[unsafe(method(playbackSessionID))]
1395        #[unsafe(method_family = none)]
1396        pub unsafe fn playbackSessionID(&self) -> Option<Retained<NSString>>;
1397
1398        /// An offset into the playlist where the last uninterrupted period of playback began. Measured in seconds.
1399        ///
1400        /// Value is negative if unknown. Corresponds to "c-start-time".
1401        /// This property is not observable.
1402        #[unsafe(method(playbackStartOffset))]
1403        #[unsafe(method_family = none)]
1404        pub unsafe fn playbackStartOffset(&self) -> NSTimeInterval;
1405
1406        /// The accumulated duration of the media downloaded. Measured in seconds.
1407        ///
1408        /// Value is negative if unknown. Corresponds to "c-duration-downloaded".
1409        /// This property is not observable.
1410        #[unsafe(method(segmentsDownloadedDuration))]
1411        #[unsafe(method_family = none)]
1412        pub unsafe fn segmentsDownloadedDuration(&self) -> NSTimeInterval;
1413
1414        /// The accumulated duration of the media played. Measured in seconds.
1415        ///
1416        /// Value is negative if unknown. Corresponds to "c-duration-watched".
1417        /// This property is not observable.
1418        #[unsafe(method(durationWatched))]
1419        #[unsafe(method_family = none)]
1420        pub unsafe fn durationWatched(&self) -> NSTimeInterval;
1421
1422        /// The total number of playback stalls encountered.
1423        ///
1424        /// Value is negative if unknown. Corresponds to "c-stalls".
1425        /// This property is not observable.
1426        #[unsafe(method(numberOfStalls))]
1427        #[unsafe(method_family = none)]
1428        pub unsafe fn numberOfStalls(&self) -> NSInteger;
1429
1430        /// The accumulated number of bytes transferred.
1431        ///
1432        /// Value is negative if unknown. Corresponds to "bytes".
1433        /// This property is not observable.
1434        #[unsafe(method(numberOfBytesTransferred))]
1435        #[unsafe(method_family = none)]
1436        pub unsafe fn numberOfBytesTransferred(&self) -> c_longlong;
1437
1438        /// The accumulated duration of active network transfer of bytes. Measured in seconds.
1439        ///
1440        /// Value is negative if unknown. Corresponds to "c-transfer-duration".
1441        /// This property is not observable.
1442        #[unsafe(method(transferDuration))]
1443        #[unsafe(method_family = none)]
1444        pub unsafe fn transferDuration(&self) -> NSTimeInterval;
1445
1446        /// The empirical throughput across all media downloaded. Measured in bits per second.
1447        ///
1448        /// Value is negative if unknown. Corresponds to "c-observed-bitrate".
1449        /// This property is not observable.
1450        #[unsafe(method(observedBitrate))]
1451        #[unsafe(method_family = none)]
1452        pub unsafe fn observedBitrate(&self) -> c_double;
1453
1454        /// The throughput required to play the stream, as advertised by the server. Measured in bits per second.
1455        ///
1456        /// Value is negative if unknown. Corresponds to "sc-indicated-bitrate".
1457        /// This property is not observable.
1458        #[unsafe(method(indicatedBitrate))]
1459        #[unsafe(method_family = none)]
1460        pub unsafe fn indicatedBitrate(&self) -> c_double;
1461
1462        /// Average throughput required to play the stream, as advertised by the server. Measured in bits per second.
1463        ///
1464        /// Value is negative if unknown. Corresponds to "sc-indicated-avg-bitrate".
1465        /// This property is not observable.
1466        #[unsafe(method(indicatedAverageBitrate))]
1467        #[unsafe(method_family = none)]
1468        pub unsafe fn indicatedAverageBitrate(&self) -> c_double;
1469
1470        /// The average bitrate of video track if it is unmuxed. Average bitrate of combined content if muxed. Measured in bits per second.
1471        ///
1472        /// Value is negative if unknown. Corresponds to "c-avg-video-bitrate".
1473        /// This property is not observable.
1474        #[unsafe(method(averageVideoBitrate))]
1475        #[unsafe(method_family = none)]
1476        pub unsafe fn averageVideoBitrate(&self) -> c_double;
1477
1478        /// The average bitrate of audio track. This is not available if audio is muxed with video. Measured in bits per second.
1479        ///
1480        /// Value is negative if unknown. Corresponds to "c-avg-audio-bitrate".
1481        /// This property is not observable.
1482        #[unsafe(method(averageAudioBitrate))]
1483        #[unsafe(method_family = none)]
1484        pub unsafe fn averageAudioBitrate(&self) -> c_double;
1485
1486        /// The total number of dropped video frames.
1487        ///
1488        /// Value is negative if unknown. Corresponds to "c-frames-dropped".
1489        /// This property is not observable.
1490        #[unsafe(method(numberOfDroppedVideoFrames))]
1491        #[unsafe(method_family = none)]
1492        pub unsafe fn numberOfDroppedVideoFrames(&self) -> NSInteger;
1493
1494        /// The accumulated duration until player item is ready to play. Measured in seconds.
1495        ///
1496        /// Value is negative if unknown. Corresponds to "c-startup-time".
1497        /// This property is not observable.
1498        #[unsafe(method(startupTime))]
1499        #[unsafe(method_family = none)]
1500        pub unsafe fn startupTime(&self) -> NSTimeInterval;
1501
1502        /// The total number of times the download of the segments took too long.
1503        ///
1504        /// Value is negative if unknown. Corresponds to "c-overdue".
1505        /// This property is not observable.
1506        #[unsafe(method(downloadOverdue))]
1507        #[unsafe(method_family = none)]
1508        pub unsafe fn downloadOverdue(&self) -> NSInteger;
1509
1510        /// Maximum observed segment download bit rate.
1511        ///
1512        /// Value is negative if unknown. Corresponds to "c-observed-max-bitrate".
1513        /// This property is not observable.
1514        #[deprecated = "Use observedBitrateStandardDeviation to monitor variance in network bitrate."]
1515        #[unsafe(method(observedMaxBitrate))]
1516        #[unsafe(method_family = none)]
1517        pub unsafe fn observedMaxBitrate(&self) -> c_double;
1518
1519        /// Minimum observed segment download bit rate.
1520        ///
1521        /// Value is negative if unknown. Corresponds to "c-observed-min-bitrate".
1522        /// This property is not observable.
1523        #[deprecated = "Use observedBitrateStandardDeviation to monitor variance in network bitrate."]
1524        #[unsafe(method(observedMinBitrate))]
1525        #[unsafe(method_family = none)]
1526        pub unsafe fn observedMinBitrate(&self) -> c_double;
1527
1528        /// Standard deviation of observed segment download bit rates.
1529        ///
1530        /// Value is negative if unknown. Corresponds to "c-observed-bitrate-sd".
1531        /// This property is not observable.
1532        #[unsafe(method(observedBitrateStandardDeviation))]
1533        #[unsafe(method_family = none)]
1534        pub unsafe fn observedBitrateStandardDeviation(&self) -> c_double;
1535
1536        /// Playback type (LIVE, VOD, FILE).
1537        ///
1538        /// If nil is returned the playback type is unknown. Corresponds to "s-playback-type".
1539        /// This property is not observable.
1540        #[unsafe(method(playbackType))]
1541        #[unsafe(method_family = none)]
1542        pub unsafe fn playbackType(&self) -> Option<Retained<NSString>>;
1543
1544        /// Number of network read requests over WWAN.
1545        ///
1546        /// Value is negative if unknown. Corresponds to "sc-wwan-count".
1547        /// This property is not observable.
1548        #[unsafe(method(mediaRequestsWWAN))]
1549        #[unsafe(method_family = none)]
1550        pub unsafe fn mediaRequestsWWAN(&self) -> NSInteger;
1551
1552        /// Bandwidth that caused us to switch (up or down).
1553        ///
1554        /// Value is negative if unknown. Corresponds to "c-switch-bitrate".
1555        /// This property is not observable.
1556        #[unsafe(method(switchBitrate))]
1557        #[unsafe(method_family = none)]
1558        pub unsafe fn switchBitrate(&self) -> c_double;
1559    );
1560}
1561
1562extern_class!(
1563    /// An AVPlayerItemErrorLogEvent represents a single log entry.
1564    ///
1565    /// An AVPlayerItemErrorLogEvent provides named properties for accessing the data
1566    /// fields of each log event. None of the properties of this class are observable.
1567    ///
1568    /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1569    ///
1570    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemerrorlogevent?language=objc)
1571    #[unsafe(super(NSObject))]
1572    #[derive(Debug, PartialEq, Eq, Hash)]
1573    pub struct AVPlayerItemErrorLogEvent;
1574);
1575
1576unsafe impl Send for AVPlayerItemErrorLogEvent {}
1577
1578unsafe impl Sync for AVPlayerItemErrorLogEvent {}
1579
1580unsafe impl NSCopying for AVPlayerItemErrorLogEvent {}
1581
1582unsafe impl CopyingHelper for AVPlayerItemErrorLogEvent {
1583    type Result = Self;
1584}
1585
1586unsafe impl NSObjectProtocol for AVPlayerItemErrorLogEvent {}
1587
1588impl AVPlayerItemErrorLogEvent {
1589    extern_methods!(
1590        #[unsafe(method(init))]
1591        #[unsafe(method_family = init)]
1592        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1593
1594        #[unsafe(method(new))]
1595        #[unsafe(method_family = new)]
1596        pub unsafe fn new() -> Retained<Self>;
1597
1598        /// The date and time when the error occured. Can be nil.
1599        ///
1600        /// If nil is returned the date is unknown. Corresponds to "date".
1601        /// This property is not observable.
1602        #[unsafe(method(date))]
1603        #[unsafe(method_family = none)]
1604        pub unsafe fn date(&self) -> Option<Retained<NSDate>>;
1605
1606        /// The URI of the playback item. Can be nil.
1607        ///
1608        /// If nil is returned the URI is unknown. Corresponds to "uri".
1609        /// This property is not observable.
1610        #[unsafe(method(URI))]
1611        #[unsafe(method_family = none)]
1612        pub unsafe fn URI(&self) -> Option<Retained<NSString>>;
1613
1614        /// The IP address of the server that was the source of the error. Can be nil.
1615        ///
1616        /// If nil is returned the address is unknown. Can be either an IPv4 or IPv6 address. Corresponds to "s-ip".
1617        /// This property is not observable.
1618        #[unsafe(method(serverAddress))]
1619        #[unsafe(method_family = none)]
1620        pub unsafe fn serverAddress(&self) -> Option<Retained<NSString>>;
1621
1622        /// A GUID that identifies the playback session. This value is used in HTTP requests. Can be nil.
1623        ///
1624        /// If nil is returned the GUID is unknown. Corresponds to "cs-guid".
1625        /// This property is not observable.
1626        #[unsafe(method(playbackSessionID))]
1627        #[unsafe(method_family = none)]
1628        pub unsafe fn playbackSessionID(&self) -> Option<Retained<NSString>>;
1629
1630        /// A unique error code identifier.
1631        ///
1632        /// Corresponds to "status".
1633        /// This property is not observable.
1634        #[unsafe(method(errorStatusCode))]
1635        #[unsafe(method_family = none)]
1636        pub unsafe fn errorStatusCode(&self) -> NSInteger;
1637
1638        /// The domain of the error.
1639        ///
1640        /// Corresponds to "domain".
1641        /// This property is not observable.
1642        #[unsafe(method(errorDomain))]
1643        #[unsafe(method_family = none)]
1644        pub unsafe fn errorDomain(&self) -> Retained<NSString>;
1645
1646        /// A description of the error encountered. Can be nil.
1647        ///
1648        /// If nil is returned further information is not available. Corresponds to "comment".
1649        /// This property is not observable.
1650        #[unsafe(method(errorComment))]
1651        #[unsafe(method_family = none)]
1652        pub unsafe fn errorComment(&self) -> Option<Retained<NSString>>;
1653
1654        #[unsafe(method(allHTTPResponseHeaderFields))]
1655        #[unsafe(method_family = none)]
1656        pub unsafe fn allHTTPResponseHeaderFields(
1657            &self,
1658        ) -> Option<Retained<NSDictionary<NSString, NSString>>>;
1659    );
1660}
1661
1662/// AVMetricEventStreamPublisher.
1663impl AVPlayerItem {
1664    extern_methods!();
1665}
1666
1667#[cfg(feature = "AVMetrics")]
1668unsafe impl AVMetricEventStreamPublisher for AVPlayerItem {}