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/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemstatus?language=objc)
72// NS_ENUM
73#[repr(transparent)]
74#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
75pub struct AVPlayerItemStatus(pub NSInteger);
76impl AVPlayerItemStatus {
77 /// Indicates that the status of the player item is not yet known because it has not tried to load new media resources for playback.
78 #[doc(alias = "AVPlayerItemStatusUnknown")]
79 pub const Unknown: Self = Self(0);
80 /// Indicates that the player item is ready to be played.
81 #[doc(alias = "AVPlayerItemStatusReadyToPlay")]
82 pub const ReadyToPlay: Self = Self(1);
83 /// Indicates that the player item can no longer be played because of an error. The error is described by the value of the player item's error property. The player item's errorLog property might contain additional information about the error.
84 #[doc(alias = "AVPlayerItemStatusFailed")]
85 pub const Failed: Self = Self(2);
86}
87
88unsafe impl Encode for AVPlayerItemStatus {
89 const ENCODING: Encoding = NSInteger::ENCODING;
90}
91
92unsafe impl RefEncode for AVPlayerItemStatus {
93 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
94}
95
96extern_class!(
97 /// An AVPlayerItem carries a reference to an AVAsset as well as presentation settings for that asset.
98 ///
99 /// Note that inspection of media assets is provided by AVAsset.
100 /// This class is intended to represent presentation state for an asset that's played by an AVPlayer and to permit observation of that state.
101 ///
102 /// It is important to avoid key-value observation with a key path containing the asset's property. Observe the AVPlayerItem's property instead. For example, use the "duration" key path instead of the "asset.duration" key path.
103 ///
104 /// To allow clients to add and remove their objects as key-value observers safely, AVPlayerItem serializes notifications of
105 /// changes that occur dynamically during playback on the same dispatch queue on which notifications of playback state changes
106 /// are serialized by its associated AVPlayer. By default, this queue is the main queue. See dispatch_get_main_queue().
107 ///
108 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritem?language=objc)
109 #[unsafe(super(NSObject))]
110 #[thread_kind = MainThreadOnly]
111 #[derive(Debug, PartialEq, Eq, Hash)]
112 pub struct AVPlayerItem;
113);
114
115extern_conformance!(
116 unsafe impl NSCopying for AVPlayerItem {}
117);
118
119unsafe impl CopyingHelper for AVPlayerItem {
120 type Result = Self;
121}
122
123extern_conformance!(
124 unsafe impl NSObjectProtocol for AVPlayerItem {}
125);
126
127impl AVPlayerItem {
128 extern_methods!(
129 #[unsafe(method(init))]
130 #[unsafe(method_family = init)]
131 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
132
133 #[unsafe(method(new))]
134 #[unsafe(method_family = new)]
135 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
136
137 /// Returns an instance of AVPlayerItem for playing a resource at the specified location.
138 ///
139 /// Equivalent to +playerItemWithAsset:, passing [AVAsset assetWithURL:URL] as the value of asset.
140 ///
141 /// - Parameter URL:
142 ///
143 /// - Returns: An instance of AVPlayerItem.
144 #[unsafe(method(playerItemWithURL:))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn playerItemWithURL(url: &NSURL, mtm: MainThreadMarker) -> Retained<Self>;
147
148 #[cfg(feature = "AVAsset")]
149 /// Returns an instance of AVPlayerItem for playing an AVAsset.
150 ///
151 /// Equivalent to +playerItemWithAsset:automaticallyLoadedAssetKeys:, passing
152 /// @
153 /// [
154 /// "
155 /// duration" ] as the value of automaticallyLoadedAssetKeys.
156 ///
157 /// 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.
158 ///
159 /// - Parameter asset:
160 ///
161 /// - Returns: An instance of AVPlayerItem.
162 #[unsafe(method(playerItemWithAsset:))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn playerItemWithAsset(asset: &AVAsset, mtm: MainThreadMarker)
165 -> Retained<Self>;
166
167 #[cfg(feature = "AVAsset")]
168 /// Returns an instance of AVPlayerItem for playing an AVAsset.
169 ///
170 /// 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.
171 ///
172 /// 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.
173 ///
174 /// - Parameter asset:
175 /// - Parameter automaticallyLoadedAssetKeys: An NSArray of NSStrings, each representing a property key defined by AVAsset. See AVAsset.h for property keys, e.g. duration.
176 ///
177 /// - Returns: An instance of AVPlayerItem.
178 #[unsafe(method(playerItemWithAsset:automaticallyLoadedAssetKeys:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn playerItemWithAsset_automaticallyLoadedAssetKeys(
181 asset: &AVAsset,
182 automatically_loaded_asset_keys: Option<&NSArray<NSString>>,
183 mtm: MainThreadMarker,
184 ) -> Retained<Self>;
185
186 /// Initializes an AVPlayerItem with an NSURL.
187 ///
188 /// Equivalent to -initWithAsset:, passing [AVAsset assetWithURL:URL] as the value of asset.
189 ///
190 /// - Parameter URL:
191 ///
192 /// - Returns: An instance of AVPlayerItem
193 #[unsafe(method(initWithURL:))]
194 #[unsafe(method_family = init)]
195 pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
196
197 #[cfg(feature = "AVAsset")]
198 /// Initializes an AVPlayerItem with an AVAsset.
199 ///
200 /// Equivalent to -initWithAsset:automaticallyLoadedAssetKeys:, passing
201 /// @
202 /// [
203 /// "
204 /// duration" ] as the value of automaticallyLoadedAssetKeys.
205 ///
206 /// 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.
207 ///
208 /// - Parameter asset:
209 ///
210 /// - Returns: An instance of AVPlayerItem
211 #[unsafe(method(initWithAsset:))]
212 #[unsafe(method_family = init)]
213 pub unsafe fn initWithAsset(this: Allocated<Self>, asset: &AVAsset) -> Retained<Self>;
214
215 #[cfg(feature = "AVAsset")]
216 /// Initializes an AVPlayerItem with an AVAsset.
217 ///
218 /// 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.
219 ///
220 /// 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.
221 ///
222 /// - Parameter asset: An instance of AVAsset.
223 /// - Parameter automaticallyLoadedAssetKeys: An NSArray of NSStrings, each representing a property key defined by AVAsset. See AVAsset.h for property keys, e.g. duration.
224 ///
225 /// - Returns: An instance of AVPlayerItem
226 #[unsafe(method(initWithAsset:automaticallyLoadedAssetKeys:))]
227 #[unsafe(method_family = init)]
228 pub unsafe fn initWithAsset_automaticallyLoadedAssetKeys(
229 this: Allocated<Self>,
230 asset: &AVAsset,
231 automatically_loaded_asset_keys: Option<&NSArray<NSString>>,
232 ) -> Retained<Self>;
233
234 /// # Safety
235 ///
236 /// `zone` must be a valid pointer or null.
237 #[unsafe(method(copyWithZone:))]
238 #[unsafe(method_family = copy)]
239 pub unsafe fn copyWithZone(&self, zone: *mut NSZone) -> Retained<AnyObject>;
240
241 #[unsafe(method(copy))]
242 #[unsafe(method_family = copy)]
243 pub unsafe fn copy(&self) -> Retained<AnyObject>;
244
245 /// The ability of the receiver to be used for playback.
246 ///
247 /// The value of this property is an AVPlayerItemStatus that indicates whether the receiver can be used for playback.
248 /// When the value of this property is AVPlayerItemStatusFailed, the receiver can no longer be used for playback and
249 /// a new instance needs to be created in its place. When this happens, clients can check the value of the error
250 /// property to determine the nature of the failure. The value of this property will not be updated after the receiver
251 /// is removed from an AVPlayer. This property is key value observable.
252 #[unsafe(method(status))]
253 #[unsafe(method_family = none)]
254 pub unsafe fn status(&self) -> AVPlayerItemStatus;
255
256 /// If the receiver's status is AVPlayerItemStatusFailed, this describes the error that caused the failure.
257 ///
258 /// The value of this property is an NSError that describes what caused the receiver to no longer be able to be played.
259 /// If the receiver's status is not AVPlayerItemStatusFailed, the value of this property is nil.
260 #[unsafe(method(error))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn error(&self) -> Option<Retained<NSError>>;
263 );
264}
265
266/// AVPlayerItemInspection.
267impl AVPlayerItem {
268 extern_methods!(
269 #[cfg(feature = "AVAsset")]
270 /// Accessor for underlying AVAsset.
271 #[unsafe(method(asset))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn asset(&self) -> Retained<AVAsset>;
274
275 #[cfg(feature = "AVPlayerItemTrack")]
276 /// Provides array of AVPlayerItem tracks. Observable (can change dynamically during playback).
277 ///
278 /// The value of this property will accord with the properties of the underlying media resource when the receiver becomes ready to play.
279 /// Before the underlying media resource has been sufficiently loaded, its value is an empty NSArray. Use key-value observation to obtain
280 /// a valid array of tracks as soon as it becomes available.
281 #[unsafe(method(tracks))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn tracks(&self) -> Retained<NSArray<AVPlayerItemTrack>>;
284
285 #[cfg(feature = "objc2-core-media")]
286 /// Indicates the duration of the item, not considering either its forwardPlaybackEndTime or reversePlaybackEndTime.
287 ///
288 /// This property is observable. The duration of an item can change dynamically during playback.
289 ///
290 /// Unless you omit
291 /// "
292 /// duration" from the array of asset keys you pass to +playerItemWithAsset:automaticallyLoadedAssetKeys: or
293 /// -initWithAsset:automaticallyLoadedAssetKeys:, the value of this property will accord with the properties of the underlying
294 /// AVAsset and the current state of playback once the receiver becomes ready to play.
295 ///
296 /// Before the underlying duration has been loaded, the value of this property is kCMTimeIndefinite. Use key-value observation to
297 /// obtain a valid duration as soon as it becomes available. (Note that the value of duration may remain kCMTimeIndefinite,
298 /// e.g. for live streams.)
299 #[unsafe(method(duration))]
300 #[unsafe(method_family = none)]
301 pub unsafe fn duration(&self) -> CMTime;
302
303 #[cfg(feature = "objc2-core-foundation")]
304 /// The size of the receiver as presented by the player.
305 ///
306 /// Indicates the size at which the visual portion of the item is presented by the player; can be scaled from this
307 /// size to fit within the bounds of an AVPlayerLayer via its videoGravity property. Can be scaled arbitrarily for presentation
308 /// via the frame property of an AVPlayerLayer.
309 ///
310 /// The value of this property will accord with the properties of the underlying media resource when the receiver becomes ready to play.
311 /// Before the underlying media resource is sufficiently loaded, its value is CGSizeZero. Use key-value observation to obtain a valid
312 /// presentationSize as soon as it becomes available. (Note that the value of presentationSize may remain CGSizeZero, e.g. for audio-only items.)
313 #[unsafe(method(presentationSize))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn presentationSize(&self) -> CGSize;
316
317 #[cfg(feature = "AVMetadataItem")]
318 /// Provides an NSArray of AVMetadataItems representing the timed metadata encountered most recently within the media as it plays. May be nil.
319 ///
320 /// Notifications of changes are available via key-value observation.
321 /// 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.
322 ///
323 /// This property must be accessed on the main thread/queue.
324 #[deprecated = "Use AVPlayerItemMetadataOutput to obtain timed metadata"]
325 #[unsafe(method(timedMetadata))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn timedMetadata(&self) -> Option<Retained<NSArray<AVMetadataItem>>>;
328
329 /// 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.
330 ///
331 /// 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..
332 #[unsafe(method(automaticallyLoadedAssetKeys))]
333 #[unsafe(method_family = none)]
334 pub unsafe fn automaticallyLoadedAssetKeys(&self) -> Retained<NSArray<NSString>>;
335 );
336}
337
338/// AVPlayerItemRateAndSteppingSupport.
339impl AVPlayerItem {
340 extern_methods!(
341 /// For releases of macOS prior to 10.9 and releases of iOS prior to 7.0, indicates whether the item can be played at rates greater than 1.0.
342 /// Starting with macOS 10.9 and iOS 7.0, all AVPlayerItems with status AVPlayerItemReadyToPlay can be played at rates between 1.0 and 2.0, inclusive, even if canPlayFastForward is NO; for those releases canPlayFastForward indicates whether the item can be played at rates greater than 2.0.
343 #[unsafe(method(canPlayFastForward))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn canPlayFastForward(&self) -> bool;
346
347 /// Indicates whether the item can be played at rates between 0.0 and 1.0
348 #[unsafe(method(canPlaySlowForward))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn canPlaySlowForward(&self) -> bool;
351
352 /// Indicates whether the item can be played at rate -1.0
353 #[unsafe(method(canPlayReverse))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn canPlayReverse(&self) -> bool;
356
357 /// Indicates whether the item can be played at rates less between 0.0 and -1.0
358 #[unsafe(method(canPlaySlowReverse))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn canPlaySlowReverse(&self) -> bool;
361
362 /// Indicates whether the item can be played at rates less than -1.0
363 #[unsafe(method(canPlayFastReverse))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn canPlayFastReverse(&self) -> bool;
366
367 /// Indicates whether the item supports stepping forward; see -stepByCount:. Once the item has become ready to play, the value of canStepForward does not change even when boundary conditions are reached, such as when the item's currentTime is its end time.
368 #[unsafe(method(canStepForward))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn canStepForward(&self) -> bool;
371
372 /// Indicates whether the item supports stepping backward; see -stepByCount:. Once the item has become ready to play, the value of canStepBackward does not change even when boundary conditions are reached, such as when the item's currentTime is equal to kCMTimeZero.
373 #[unsafe(method(canStepBackward))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn canStepBackward(&self) -> bool;
376
377 #[cfg(feature = "objc2-core-media")]
378 /// Indicates how close to the latest content in a live stream playback will begin after a live start or a seek to kCMTimePositiveInfinity.
379 ///
380 /// For non-live assets this value is kCMTimeInvalid.
381 #[unsafe(method(configuredTimeOffsetFromLive))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn configuredTimeOffsetFromLive(&self) -> CMTime;
384
385 #[cfg(feature = "objc2-core-media")]
386 /// Setter for [`configuredTimeOffsetFromLive`][Self::configuredTimeOffsetFromLive].
387 #[unsafe(method(setConfiguredTimeOffsetFromLive:))]
388 #[unsafe(method_family = none)]
389 pub unsafe fn setConfiguredTimeOffsetFromLive(
390 &self,
391 configured_time_offset_from_live: CMTime,
392 );
393
394 #[cfg(feature = "objc2-core-media")]
395 /// A recommended value for configuredTimeOffsetFromLive, based on observed network conditions.
396 ///
397 /// For non-live assets this value is kCMTimeInvalid.
398 #[unsafe(method(recommendedTimeOffsetFromLive))]
399 #[unsafe(method_family = none)]
400 pub unsafe fn recommendedTimeOffsetFromLive(&self) -> CMTime;
401
402 /// 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.
403 ///
404 /// 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.
405 ///
406 /// This behavior applies to media buffering that occurs as a consequence of starting playback, seeking, and recovering from a playback stall.
407 ///
408 /// Note that if the network cannot deliver media quickly enough to maintain the playback rate, playback may stall interminably.
409 ///
410 /// This property value has no effect if the asset is not a live stream. The default value of this property is NO.
411 #[unsafe(method(automaticallyPreservesTimeOffsetFromLive))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn automaticallyPreservesTimeOffsetFromLive(&self) -> bool;
414
415 /// Setter for [`automaticallyPreservesTimeOffsetFromLive`][Self::automaticallyPreservesTimeOffsetFromLive].
416 #[unsafe(method(setAutomaticallyPreservesTimeOffsetFromLive:))]
417 #[unsafe(method_family = none)]
418 pub unsafe fn setAutomaticallyPreservesTimeOffsetFromLive(
419 &self,
420 automatically_preserves_time_offset_from_live: bool,
421 );
422 );
423}
424
425/// AVPlayerItemTimeControl.
426impl AVPlayerItem {
427 extern_methods!(
428 #[cfg(feature = "objc2-core-media")]
429 /// Returns the current time of the item.
430 ///
431 /// Returns the current time of the item. Not key-value observable; use -[AVPlayer addPeriodicTimeObserverForInterval:queue:usingBlock:] instead.
432 ///
433 /// - Returns: A CMTime
434 #[unsafe(method(currentTime))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn currentTime(&self) -> CMTime;
437
438 #[cfg(feature = "objc2-core-media")]
439 /// The end time for forward playback.
440 ///
441 /// Specifies the time at which playback should end when the playback rate is positive (see AVPlayer's rate property).
442 /// The default value is kCMTimeInvalid, which indicates that no end time for forward playback is specified.
443 /// In this case, the effective end time for forward playback is the receiver's duration.
444 ///
445 /// When the end time is reached, the receiver will post AVPlayerItemDidPlayToEndTimeNotification and the AVPlayer will take
446 /// the action indicated by the value of its actionAtItemEnd property (see AVPlayerActionAtItemEnd in AVPlayer.h).
447 ///
448 /// The value of this property has no effect on playback when the rate is negative.
449 #[unsafe(method(forwardPlaybackEndTime))]
450 #[unsafe(method_family = none)]
451 pub unsafe fn forwardPlaybackEndTime(&self) -> CMTime;
452
453 #[cfg(feature = "objc2-core-media")]
454 /// Setter for [`forwardPlaybackEndTime`][Self::forwardPlaybackEndTime].
455 #[unsafe(method(setForwardPlaybackEndTime:))]
456 #[unsafe(method_family = none)]
457 pub unsafe fn setForwardPlaybackEndTime(&self, forward_playback_end_time: CMTime);
458
459 #[cfg(feature = "objc2-core-media")]
460 /// The end time for reverse playback.
461 ///
462 /// Specifies the time at which playback should end when the playback rate is negative (see AVPlayer's rate property).
463 /// The default value is kCMTimeInvalid, which indicates that no end time for reverse playback is specified.
464 /// In this case, the effective end time for reverse playback is kCMTimeZero.
465 ///
466 /// When the end time is reached, the receiver will post AVPlayerItemDidPlayToEndTimeNotification and the AVPlayer will take
467 /// the action indicated by the value of its actionAtItemEnd property (see AVPlayerActionAtItemEnd in AVPlayer.h).
468 ///
469 /// The value of this property has no effect on playback when the rate is positive.
470 #[unsafe(method(reversePlaybackEndTime))]
471 #[unsafe(method_family = none)]
472 pub unsafe fn reversePlaybackEndTime(&self) -> CMTime;
473
474 #[cfg(feature = "objc2-core-media")]
475 /// Setter for [`reversePlaybackEndTime`][Self::reversePlaybackEndTime].
476 #[unsafe(method(setReversePlaybackEndTime:))]
477 #[unsafe(method_family = none)]
478 pub unsafe fn setReversePlaybackEndTime(&self, reverse_playback_end_time: CMTime);
479
480 /// This property provides a collection of time ranges that the player item can seek to. The ranges provided might be discontinous.
481 ///
482 /// Returns an NSArray of NSValues containing CMTimeRanges.
483 #[unsafe(method(seekableTimeRanges))]
484 #[unsafe(method_family = none)]
485 pub unsafe fn seekableTimeRanges(&self) -> Retained<NSArray<NSValue>>;
486
487 #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
488 /// Moves the playback cursor and invokes the specified block when the seek operation has either been completed or been interrupted.
489 ///
490 /// Use this method to seek to a specified time for the item and to be notified when the seek operation is complete.
491 /// The completion handler for any prior seek request that is still in process will be invoked immediately with the finished parameter
492 /// set to NO. If the new request completes without being interrupted by another seek request or by any other operation the specified
493 /// completion handler will be invoked with the finished parameter set to YES.
494 /// 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.
495 ///
496 /// This method throws an exception if time is invalid or indefinite.
497 ///
498 /// - Parameter time:
499 /// - Parameter completionHandler:
500 ///
501 /// # Safety
502 ///
503 /// `completion_handler` block must be sendable.
504 #[unsafe(method(seekToTime:completionHandler:))]
505 #[unsafe(method_family = none)]
506 pub unsafe fn seekToTime_completionHandler(
507 &self,
508 time: CMTime,
509 completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
510 );
511
512 #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
513 /// 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.
514 ///
515 /// Use this method to seek to a specified time for the item and to be notified when the seek operation is complete.
516 /// The time seeked to will be within the range [time-toleranceBefore, time+toleranceAfter] and may differ from the specified time for efficiency.
517 /// Pass kCMTimeZero for both toleranceBefore and toleranceAfter to request sample accurate seeking which may incur additional decoding delay.
518 /// Messaging this method with beforeTolerance:kCMTimePositiveInfinity and afterTolerance:kCMTimePositiveInfinity is the same as messaging seekToTime: directly.
519 /// 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
520 /// request completes without being interrupted by another seek request or by any other operation the specified completion handler will be invoked with the
521 /// finished parameter set to YES.
522 /// 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.
523 ///
524 /// This method throws an exception if time is invalid or indefinite or if tolerance before or tolerance after is invalid or negative.
525 ///
526 /// - Parameter time:
527 /// - Parameter toleranceBefore:
528 /// - Parameter toleranceAfter:
529 /// - Parameter completionHandler:
530 ///
531 /// # Safety
532 ///
533 /// `completion_handler` block must be sendable.
534 #[unsafe(method(seekToTime:toleranceBefore:toleranceAfter:completionHandler:))]
535 #[unsafe(method_family = none)]
536 pub unsafe fn seekToTime_toleranceBefore_toleranceAfter_completionHandler(
537 &self,
538 time: CMTime,
539 tolerance_before: CMTime,
540 tolerance_after: CMTime,
541 completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
542 );
543
544 /// Cancel any pending seek requests and invoke the corresponding completion handlers if present.
545 ///
546 /// Use this method to cancel and release the completion handlers of pending seeks. The finished parameter of the completion handlers will
547 /// be set to NO.
548 #[unsafe(method(cancelPendingSeeks))]
549 #[unsafe(method_family = none)]
550 pub unsafe fn cancelPendingSeeks(&self);
551
552 /// If currentTime is mapped to a particular (real-time) date, return that date.
553 ///
554 /// - Returns: Returns the date of current playback, or nil if playback is not mapped to any date.
555 #[unsafe(method(currentDate))]
556 #[unsafe(method_family = none)]
557 pub unsafe fn currentDate(&self) -> Option<Retained<NSDate>>;
558
559 #[cfg(feature = "block2")]
560 /// 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.
561 ///
562 /// For playback content that is associated with a range of dates, move the
563 /// playhead to point within that range and invokes the completion handler when the seek operation is complete.
564 /// Will fail if the supplied date is outside the range or if the content is not associated with a range of dates.
565 /// The completion handler for any prior seek request that is still in process will be invoked immediately with the finished parameter
566 /// set to NO. If the new request completes without being interrupted by another seek request or by any other operation, the specified
567 /// completion handler will be invoked with the finished parameter set to YES.
568 ///
569 /// - Parameter date: The new position for the playhead.
570 /// - Parameter completionHandler: The block to invoke when seek operation is complete
571 ///
572 /// - Returns: Returns true if the playhead was moved to the supplied date.
573 ///
574 /// # Safety
575 ///
576 /// `completion_handler` block must be sendable.
577 #[unsafe(method(seekToDate:completionHandler:))]
578 #[unsafe(method_family = none)]
579 pub unsafe fn seekToDate_completionHandler(
580 &self,
581 date: &NSDate,
582 completion_handler: Option<&block2::DynBlock<dyn Fn(Bool)>>,
583 ) -> bool;
584
585 /// Moves player's current item's current time forward or backward by the specified number of steps.
586 ///
587 /// The size of each step depends on the enabled AVPlayerItemTracks of the AVPlayerItem.
588 ///
589 /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this method must be invoked on the main thread/queue.
590 ///
591 /// - Parameter stepCount: The number of steps by which to move. A positive number results in stepping forward, a negative number in stepping backward.
592 #[unsafe(method(stepByCount:))]
593 #[unsafe(method_family = none)]
594 pub unsafe fn stepByCount(&self, step_count: NSInteger);
595
596 #[cfg(feature = "objc2-core-media")]
597 /// The item's timebase.
598 ///
599 /// You can examine the timebase to discover the relationship between the item's time and the source clock used for drift synchronization.
600 /// This timebase is read-only; you cannot set its time or rate to affect playback.
601 #[unsafe(method(timebase))]
602 #[unsafe(method_family = none)]
603 pub unsafe fn timebase(&self) -> Option<Retained<CMTimebase>>;
604 );
605}
606
607/// AVPlayerItemVisualPresentation.
608impl AVPlayerItem {
609 extern_methods!(
610 #[cfg(feature = "AVVideoComposition")]
611 /// Indicates the video composition settings to be applied during playback.
612 ///
613 /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this property must be accessed on the main thread/queue.
614 ///
615 /// This property throws an exception if a video composition is set with any of the following values:
616 /// - renderSize, renderScale, or frameDuration is less than or equal to zero
617 /// - sourceTrackIDForFrameTiming is less than or equal to zero
618 /// - uses AVVideoCompositionCoreAnimationTool (works for offline rendering only)
619 #[unsafe(method(videoComposition))]
620 #[unsafe(method_family = none)]
621 pub unsafe fn videoComposition(&self) -> Option<Retained<AVVideoComposition>>;
622
623 #[cfg(feature = "AVVideoComposition")]
624 /// Setter for [`videoComposition`][Self::videoComposition].
625 ///
626 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
627 #[unsafe(method(setVideoComposition:))]
628 #[unsafe(method_family = none)]
629 pub unsafe fn setVideoComposition(&self, video_composition: Option<&AVVideoComposition>);
630
631 #[cfg(feature = "AVVideoCompositing")]
632 /// Indicates the custom video compositor instance.
633 ///
634 /// 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.
635 ///
636 /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this property must be accessed on the main thread/queue.
637 #[unsafe(method(customVideoCompositor))]
638 #[unsafe(method_family = none)]
639 pub unsafe fn customVideoCompositor(
640 &self,
641 ) -> Option<Retained<ProtocolObject<dyn AVVideoCompositing>>>;
642
643 /// Indicates whether the item's timing follows the displayed video frame when seeking with a video composition
644 ///
645 /// By default, item timing is updated as quickly as possible, not waiting for media at new times to be rendered when seeking or
646 /// during normal playback. The latency that occurs, for example, between the completion of a seek operation and the display of a
647 /// video frame at a new time is negligible in most situations. However, when video compositions are in use, the processing of
648 /// video for any particular time may introduce noticeable latency. Therefore it may be desirable when a video composition is in
649 /// use for the item's timing be updated only after the video frame for a time has been displayed. This allows, for instance, an
650 /// AVSynchronizedLayer associated with an AVPlayerItem to remain in synchronization with the displayed video and for the
651 /// currentTime property to return the time of the displayed video.
652 ///
653 /// This property has no effect on items for which videoComposition is nil.
654 #[unsafe(method(seekingWaitsForVideoCompositionRendering))]
655 #[unsafe(method_family = none)]
656 pub unsafe fn seekingWaitsForVideoCompositionRendering(&self) -> bool;
657
658 /// Setter for [`seekingWaitsForVideoCompositionRendering`][Self::seekingWaitsForVideoCompositionRendering].
659 #[unsafe(method(setSeekingWaitsForVideoCompositionRendering:))]
660 #[unsafe(method_family = none)]
661 pub unsafe fn setSeekingWaitsForVideoCompositionRendering(
662 &self,
663 seeking_waits_for_video_composition_rendering: bool,
664 );
665
666 #[cfg(feature = "AVTextStyleRule")]
667 /// An array of AVTextStyleRules representing text styling that can be applied to subtitles and other legible media.
668 ///
669 /// 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.
670 ///
671 /// This property has an effect only for tracks with media subtype kCMSubtitleFormatType_WebVTT.
672 #[unsafe(method(textStyleRules))]
673 #[unsafe(method_family = none)]
674 pub unsafe fn textStyleRules(&self) -> Option<Retained<NSArray<AVTextStyleRule>>>;
675
676 #[cfg(feature = "AVTextStyleRule")]
677 /// Setter for [`textStyleRules`][Self::textStyleRules].
678 ///
679 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
680 #[unsafe(method(setTextStyleRules:))]
681 #[unsafe(method_family = none)]
682 pub unsafe fn setTextStyleRules(&self, text_style_rules: Option<&NSArray<AVTextStyleRule>>);
683
684 #[cfg(feature = "AVVideoSettings")]
685 /// Specifies the video aperture mode to apply during playback.
686 ///
687 /// See AVVideoApertureMode constants defined in AVVideoSettings.h. Default is AVVideoApertureModeCleanAperture.
688 #[unsafe(method(videoApertureMode))]
689 #[unsafe(method_family = none)]
690 pub unsafe fn videoApertureMode(&self) -> Retained<AVVideoApertureMode>;
691
692 #[cfg(feature = "AVVideoSettings")]
693 /// Setter for [`videoApertureMode`][Self::videoApertureMode].
694 ///
695 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
696 #[unsafe(method(setVideoApertureMode:))]
697 #[unsafe(method_family = none)]
698 pub unsafe fn setVideoApertureMode(&self, video_aperture_mode: &AVVideoApertureMode);
699
700 /// Controls whether or not to apply the per frame HDR display metadata of the source during playback.
701 #[unsafe(method(appliesPerFrameHDRDisplayMetadata))]
702 #[unsafe(method_family = none)]
703 pub unsafe fn appliesPerFrameHDRDisplayMetadata(&self) -> bool;
704
705 /// Setter for [`appliesPerFrameHDRDisplayMetadata`][Self::appliesPerFrameHDRDisplayMetadata].
706 #[unsafe(method(setAppliesPerFrameHDRDisplayMetadata:))]
707 #[unsafe(method_family = none)]
708 pub unsafe fn setAppliesPerFrameHDRDisplayMetadata(
709 &self,
710 applies_per_frame_hdr_display_metadata: bool,
711 );
712 );
713}
714
715/// AVPlayerItemAudioProcessing.
716impl AVPlayerItem {
717 extern_methods!(
718 #[cfg(feature = "AVAudioProcessingSettings")]
719 /// Indicates the processing algorithm used to manage audio pitch at varying rates and for scaled audio edits.
720 ///
721 /// Constants for various time pitch algorithms, e.g. AVAudioTimePitchSpectral, are defined in AVAudioProcessingSettings.h.
722 /// 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.
723 /// For macOS versions prior to 12.0 the default value is AVAudioTimePitchAlgorithmSpectral.
724 #[unsafe(method(audioTimePitchAlgorithm))]
725 #[unsafe(method_family = none)]
726 pub unsafe fn audioTimePitchAlgorithm(&self) -> Retained<AVAudioTimePitchAlgorithm>;
727
728 #[cfg(feature = "AVAudioProcessingSettings")]
729 /// Setter for [`audioTimePitchAlgorithm`][Self::audioTimePitchAlgorithm].
730 ///
731 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
732 #[unsafe(method(setAudioTimePitchAlgorithm:))]
733 #[unsafe(method_family = none)]
734 pub unsafe fn setAudioTimePitchAlgorithm(
735 &self,
736 audio_time_pitch_algorithm: &AVAudioTimePitchAlgorithm,
737 );
738
739 /// Indicates whether audio spatialization is allowed
740 ///
741 /// 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.
742 #[deprecated = "Use allowedAudioSpatializationFormats instead"]
743 #[unsafe(method(isAudioSpatializationAllowed))]
744 #[unsafe(method_family = none)]
745 pub unsafe fn isAudioSpatializationAllowed(&self) -> bool;
746
747 /// Setter for [`isAudioSpatializationAllowed`][Self::isAudioSpatializationAllowed].
748 #[deprecated = "Use allowedAudioSpatializationFormats instead"]
749 #[unsafe(method(setAudioSpatializationAllowed:))]
750 #[unsafe(method_family = none)]
751 pub unsafe fn setAudioSpatializationAllowed(&self, audio_spatialization_allowed: bool);
752
753 #[cfg(feature = "AVAudioProcessingSettings")]
754 /// Indicates the source audio channel layouts allowed by the receiver for spatialization.
755 ///
756 /// 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.
757 #[unsafe(method(allowedAudioSpatializationFormats))]
758 #[unsafe(method_family = none)]
759 pub unsafe fn allowedAudioSpatializationFormats(&self) -> AVAudioSpatializationFormats;
760
761 #[cfg(feature = "AVAudioProcessingSettings")]
762 /// Setter for [`allowedAudioSpatializationFormats`][Self::allowedAudioSpatializationFormats].
763 #[unsafe(method(setAllowedAudioSpatializationFormats:))]
764 #[unsafe(method_family = none)]
765 pub unsafe fn setAllowedAudioSpatializationFormats(
766 &self,
767 allowed_audio_spatialization_formats: AVAudioSpatializationFormats,
768 );
769
770 #[cfg(feature = "AVAudioMix")]
771 /// Indicates the audio mix parameters to be applied during playback
772 ///
773 /// 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.)
774 #[unsafe(method(audioMix))]
775 #[unsafe(method_family = none)]
776 pub unsafe fn audioMix(&self) -> Option<Retained<AVAudioMix>>;
777
778 #[cfg(feature = "AVAudioMix")]
779 /// Setter for [`audioMix`][Self::audioMix].
780 ///
781 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
782 #[unsafe(method(setAudioMix:))]
783 #[unsafe(method_family = none)]
784 pub unsafe fn setAudioMix(&self, audio_mix: Option<&AVAudioMix>);
785 );
786}
787
788/// AVPlayerItemPlayability.
789impl AVPlayerItem {
790 extern_methods!(
791 /// This property provides a collection of time ranges for which the player has the media data readily available. The ranges provided might be discontinuous.
792 ///
793 /// Returns an NSArray of NSValues containing CMTimeRanges.
794 #[unsafe(method(loadedTimeRanges))]
795 #[unsafe(method_family = none)]
796 pub unsafe fn loadedTimeRanges(&self) -> Retained<NSArray<NSValue>>;
797
798 /// Indicates whether the item will likely play through without stalling.
799 ///
800 /// This property communicates a prediction of playability. Factors considered in this prediction
801 /// include I/O throughput and media decode performance. It is possible for playbackLikelyToKeepUp to
802 /// indicate NO while the property playbackBufferFull indicates YES. In this event the playback buffer has
803 /// reached capacity but there isn't the statistical data to support a prediction that playback is likely to
804 /// keep up. It is left to the application programmer to decide to continue media playback or not.
805 /// See playbackBufferFull below.
806 #[unsafe(method(isPlaybackLikelyToKeepUp))]
807 #[unsafe(method_family = none)]
808 pub unsafe fn isPlaybackLikelyToKeepUp(&self) -> bool;
809
810 /// Indicates that the internal media buffer is full and that further I/O is suspended.
811 ///
812 /// This property reports that the data buffer used for playback has reach capacity.
813 /// Despite the playback buffer reaching capacity there might not exist sufficient statistical
814 /// data to support a playbackLikelyToKeepUp prediction of YES. See playbackLikelyToKeepUp above.
815 #[unsafe(method(isPlaybackBufferFull))]
816 #[unsafe(method_family = none)]
817 pub unsafe fn isPlaybackBufferFull(&self) -> bool;
818
819 #[unsafe(method(isPlaybackBufferEmpty))]
820 #[unsafe(method_family = none)]
821 pub unsafe fn isPlaybackBufferEmpty(&self) -> bool;
822
823 /// Indicates whether the player item can use network resources to keep playback state up to date while paused
824 ///
825 /// 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.
826 ///
827 /// 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.
828 #[unsafe(method(canUseNetworkResourcesForLiveStreamingWhilePaused))]
829 #[unsafe(method_family = none)]
830 pub unsafe fn canUseNetworkResourcesForLiveStreamingWhilePaused(&self) -> bool;
831
832 /// Setter for [`canUseNetworkResourcesForLiveStreamingWhilePaused`][Self::canUseNetworkResourcesForLiveStreamingWhilePaused].
833 #[unsafe(method(setCanUseNetworkResourcesForLiveStreamingWhilePaused:))]
834 #[unsafe(method_family = none)]
835 pub unsafe fn setCanUseNetworkResourcesForLiveStreamingWhilePaused(
836 &self,
837 can_use_network_resources_for_live_streaming_while_paused: bool,
838 );
839
840 /// Indicates the media duration the caller prefers the player to buffer from the network ahead of the playhead to guard against playback disruption.
841 ///
842 /// The value is in seconds. If it is set to 0, the player will choose an appropriate level of buffering for most use cases.
843 /// 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.
844 /// Note that the system may buffer less than the value of this property in order to manage resource consumption.
845 #[unsafe(method(preferredForwardBufferDuration))]
846 #[unsafe(method_family = none)]
847 pub unsafe fn preferredForwardBufferDuration(&self) -> NSTimeInterval;
848
849 /// Setter for [`preferredForwardBufferDuration`][Self::preferredForwardBufferDuration].
850 #[unsafe(method(setPreferredForwardBufferDuration:))]
851 #[unsafe(method_family = none)]
852 pub unsafe fn setPreferredForwardBufferDuration(
853 &self,
854 preferred_forward_buffer_duration: NSTimeInterval,
855 );
856 );
857}
858
859/// These constants can be used in any combination as the value of variantPreferences.
860///
861/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avvariantpreferences?language=objc)
862// NS_OPTIONS
863#[repr(transparent)]
864#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
865pub struct AVVariantPreferences(pub NSUInteger);
866bitflags::bitflags! {
867 impl AVVariantPreferences: NSUInteger {
868/// 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.
869 #[doc(alias = "AVVariantPreferenceNone")]
870 const None = 0;
871/// Directs the item to permit the use of variants with lossless audio encodings, if sufficient bandwidth is available for their use.
872 #[doc(alias = "AVVariantPreferenceScalabilityToLosslessAudio")]
873 const ScalabilityToLosslessAudio = 1<<0;
874 }
875}
876
877unsafe impl Encode for AVVariantPreferences {
878 const ENCODING: Encoding = NSUInteger::ENCODING;
879}
880
881unsafe impl RefEncode for AVVariantPreferences {
882 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
883}
884
885/// AVPlayerItemVariantControl.
886impl AVPlayerItem {
887 extern_methods!(
888 /// Indicates the desired limit of network bandwidth consumption for this item.
889 ///
890 /// 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.
891 ///
892 /// 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.
893 #[unsafe(method(preferredPeakBitRate))]
894 #[unsafe(method_family = none)]
895 pub unsafe fn preferredPeakBitRate(&self) -> c_double;
896
897 /// Setter for [`preferredPeakBitRate`][Self::preferredPeakBitRate].
898 #[unsafe(method(setPreferredPeakBitRate:))]
899 #[unsafe(method_family = none)]
900 pub unsafe fn setPreferredPeakBitRate(&self, preferred_peak_bit_rate: c_double);
901
902 /// Indicates the desired limit of network bandwidth consumption for this item over expensive networks.
903 ///
904 /// When preferredPeakBitRateForExpensiveNetworks is set to non-zero, the player will attempt to limit item playback to that bit rate
905 /// when streaming over an expensive network, such as when using a cellular data plan. (See -[NWPath isExpensive])
906 ///
907 /// 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.
908 ///
909 /// Note that preferredPeakBitRate still applies unconditionally. If preferredPeakBitRateForExpensiveNetworks is less restrictive (greater) than preferredPeakBitRate,
910 /// preferredPeakBitRateForExpensiveNetworks has no practical effect.
911 #[unsafe(method(preferredPeakBitRateForExpensiveNetworks))]
912 #[unsafe(method_family = none)]
913 pub unsafe fn preferredPeakBitRateForExpensiveNetworks(&self) -> c_double;
914
915 /// Setter for [`preferredPeakBitRateForExpensiveNetworks`][Self::preferredPeakBitRateForExpensiveNetworks].
916 #[unsafe(method(setPreferredPeakBitRateForExpensiveNetworks:))]
917 #[unsafe(method_family = none)]
918 pub unsafe fn setPreferredPeakBitRateForExpensiveNetworks(
919 &self,
920 preferred_peak_bit_rate_for_expensive_networks: c_double,
921 );
922
923 #[cfg(feature = "objc2-core-foundation")]
924 /// Indicates a preferred upper limit on the resolution of the video to be downloaded (or otherwise transferred) and rendered by the player.
925 ///
926 /// The default value is CGSizeZero, which indicates that the client enforces no limit on video resolution. Other values indicate a preferred maximum video resolution.
927 /// It only applies to HTTP Live Streaming asset.
928 #[unsafe(method(preferredMaximumResolution))]
929 #[unsafe(method_family = none)]
930 pub unsafe fn preferredMaximumResolution(&self) -> CGSize;
931
932 #[cfg(feature = "objc2-core-foundation")]
933 /// Setter for [`preferredMaximumResolution`][Self::preferredMaximumResolution].
934 #[unsafe(method(setPreferredMaximumResolution:))]
935 #[unsafe(method_family = none)]
936 pub unsafe fn setPreferredMaximumResolution(&self, preferred_maximum_resolution: CGSize);
937
938 #[cfg(feature = "objc2-core-foundation")]
939 /// Indicates a preferred upper limit on the resolution of the video to be downloaded that applies only when the download occurs over expensive networks.
940 ///
941 /// The default value is CGSizeZero, which indicates that the client enforces no limit on video resolution. Other values indicate a preferred maximum video resolution.
942 /// This limit applies only when streaming over an expensive network, such as when using a cellular data plan. (See -[NWPath isExpensive])
943 ///
944 /// It only applies to HTTP Live Streaming asset.
945 ///
946 /// Note that preferredMaximumResolution still applies unconditionally. If preferredMaximumResolutionForExpensiveNetworks is less restrictive (higher resolution)
947 /// than preferredMaximumResolution, preferredMaximumResolutionForExpensiveNetworks has no practical effect.
948 #[unsafe(method(preferredMaximumResolutionForExpensiveNetworks))]
949 #[unsafe(method_family = none)]
950 pub unsafe fn preferredMaximumResolutionForExpensiveNetworks(&self) -> CGSize;
951
952 #[cfg(feature = "objc2-core-foundation")]
953 /// Setter for [`preferredMaximumResolutionForExpensiveNetworks`][Self::preferredMaximumResolutionForExpensiveNetworks].
954 #[unsafe(method(setPreferredMaximumResolutionForExpensiveNetworks:))]
955 #[unsafe(method_family = none)]
956 pub unsafe fn setPreferredMaximumResolutionForExpensiveNetworks(
957 &self,
958 preferred_maximum_resolution_for_expensive_networks: CGSize,
959 );
960
961 /// Directs the player to start playback with the first eligible variant that appears in the stream's master playlist.
962 ///
963 /// 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.
964 /// In all cases, AVPlayer may switch to other variants during playback.
965 ///
966 /// 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.
967 /// 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.
968 /// 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.
969 ///
970 /// 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.
971 /// This property only applies to HTTP Live Streaming assets. The default value of this property is NO.
972 #[unsafe(method(startsOnFirstEligibleVariant))]
973 #[unsafe(method_family = none)]
974 pub unsafe fn startsOnFirstEligibleVariant(&self) -> bool;
975
976 /// Setter for [`startsOnFirstEligibleVariant`][Self::startsOnFirstEligibleVariant].
977 #[unsafe(method(setStartsOnFirstEligibleVariant:))]
978 #[unsafe(method_family = none)]
979 pub unsafe fn setStartsOnFirstEligibleVariant(
980 &self,
981 starts_on_first_eligible_variant: bool,
982 );
983
984 /// Indicates preferences for variant switching.
985 ///
986 /// Changing variant preferences during playback may result in a variant switch.
987 /// The default value is AVVariantPreferenceNone.
988 #[unsafe(method(variantPreferences))]
989 #[unsafe(method_family = none)]
990 pub unsafe fn variantPreferences(&self) -> AVVariantPreferences;
991
992 /// Setter for [`variantPreferences`][Self::variantPreferences].
993 #[unsafe(method(setVariantPreferences:))]
994 #[unsafe(method_family = none)]
995 pub unsafe fn setVariantPreferences(&self, variant_preferences: AVVariantPreferences);
996 );
997}
998
999/// AVPlayerItemMediaSelection.
1000impl AVPlayerItem {
1001 extern_methods!(
1002 #[cfg(feature = "AVMediaSelectionGroup")]
1003 /// Selects the media option described by the specified instance of AVMediaSelectionOption in the specified AVMediaSelectionGroup and deselects all other options in that group.
1004 ///
1005 /// If the specified media selection option isn't a member of the specified media selection group, no change in presentation state will result.
1006 /// If the value of the property allowsEmptySelection of the AVMediaSelectionGroup is YES, you can pass nil for mediaSelectionOption to deselect
1007 /// all media selection options in the group.
1008 /// 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.
1009 ///
1010 /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this method must be invoked on the main thread/queue.
1011 ///
1012 /// - Parameter mediaSelectionOption: The option to select.
1013 /// - Parameter mediaSelectionGroup: The media selection group, obtained from the receiver's asset, that contains the specified option.
1014 #[unsafe(method(selectMediaOption:inMediaSelectionGroup:))]
1015 #[unsafe(method_family = none)]
1016 pub unsafe fn selectMediaOption_inMediaSelectionGroup(
1017 &self,
1018 media_selection_option: Option<&AVMediaSelectionOption>,
1019 media_selection_group: &AVMediaSelectionGroup,
1020 );
1021
1022 #[cfg(feature = "AVMediaSelectionGroup")]
1023 /// 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.
1024 ///
1025 /// 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:].
1026 ///
1027 /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this method must be invoked on the main thread/queue.
1028 ///
1029 /// - Parameter mediaSelectionGroup: The media selection group, obtained from the receiver's asset, that contains the specified option.
1030 #[unsafe(method(selectMediaOptionAutomaticallyInMediaSelectionGroup:))]
1031 #[unsafe(method_family = none)]
1032 pub unsafe fn selectMediaOptionAutomaticallyInMediaSelectionGroup(
1033 &self,
1034 media_selection_group: &AVMediaSelectionGroup,
1035 );
1036
1037 #[cfg(feature = "AVMediaSelection")]
1038 /// Provides an instance of AVMediaSelection carrying current selections for each of the receiver's media selection groups.
1039 #[unsafe(method(currentMediaSelection))]
1040 #[unsafe(method_family = none)]
1041 pub unsafe fn currentMediaSelection(&self) -> Retained<AVMediaSelection>;
1042 );
1043}
1044
1045/// AVPlayerItemCustomMediaSelectionScheme.
1046impl AVPlayerItem {
1047 extern_methods!(
1048 #[cfg(feature = "AVMediaSelectionGroup")]
1049 /// Indicates the AVCustomMediaSelectionSchemes of AVMediaSelectionGroups of the receiver's asset with which an associated UI implementation should configure its interface for media selection.
1050 ///
1051 /// Recommended usage: if use of a custom media selection scheme is desired, set this property before either replacing an AVPlayer's current item with the receiver or adding the receiver to an AVQueuePlayer's play queue. This will satisfy requirements of UI implementations that commit to a configuration of UI elements as the receiver becomes ready to play.
1052 #[unsafe(method(preferredCustomMediaSelectionSchemes))]
1053 #[unsafe(method_family = none)]
1054 pub unsafe fn preferredCustomMediaSelectionSchemes(
1055 &self,
1056 ) -> Retained<NSArray<AVCustomMediaSelectionScheme>>;
1057
1058 #[cfg(feature = "AVMediaSelectionGroup")]
1059 /// Setter for [`preferredCustomMediaSelectionSchemes`][Self::preferredCustomMediaSelectionSchemes].
1060 ///
1061 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1062 #[unsafe(method(setPreferredCustomMediaSelectionSchemes:))]
1063 #[unsafe(method_family = none)]
1064 pub unsafe fn setPreferredCustomMediaSelectionSchemes(
1065 &self,
1066 preferred_custom_media_selection_schemes: &NSArray<AVCustomMediaSelectionScheme>,
1067 );
1068
1069 #[cfg(feature = "AVMediaSelectionGroup")]
1070 /// When the associated AVPlayer's appliesMediaSelectionCriteriaAutomatically property is set to YES, configures the player item to prefer a particular language, replacing any previous preference for available languages of the specified group's custom media selection scheme.
1071 ///
1072 /// Overrides preferences for languages specified by the AVPlayer's current media selection criteria.
1073 /// This method has no effect when the associated AVPlayer's appliesMediaSelectionCriteriaAutomatically property has a value of NO, in which case you must use -selectMediaOption:inMediaSelectionGroup: instead in order to alter the presentation state of the media.
1074 ///
1075 /// - Parameter languages: A BCP 47 language tag, typically obtained from the availableLanguages of the AVCustomMediaSelectionScheme of the specified AVMediaSelectionGroup.
1076 /// - Parameter mediaSelectionGroup: The media selection group, obtained from the receiver's asset, to which the specified setting is to be applied.
1077 #[unsafe(method(selectMediaPresentationLanguage:forMediaSelectionGroup:))]
1078 #[unsafe(method_family = none)]
1079 pub unsafe fn selectMediaPresentationLanguage_forMediaSelectionGroup(
1080 &self,
1081 language: &NSString,
1082 media_selection_group: &AVMediaSelectionGroup,
1083 );
1084
1085 #[cfg(feature = "AVMediaSelectionGroup")]
1086 /// Returns the selected media presentation language for the specified media selection group, if any language has previously been selected via use of -selectMediaPresentationLanguages:forMediaSelectionGroup:.
1087 ///
1088 /// - Parameter mediaSelectionGroup: The media selection group, obtained from the receiver's asset, for which the selected media presentation language is requested.
1089 #[unsafe(method(selectedMediaPresentationLanguageForMediaSelectionGroup:))]
1090 #[unsafe(method_family = none)]
1091 pub unsafe fn selectedMediaPresentationLanguageForMediaSelectionGroup(
1092 &self,
1093 media_selection_group: &AVMediaSelectionGroup,
1094 ) -> Option<Retained<NSString>>;
1095
1096 #[cfg(feature = "AVMediaSelectionGroup")]
1097 /// When the associated AVPlayer's appliesMediaSelectionCriteriaAutomatically property is set to YES, configures the player item to prefer a particular presentation setting, replacing any previous preference for settings of the same media presentation selector.
1098 ///
1099 /// Note that preferences for media characteristics indicated by selected AVMediaPresentationSettings are treated as supplemental to the associated AVPlayer's media selection criteria for the AVMediaSelectionGroup. An AVPlayer's default media selection criteria can also indicate preferences for media characteristics, such as those indicating the availability of accessibility affordances such as audio descriptions, and these media characteristics can be left up to the AVPlayer to manage even when an AVCustomMediaSelectionScheme is in use. But if you wish to do so, you can use AVMediaPresentationSettings offered by a AVCustomMediaSelectionScheme in combination with custom AVPlayerMediaSelectionCriteria.
1100 /// If the specified setting isn't offered by an AVMediaPresentationSelector of the AVCustomMediaSelectionScheme of the specified AVMediaSelectionGroup, no change in the presentation of the media will result.
1101 /// This method has no effect when the associated AVPlayer's appliesMediaSelectionCriteriaAutomatically property has a value of NO, in which case you must use -selectMediaOption:inMediaSelectionGroup: instead in order to alter the presentation state of the media.
1102 ///
1103 /// - Parameter mediaPresentationSetting: The setting to select.
1104 /// - Parameter mediaSelectionGroup: The media selection group, obtained from the receiver's asset, to which the specified setting is to be applied.
1105 #[unsafe(method(selectMediaPresentationSetting:forMediaSelectionGroup:))]
1106 #[unsafe(method_family = none)]
1107 pub unsafe fn selectMediaPresentationSetting_forMediaSelectionGroup(
1108 &self,
1109 media_presentation_setting: &AVMediaPresentationSetting,
1110 media_selection_group: &AVMediaSelectionGroup,
1111 );
1112
1113 #[cfg(feature = "AVMediaSelectionGroup")]
1114 /// Indicates the media presentation settings that have most recently been selected for each AVMediaPresentationSelector of the AVCustomMediaSelectionScheme of the specified AVMediaSelectionGroup.
1115 ///
1116 /// - Parameter mediaSelectionGroup: An AVMediaSelectionGroup obtained from the receiver's asset for which the currently selected media presentation settings are desired.
1117 ///
1118 /// - Returns: A dictionary with AVMediaPresentationSelectors as keys and AVMediaPresentationSettings as values, providing the most recently selected setting for each selector or, if no setting has previously been selected, NSNull.
1119 #[unsafe(method(selectedMediaPresentationSettingsForMediaSelectionGroup:))]
1120 #[unsafe(method_family = none)]
1121 pub unsafe fn selectedMediaPresentationSettingsForMediaSelectionGroup(
1122 &self,
1123 media_selection_group: &AVMediaSelectionGroup,
1124 ) -> Retained<NSDictionary<AVMediaPresentationSelector, AnyObject>>;
1125
1126 #[cfg(feature = "AVMediaSelectionGroup")]
1127 /// Indicates the media presentation settings with media characteristics that are possessed by the currently selected AVMediaSelectionOption in the specified AVMediaSelectionGroup.
1128 ///
1129 /// Effective media presentation settings can differ from the currently effective media presentation settings if no AVMediaSelectionOption of the specified AVMediaSelectionGroup with the currently selected media presentation language possesses all of the characteristics associated with the currently selected settings.
1130 /// A value of NSNull for an AVMediaPresentationSelector can occur if either the content is inappropriately authored for the use of the AVCustomMediaSelectionScheme or if the currently selected AVMediaSelectionOption has been selected by means other than through the use of AVMediaPresentationSettings.
1131 ///
1132 /// - Parameter mediaSelectionGroup: An AVMediaSelectionGroup obtained from the receiver's asset for which the currently effective media presentation settings are desired.
1133 ///
1134 /// - Returns: A dictionary with AVMediaPresentationSelectors as keys and AVMediaPresentationSettings as values, unless the AVMediaSelectionOption currently selected in the group possesses none of the characteristics associated with the selector's settings. In that case the dictionary value will be NSNull.
1135 #[unsafe(method(effectiveMediaPresentationSettingsForMediaSelectionGroup:))]
1136 #[unsafe(method_family = none)]
1137 pub unsafe fn effectiveMediaPresentationSettingsForMediaSelectionGroup(
1138 &self,
1139 media_selection_group: &AVMediaSelectionGroup,
1140 ) -> Retained<NSDictionary<AVMediaPresentationSelector, AnyObject>>;
1141 );
1142}
1143
1144/// AVPlayerItemLogging.
1145impl AVPlayerItem {
1146 extern_methods!(
1147 /// Returns an object that represents a snapshot of the network access log. Can be nil.
1148 ///
1149 /// An AVPlayerItemAccessLog provides methods to retrieve the network access log in a format suitable for serialization.
1150 /// If nil is returned then there is no logging information currently available for this AVPlayerItem.
1151 /// 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.
1152 ///
1153 /// In certain situations, this method may temporarily block the calling thread during the ongoing log collection process.
1154 /// It is strongly recommended that the caller take appropriate measures to prevent blocking essential services such as the user interface, for example, by avoiding calling this method in the main thread.
1155 ///
1156 /// - Returns: An autoreleased AVPlayerItemAccessLog instance.
1157 #[unsafe(method(accessLog))]
1158 #[unsafe(method_family = none)]
1159 pub unsafe fn accessLog(&self) -> Option<Retained<AVPlayerItemAccessLog>>;
1160
1161 /// Returns an object that represents a snapshot of the error log. Can be nil.
1162 ///
1163 /// An AVPlayerItemErrorLog provides methods to retrieve the error log in a format suitable for serialization.
1164 /// If nil is returned then there is no logging information currently available for this AVPlayerItem.
1165 ///
1166 /// In certain situations, this method may temporarily block the calling thread during the ongoing log collection process.
1167 /// It is strongly recommended that the caller take appropriate measures to prevent blocking essential services such as the user interface, for example, by avoiding calling this method in the main thread.
1168 ///
1169 /// - Returns: An autoreleased AVPlayerItemErrorLog instance.
1170 #[unsafe(method(errorLog))]
1171 #[unsafe(method_family = none)]
1172 pub unsafe fn errorLog(&self) -> Option<Retained<AVPlayerItemErrorLog>>;
1173 );
1174}
1175
1176/// AVPlayerItemOutputs.
1177impl AVPlayerItem {
1178 extern_methods!(
1179 #[cfg(feature = "AVPlayerItemOutput")]
1180 /// Adds the specified instance of AVPlayerItemOutput to the receiver's collection of outputs.
1181 ///
1182 /// The class of AVPlayerItemOutput provided dictates the data structure that decoded samples are vended in.
1183 ///
1184 /// 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.
1185 ///
1186 /// - Parameter output: An instance of AVPlayerItemOutput
1187 #[unsafe(method(addOutput:))]
1188 #[unsafe(method_family = none)]
1189 pub unsafe fn addOutput(&self, output: &AVPlayerItemOutput);
1190
1191 #[cfg(feature = "AVPlayerItemOutput")]
1192 /// Removes the specified instance of AVPlayerItemOutput from the receiver's collection of outputs.
1193 ///
1194 /// - Parameter output: An instance of AVPlayerItemOutput
1195 #[unsafe(method(removeOutput:))]
1196 #[unsafe(method_family = none)]
1197 pub unsafe fn removeOutput(&self, output: &AVPlayerItemOutput);
1198
1199 #[cfg(feature = "AVPlayerItemOutput")]
1200 /// The collection of associated outputs.
1201 #[unsafe(method(outputs))]
1202 #[unsafe(method_family = none)]
1203 pub unsafe fn outputs(&self) -> Retained<NSArray<AVPlayerItemOutput>>;
1204 );
1205}
1206
1207/// AVPlayerItemMediaDataCollectors.
1208impl AVPlayerItem {
1209 extern_methods!(
1210 #[cfg(feature = "AVPlayerItemMediaDataCollector")]
1211 /// Adds the specified instance of AVPlayerItemMediaDataCollector to the receiver's collection of mediaDataCollectors.
1212 ///
1213 /// This method may incur additional I/O to collect the requested media data asynchronously.
1214 ///
1215 /// - Parameter collector: An instance of AVPlayerItemMediaDataCollector
1216 #[unsafe(method(addMediaDataCollector:))]
1217 #[unsafe(method_family = none)]
1218 pub unsafe fn addMediaDataCollector(&self, collector: &AVPlayerItemMediaDataCollector);
1219
1220 #[cfg(feature = "AVPlayerItemMediaDataCollector")]
1221 /// Removes the specified instance of AVPlayerItemMediaDataCollector from the receiver's collection of mediaDataCollectors.
1222 ///
1223 /// - Parameter collector: An instance of AVPlayerItemMediaDataCollector
1224 #[unsafe(method(removeMediaDataCollector:))]
1225 #[unsafe(method_family = none)]
1226 pub unsafe fn removeMediaDataCollector(&self, collector: &AVPlayerItemMediaDataCollector);
1227
1228 #[cfg(feature = "AVPlayerItemMediaDataCollector")]
1229 /// The collection of associated mediaDataCollectors.
1230 #[unsafe(method(mediaDataCollectors))]
1231 #[unsafe(method_family = none)]
1232 pub unsafe fn mediaDataCollectors(
1233 &self,
1234 ) -> Retained<NSArray<AVPlayerItemMediaDataCollector>>;
1235 );
1236}
1237
1238/// AVPlayerItemDeprecated.
1239impl AVPlayerItem {
1240 extern_methods!(
1241 #[cfg(feature = "objc2-core-media")]
1242 /// Moves the playback cursor.
1243 ///
1244 /// Use this method to seek to a specified time for the item.
1245 /// The time seeked to may differ from the specified time for efficiency. For sample accurate seeking see seekToTime:toleranceBefore:toleranceAfter:.
1246 /// If the seek time is outside of seekable time ranges as indicated by seekableTimeRanges property, the seek request will be cancelled.
1247 ///
1248 /// - Parameter time:
1249 #[deprecated = "Use -seekToTime:completionHandler:, passing nil for the completionHandler if you don't require notification of completion"]
1250 #[unsafe(method(seekToTime:))]
1251 #[unsafe(method_family = none)]
1252 pub unsafe fn seekToTime(&self, time: CMTime);
1253
1254 #[cfg(feature = "objc2-core-media")]
1255 /// Moves the playback cursor within a specified time bound.
1256 ///
1257 /// Use this method to seek to a specified time for the item.
1258 /// The time seeked to will be within the range [time-toleranceBefore, time+toleranceAfter] and may differ from the specified time for efficiency.
1259 /// Pass kCMTimeZero for both toleranceBefore and toleranceAfter to request sample accurate seeking which may incur additional decoding delay.
1260 /// Messaging this method with beforeTolerance:kCMTimePositiveInfinity and afterTolerance:kCMTimePositiveInfinity is the same as messaging seekToTime: directly.
1261 /// 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
1262 /// within the seekable ranges.
1263 /// If the seek time is outside of seekable time ranges as indicated by seekableTimeRanges property, the seek request will be cancelled.
1264 ///
1265 /// - Parameter time:
1266 /// - Parameter toleranceBefore:
1267 /// - Parameter toleranceAfter:
1268 #[deprecated = "Use -seekToTime:toleranceBefore:toleranceAfter:completionHandler:, passing nil for the completionHandler if you don't require notification of completion"]
1269 #[unsafe(method(seekToTime:toleranceBefore:toleranceAfter:))]
1270 #[unsafe(method_family = none)]
1271 pub unsafe fn seekToTime_toleranceBefore_toleranceAfter(
1272 &self,
1273 time: CMTime,
1274 tolerance_before: CMTime,
1275 tolerance_after: CMTime,
1276 );
1277
1278 /// move playhead to a point corresponding to a particular date.
1279 ///
1280 /// For playback content that is associated with a range of dates, move the
1281 /// playhead to point within that range. Will fail if the supplied date is outside
1282 /// the range or if the content is not associated with a range of dates.
1283 ///
1284 /// - Parameter date: The new position for the playhead.
1285 ///
1286 /// - Returns: Returns true if the playhead was moved to the supplied date.
1287 #[deprecated = "Use -seekToDate:completionHandler:, passing nil for the completionHandler if you don't require notification of completion"]
1288 #[unsafe(method(seekToDate:))]
1289 #[unsafe(method_family = none)]
1290 pub unsafe fn seekToDate(&self, date: &NSDate) -> bool;
1291
1292 #[cfg(feature = "AVMediaSelectionGroup")]
1293 /// Indicates the media selection option that's currently selected from the specified group. May be nil.
1294 ///
1295 /// If the value of the property allowsEmptySelection of the AVMediaSelectionGroup is YES, the currently selected option in the group may be nil.
1296 ///
1297 /// - Parameter mediaSelectionGroup: A media selection group obtained from the receiver's asset.
1298 ///
1299 /// - Returns: An instance of AVMediaSelectionOption that describes the currently selection option in the group.
1300 #[deprecated = "Use currentMediaSelection to obtain an instance of AVMediaSelection, which encompasses the currently selected AVMediaSelectionOption in each of the available AVMediaSelectionGroups"]
1301 #[unsafe(method(selectedMediaOptionInMediaSelectionGroup:))]
1302 #[unsafe(method_family = none)]
1303 pub unsafe fn selectedMediaOptionInMediaSelectionGroup(
1304 &self,
1305 media_selection_group: &AVMediaSelectionGroup,
1306 ) -> Option<Retained<AVMediaSelectionOption>>;
1307 );
1308}
1309
1310extern_class!(
1311 /// An AVPlayerItemAccessLog provides methods to retrieve the access log in a format suitable for serialization.
1312 ///
1313 /// An AVPlayerItemAccessLog acculumulates key metrics about network playback and presents them as a collection
1314 /// of AVPlayerItemAccessLogEvent instances. Each AVPlayerItemAccessLogEvent instance collates the data
1315 /// that relates to each uninterrupted period of playback.
1316 ///
1317 /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1318 ///
1319 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemaccesslog?language=objc)
1320 #[unsafe(super(NSObject))]
1321 #[derive(Debug, PartialEq, Eq, Hash)]
1322 pub struct AVPlayerItemAccessLog;
1323);
1324
1325unsafe impl Send for AVPlayerItemAccessLog {}
1326
1327unsafe impl Sync for AVPlayerItemAccessLog {}
1328
1329extern_conformance!(
1330 unsafe impl NSCopying for AVPlayerItemAccessLog {}
1331);
1332
1333unsafe impl CopyingHelper for AVPlayerItemAccessLog {
1334 type Result = Self;
1335}
1336
1337extern_conformance!(
1338 unsafe impl NSObjectProtocol for AVPlayerItemAccessLog {}
1339);
1340
1341impl AVPlayerItemAccessLog {
1342 extern_methods!(
1343 #[unsafe(method(init))]
1344 #[unsafe(method_family = init)]
1345 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1346
1347 #[unsafe(method(new))]
1348 #[unsafe(method_family = new)]
1349 pub unsafe fn new() -> Retained<Self>;
1350
1351 /// Serializes an AVPlayerItemAccessLog in the Extended Log File Format.
1352 ///
1353 /// This method converts the webserver access log into a textual format that conforms to the
1354 /// W3C Extended Log File Format for web server log files.
1355 /// For more information see: http://www.w3.org/pub/WWW/TR/WD-logfile.html
1356 ///
1357 /// - Returns: An autoreleased NSData instance.
1358 #[unsafe(method(extendedLogData))]
1359 #[unsafe(method_family = none)]
1360 pub unsafe fn extendedLogData(&self) -> Option<Retained<NSData>>;
1361
1362 /// Returns the NSStringEncoding for extendedLogData, see above.
1363 ///
1364 /// A string suitable for console output is obtainable by:
1365 /// [[NSString alloc] initWithData:[myLog extendedLogData] encoding:[myLog extendedLogDataStringEncoding]]
1366 ///
1367 /// This property is not atomic.
1368 ///
1369 /// # Safety
1370 ///
1371 /// This might not be thread-safe.
1372 #[unsafe(method(extendedLogDataStringEncoding))]
1373 #[unsafe(method_family = none)]
1374 pub unsafe fn extendedLogDataStringEncoding(&self) -> NSStringEncoding;
1375
1376 /// An ordered collection of AVPlayerItemAccessLogEvent instances.
1377 ///
1378 /// An ordered collection of AVPlayerItemAccessLogEvent instances that represent the chronological
1379 /// sequence of events contained in the access log.
1380 /// This property is not observable.
1381 ///
1382 /// This property is not atomic.
1383 ///
1384 /// # Safety
1385 ///
1386 /// This might not be thread-safe.
1387 #[unsafe(method(events))]
1388 #[unsafe(method_family = none)]
1389 pub unsafe fn events(&self) -> Retained<NSArray<AVPlayerItemAccessLogEvent>>;
1390 );
1391}
1392
1393extern_class!(
1394 /// An AVPlayerItemErrorLog provides methods to retrieve the error log in a format suitable for serialization.
1395 ///
1396 /// An AVPlayerItemErrorLog provides data to identify if, and when, network resource playback failures occured.
1397 ///
1398 /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1399 ///
1400 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemerrorlog?language=objc)
1401 #[unsafe(super(NSObject))]
1402 #[derive(Debug, PartialEq, Eq, Hash)]
1403 pub struct AVPlayerItemErrorLog;
1404);
1405
1406unsafe impl Send for AVPlayerItemErrorLog {}
1407
1408unsafe impl Sync for AVPlayerItemErrorLog {}
1409
1410extern_conformance!(
1411 unsafe impl NSCopying for AVPlayerItemErrorLog {}
1412);
1413
1414unsafe impl CopyingHelper for AVPlayerItemErrorLog {
1415 type Result = Self;
1416}
1417
1418extern_conformance!(
1419 unsafe impl NSObjectProtocol for AVPlayerItemErrorLog {}
1420);
1421
1422impl AVPlayerItemErrorLog {
1423 extern_methods!(
1424 #[unsafe(method(init))]
1425 #[unsafe(method_family = init)]
1426 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1427
1428 #[unsafe(method(new))]
1429 #[unsafe(method_family = new)]
1430 pub unsafe fn new() -> Retained<Self>;
1431
1432 /// Serializes an AVPlayerItemErrorLog in the Extended Log File Format.
1433 ///
1434 /// This method converts the webserver error log into a textual format that conforms to the
1435 /// W3C Extended Log File Format for web server log files.
1436 /// For more information see: http://www.w3.org/pub/WWW/TR/WD-logfile.html
1437 ///
1438 /// - Returns: An autoreleased NSData instance.
1439 #[unsafe(method(extendedLogData))]
1440 #[unsafe(method_family = none)]
1441 pub unsafe fn extendedLogData(&self) -> Option<Retained<NSData>>;
1442
1443 /// Returns the NSStringEncoding for extendedLogData, see above.
1444 ///
1445 /// A string suitable for console output is obtainable by:
1446 /// [[NSString alloc] initWithData:[myLog extendedLogData] encoding:[myLog extendedLogDataStringEncoding]]
1447 ///
1448 /// This property is not atomic.
1449 ///
1450 /// # Safety
1451 ///
1452 /// This might not be thread-safe.
1453 #[unsafe(method(extendedLogDataStringEncoding))]
1454 #[unsafe(method_family = none)]
1455 pub unsafe fn extendedLogDataStringEncoding(&self) -> NSStringEncoding;
1456
1457 /// An ordered collection of AVPlayerItemErrorLogEvent instances.
1458 ///
1459 /// An ordered collection of AVPlayerItemErrorLogEvent instances that represent the chronological
1460 /// sequence of events contained in the error log.
1461 /// This property is not observable.
1462 ///
1463 /// This property is not atomic.
1464 ///
1465 /// # Safety
1466 ///
1467 /// This might not be thread-safe.
1468 #[unsafe(method(events))]
1469 #[unsafe(method_family = none)]
1470 pub unsafe fn events(&self) -> Retained<NSArray<AVPlayerItemErrorLogEvent>>;
1471 );
1472}
1473
1474extern_class!(
1475 /// An AVPlayerItemAccessLogEvent represents a single log entry.
1476 ///
1477 /// An AVPlayerItemAccessLogEvent provides named properties for accessing the data
1478 /// fields of each log event. None of the properties of this class are observable.
1479 ///
1480 /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1481 ///
1482 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemaccesslogevent?language=objc)
1483 #[unsafe(super(NSObject))]
1484 #[derive(Debug, PartialEq, Eq, Hash)]
1485 pub struct AVPlayerItemAccessLogEvent;
1486);
1487
1488unsafe impl Send for AVPlayerItemAccessLogEvent {}
1489
1490unsafe impl Sync for AVPlayerItemAccessLogEvent {}
1491
1492extern_conformance!(
1493 unsafe impl NSCopying for AVPlayerItemAccessLogEvent {}
1494);
1495
1496unsafe impl CopyingHelper for AVPlayerItemAccessLogEvent {
1497 type Result = Self;
1498}
1499
1500extern_conformance!(
1501 unsafe impl NSObjectProtocol for AVPlayerItemAccessLogEvent {}
1502);
1503
1504impl AVPlayerItemAccessLogEvent {
1505 extern_methods!(
1506 #[unsafe(method(init))]
1507 #[unsafe(method_family = init)]
1508 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1509
1510 #[unsafe(method(new))]
1511 #[unsafe(method_family = new)]
1512 pub unsafe fn new() -> Retained<Self>;
1513
1514 /// A count of media segments downloaded.
1515 ///
1516 /// Value is negative if unknown. A count of media segments downloaded from the server to this client. Corresponds to "sc-count".
1517 /// This property is not observable.
1518 /// This property is deprecated. Use numberOfMediaRequests instead.
1519 ///
1520 /// This property is not atomic.
1521 ///
1522 /// # Safety
1523 ///
1524 /// This might not be thread-safe.
1525 #[deprecated]
1526 #[unsafe(method(numberOfSegmentsDownloaded))]
1527 #[unsafe(method_family = none)]
1528 pub unsafe fn numberOfSegmentsDownloaded(&self) -> NSInteger;
1529
1530 /// A count of media read requests.
1531 ///
1532 /// Value is negative if unknown. A count of media read requests from the server to this client. Corresponds to "sc-count".
1533 /// For HTTP live Streaming, a count of media segments downloaded from the server to this client.
1534 /// For progressive-style HTTP media downloads, a count of HTTP GET (byte-range) requests for the resource.
1535 /// This property is not observable.
1536 ///
1537 /// This property is not atomic.
1538 ///
1539 /// # Safety
1540 ///
1541 /// This might not be thread-safe.
1542 #[unsafe(method(numberOfMediaRequests))]
1543 #[unsafe(method_family = none)]
1544 pub unsafe fn numberOfMediaRequests(&self) -> NSInteger;
1545
1546 /// The date/time at which playback began for this event. Can be nil.
1547 ///
1548 /// If nil is returned the date is unknown. Corresponds to "date".
1549 /// This property is not observable.
1550 ///
1551 /// This property is not atomic.
1552 ///
1553 /// # Safety
1554 ///
1555 /// This might not be thread-safe.
1556 #[unsafe(method(playbackStartDate))]
1557 #[unsafe(method_family = none)]
1558 pub unsafe fn playbackStartDate(&self) -> Option<Retained<NSDate>>;
1559
1560 /// The URI of the playback item. Can be nil.
1561 ///
1562 /// If nil is returned the URI is unknown. Corresponds to "uri".
1563 /// This property is not observable.
1564 ///
1565 /// This property is not atomic.
1566 ///
1567 /// # Safety
1568 ///
1569 /// This might not be thread-safe.
1570 #[unsafe(method(URI))]
1571 #[unsafe(method_family = none)]
1572 pub unsafe fn URI(&self) -> Option<Retained<NSString>>;
1573
1574 /// The IP address of the server that was the source of the last delivered media segment. Can be nil.
1575 ///
1576 /// If nil is returned the address is unknown. Can be either an IPv4 or IPv6 address. Corresponds to "s-ip".
1577 /// This property is not observable.
1578 ///
1579 /// This property is not atomic.
1580 ///
1581 /// # Safety
1582 ///
1583 /// This might not be thread-safe.
1584 #[unsafe(method(serverAddress))]
1585 #[unsafe(method_family = none)]
1586 pub unsafe fn serverAddress(&self) -> Option<Retained<NSString>>;
1587
1588 /// A count of changes to the property serverAddress, see above, over the last uninterrupted period of playback.
1589 ///
1590 /// Value is negative if unknown. Corresponds to "s-ip-changes".
1591 /// This property is not observable.
1592 ///
1593 /// This property is not atomic.
1594 ///
1595 /// # Safety
1596 ///
1597 /// This might not be thread-safe.
1598 #[unsafe(method(numberOfServerAddressChanges))]
1599 #[unsafe(method_family = none)]
1600 pub unsafe fn numberOfServerAddressChanges(&self) -> NSInteger;
1601
1602 /// A GUID that identifies the playback session. This value is used in HTTP requests. Can be nil.
1603 ///
1604 /// If nil is returned the GUID is unknown. Corresponds to "cs-guid".
1605 /// This property is not observable.
1606 ///
1607 /// This property is not atomic.
1608 ///
1609 /// # Safety
1610 ///
1611 /// This might not be thread-safe.
1612 #[unsafe(method(playbackSessionID))]
1613 #[unsafe(method_family = none)]
1614 pub unsafe fn playbackSessionID(&self) -> Option<Retained<NSString>>;
1615
1616 /// An offset into the playlist where the last uninterrupted period of playback began. Measured in seconds.
1617 ///
1618 /// Value is negative if unknown. Corresponds to "c-start-time".
1619 /// This property is not observable.
1620 ///
1621 /// This property is not atomic.
1622 ///
1623 /// # Safety
1624 ///
1625 /// This might not be thread-safe.
1626 #[unsafe(method(playbackStartOffset))]
1627 #[unsafe(method_family = none)]
1628 pub unsafe fn playbackStartOffset(&self) -> NSTimeInterval;
1629
1630 /// The accumulated duration of the media downloaded. Measured in seconds.
1631 ///
1632 /// Value is negative if unknown. Corresponds to "c-duration-downloaded".
1633 /// This property is not observable.
1634 ///
1635 /// This property is not atomic.
1636 ///
1637 /// # Safety
1638 ///
1639 /// This might not be thread-safe.
1640 #[unsafe(method(segmentsDownloadedDuration))]
1641 #[unsafe(method_family = none)]
1642 pub unsafe fn segmentsDownloadedDuration(&self) -> NSTimeInterval;
1643
1644 /// The accumulated duration of the media played. Measured in seconds.
1645 ///
1646 /// Value is negative if unknown. Corresponds to "c-duration-watched".
1647 /// This property is not observable.
1648 ///
1649 /// This property is not atomic.
1650 ///
1651 /// # Safety
1652 ///
1653 /// This might not be thread-safe.
1654 #[unsafe(method(durationWatched))]
1655 #[unsafe(method_family = none)]
1656 pub unsafe fn durationWatched(&self) -> NSTimeInterval;
1657
1658 /// The total number of playback stalls encountered.
1659 ///
1660 /// Value is negative if unknown. Corresponds to "c-stalls".
1661 /// This property is not observable.
1662 ///
1663 /// This property is not atomic.
1664 ///
1665 /// # Safety
1666 ///
1667 /// This might not be thread-safe.
1668 #[unsafe(method(numberOfStalls))]
1669 #[unsafe(method_family = none)]
1670 pub unsafe fn numberOfStalls(&self) -> NSInteger;
1671
1672 /// The accumulated number of bytes transferred.
1673 ///
1674 /// Value is negative if unknown. Corresponds to "bytes".
1675 /// This property is not observable.
1676 ///
1677 /// This property is not atomic.
1678 ///
1679 /// # Safety
1680 ///
1681 /// This might not be thread-safe.
1682 #[unsafe(method(numberOfBytesTransferred))]
1683 #[unsafe(method_family = none)]
1684 pub unsafe fn numberOfBytesTransferred(&self) -> c_longlong;
1685
1686 /// The accumulated duration of active network transfer of bytes. Measured in seconds.
1687 ///
1688 /// Value is negative if unknown. Corresponds to "c-transfer-duration".
1689 /// This property is not observable.
1690 ///
1691 /// This property is not atomic.
1692 ///
1693 /// # Safety
1694 ///
1695 /// This might not be thread-safe.
1696 #[unsafe(method(transferDuration))]
1697 #[unsafe(method_family = none)]
1698 pub unsafe fn transferDuration(&self) -> NSTimeInterval;
1699
1700 /// The empirical throughput across all media downloaded. Measured in bits per second.
1701 ///
1702 /// Value is negative if unknown. Corresponds to "c-observed-bitrate".
1703 /// This property is not observable.
1704 ///
1705 /// This property is not atomic.
1706 ///
1707 /// # Safety
1708 ///
1709 /// This might not be thread-safe.
1710 #[unsafe(method(observedBitrate))]
1711 #[unsafe(method_family = none)]
1712 pub unsafe fn observedBitrate(&self) -> c_double;
1713
1714 /// The throughput required to play the stream, as advertised by the server. Measured in bits per second.
1715 ///
1716 /// Value is negative if unknown. Corresponds to "sc-indicated-bitrate".
1717 /// This property is not observable.
1718 ///
1719 /// This property is not atomic.
1720 ///
1721 /// # Safety
1722 ///
1723 /// This might not be thread-safe.
1724 #[unsafe(method(indicatedBitrate))]
1725 #[unsafe(method_family = none)]
1726 pub unsafe fn indicatedBitrate(&self) -> c_double;
1727
1728 /// Average throughput required to play the stream, as advertised by the server. Measured in bits per second.
1729 ///
1730 /// Value is negative if unknown. Corresponds to "sc-indicated-avg-bitrate".
1731 /// This property is not observable.
1732 ///
1733 /// This property is not atomic.
1734 ///
1735 /// # Safety
1736 ///
1737 /// This might not be thread-safe.
1738 #[unsafe(method(indicatedAverageBitrate))]
1739 #[unsafe(method_family = none)]
1740 pub unsafe fn indicatedAverageBitrate(&self) -> c_double;
1741
1742 /// The average bitrate of video track if it is unmuxed. Average bitrate of combined content if muxed. Measured in bits per second.
1743 ///
1744 /// Value is negative if unknown. Corresponds to "c-avg-video-bitrate".
1745 /// This property is not observable.
1746 ///
1747 /// This property is not atomic.
1748 ///
1749 /// # Safety
1750 ///
1751 /// This might not be thread-safe.
1752 #[unsafe(method(averageVideoBitrate))]
1753 #[unsafe(method_family = none)]
1754 pub unsafe fn averageVideoBitrate(&self) -> c_double;
1755
1756 /// The average bitrate of audio track. This is not available if audio is muxed with video. Measured in bits per second.
1757 ///
1758 /// Value is negative if unknown. Corresponds to "c-avg-audio-bitrate".
1759 /// This property is not observable.
1760 ///
1761 /// This property is not atomic.
1762 ///
1763 /// # Safety
1764 ///
1765 /// This might not be thread-safe.
1766 #[unsafe(method(averageAudioBitrate))]
1767 #[unsafe(method_family = none)]
1768 pub unsafe fn averageAudioBitrate(&self) -> c_double;
1769
1770 /// The total number of dropped video frames.
1771 ///
1772 /// Value is negative if unknown. Corresponds to "c-frames-dropped".
1773 /// This property is not observable.
1774 ///
1775 /// This property is not atomic.
1776 ///
1777 /// # Safety
1778 ///
1779 /// This might not be thread-safe.
1780 #[unsafe(method(numberOfDroppedVideoFrames))]
1781 #[unsafe(method_family = none)]
1782 pub unsafe fn numberOfDroppedVideoFrames(&self) -> NSInteger;
1783
1784 /// The accumulated duration until player item is ready to play. Measured in seconds.
1785 ///
1786 /// Value is negative if unknown. Corresponds to "c-startup-time".
1787 /// This property is not observable.
1788 ///
1789 /// This property is not atomic.
1790 ///
1791 /// # Safety
1792 ///
1793 /// This might not be thread-safe.
1794 #[unsafe(method(startupTime))]
1795 #[unsafe(method_family = none)]
1796 pub unsafe fn startupTime(&self) -> NSTimeInterval;
1797
1798 /// The total number of times the download of the segments took too long.
1799 ///
1800 /// Value is negative if unknown. Corresponds to "c-overdue".
1801 /// This property is not observable.
1802 ///
1803 /// This property is not atomic.
1804 ///
1805 /// # Safety
1806 ///
1807 /// This might not be thread-safe.
1808 #[unsafe(method(downloadOverdue))]
1809 #[unsafe(method_family = none)]
1810 pub unsafe fn downloadOverdue(&self) -> NSInteger;
1811
1812 /// Maximum observed segment download bit rate.
1813 ///
1814 /// Value is negative if unknown. Corresponds to "c-observed-max-bitrate".
1815 /// This property is not observable.
1816 ///
1817 /// This property is not atomic.
1818 ///
1819 /// # Safety
1820 ///
1821 /// This might not be thread-safe.
1822 #[deprecated = "Use observedBitrateStandardDeviation to monitor variance in network bitrate."]
1823 #[unsafe(method(observedMaxBitrate))]
1824 #[unsafe(method_family = none)]
1825 pub unsafe fn observedMaxBitrate(&self) -> c_double;
1826
1827 /// Minimum observed segment download bit rate.
1828 ///
1829 /// Value is negative if unknown. Corresponds to "c-observed-min-bitrate".
1830 /// This property is not observable.
1831 ///
1832 /// This property is not atomic.
1833 ///
1834 /// # Safety
1835 ///
1836 /// This might not be thread-safe.
1837 #[deprecated = "Use observedBitrateStandardDeviation to monitor variance in network bitrate."]
1838 #[unsafe(method(observedMinBitrate))]
1839 #[unsafe(method_family = none)]
1840 pub unsafe fn observedMinBitrate(&self) -> c_double;
1841
1842 /// Standard deviation of observed segment download bit rates.
1843 ///
1844 /// Value is negative if unknown. Corresponds to "c-observed-bitrate-sd".
1845 /// This property is not observable.
1846 ///
1847 /// This property is not atomic.
1848 ///
1849 /// # Safety
1850 ///
1851 /// This might not be thread-safe.
1852 #[unsafe(method(observedBitrateStandardDeviation))]
1853 #[unsafe(method_family = none)]
1854 pub unsafe fn observedBitrateStandardDeviation(&self) -> c_double;
1855
1856 /// Playback type (LIVE, VOD, FILE).
1857 ///
1858 /// If nil is returned the playback type is unknown. Corresponds to "s-playback-type".
1859 /// This property is not observable.
1860 ///
1861 /// This property is not atomic.
1862 ///
1863 /// # Safety
1864 ///
1865 /// This might not be thread-safe.
1866 #[unsafe(method(playbackType))]
1867 #[unsafe(method_family = none)]
1868 pub unsafe fn playbackType(&self) -> Option<Retained<NSString>>;
1869
1870 /// Number of network read requests over WWAN.
1871 ///
1872 /// Value is negative if unknown. Corresponds to "sc-wwan-count".
1873 /// This property is not observable.
1874 ///
1875 /// This property is not atomic.
1876 ///
1877 /// # Safety
1878 ///
1879 /// This might not be thread-safe.
1880 #[unsafe(method(mediaRequestsWWAN))]
1881 #[unsafe(method_family = none)]
1882 pub unsafe fn mediaRequestsWWAN(&self) -> NSInteger;
1883
1884 /// Bandwidth that caused us to switch (up or down).
1885 ///
1886 /// Value is negative if unknown. Corresponds to "c-switch-bitrate".
1887 /// This property is not observable.
1888 ///
1889 /// This property is not atomic.
1890 ///
1891 /// # Safety
1892 ///
1893 /// This might not be thread-safe.
1894 #[unsafe(method(switchBitrate))]
1895 #[unsafe(method_family = none)]
1896 pub unsafe fn switchBitrate(&self) -> c_double;
1897 );
1898}
1899
1900extern_class!(
1901 /// An AVPlayerItemErrorLogEvent represents a single log entry.
1902 ///
1903 /// An AVPlayerItemErrorLogEvent provides named properties for accessing the data
1904 /// fields of each log event. None of the properties of this class are observable.
1905 ///
1906 /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
1907 ///
1908 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayeritemerrorlogevent?language=objc)
1909 #[unsafe(super(NSObject))]
1910 #[derive(Debug, PartialEq, Eq, Hash)]
1911 pub struct AVPlayerItemErrorLogEvent;
1912);
1913
1914unsafe impl Send for AVPlayerItemErrorLogEvent {}
1915
1916unsafe impl Sync for AVPlayerItemErrorLogEvent {}
1917
1918extern_conformance!(
1919 unsafe impl NSCopying for AVPlayerItemErrorLogEvent {}
1920);
1921
1922unsafe impl CopyingHelper for AVPlayerItemErrorLogEvent {
1923 type Result = Self;
1924}
1925
1926extern_conformance!(
1927 unsafe impl NSObjectProtocol for AVPlayerItemErrorLogEvent {}
1928);
1929
1930impl AVPlayerItemErrorLogEvent {
1931 extern_methods!(
1932 #[unsafe(method(init))]
1933 #[unsafe(method_family = init)]
1934 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1935
1936 #[unsafe(method(new))]
1937 #[unsafe(method_family = new)]
1938 pub unsafe fn new() -> Retained<Self>;
1939
1940 /// The date and time when the error occured. Can be nil.
1941 ///
1942 /// If nil is returned the date is unknown. Corresponds to "date".
1943 /// This property is not observable.
1944 ///
1945 /// This property is not atomic.
1946 ///
1947 /// # Safety
1948 ///
1949 /// This might not be thread-safe.
1950 #[unsafe(method(date))]
1951 #[unsafe(method_family = none)]
1952 pub unsafe fn date(&self) -> Option<Retained<NSDate>>;
1953
1954 /// The URI of the playback item. Can be nil.
1955 ///
1956 /// If nil is returned the URI is unknown. Corresponds to "uri".
1957 /// This property is not observable.
1958 ///
1959 /// This property is not atomic.
1960 ///
1961 /// # Safety
1962 ///
1963 /// This might not be thread-safe.
1964 #[unsafe(method(URI))]
1965 #[unsafe(method_family = none)]
1966 pub unsafe fn URI(&self) -> Option<Retained<NSString>>;
1967
1968 /// The IP address of the server that was the source of the error. Can be nil.
1969 ///
1970 /// If nil is returned the address is unknown. Can be either an IPv4 or IPv6 address. Corresponds to "s-ip".
1971 /// This property is not observable.
1972 ///
1973 /// This property is not atomic.
1974 ///
1975 /// # Safety
1976 ///
1977 /// This might not be thread-safe.
1978 #[unsafe(method(serverAddress))]
1979 #[unsafe(method_family = none)]
1980 pub unsafe fn serverAddress(&self) -> Option<Retained<NSString>>;
1981
1982 /// A GUID that identifies the playback session. This value is used in HTTP requests. Can be nil.
1983 ///
1984 /// If nil is returned the GUID is unknown. Corresponds to "cs-guid".
1985 /// This property is not observable.
1986 ///
1987 /// This property is not atomic.
1988 ///
1989 /// # Safety
1990 ///
1991 /// This might not be thread-safe.
1992 #[unsafe(method(playbackSessionID))]
1993 #[unsafe(method_family = none)]
1994 pub unsafe fn playbackSessionID(&self) -> Option<Retained<NSString>>;
1995
1996 /// A unique error code identifier.
1997 ///
1998 /// Corresponds to "status".
1999 /// This property is not observable.
2000 ///
2001 /// This property is not atomic.
2002 ///
2003 /// # Safety
2004 ///
2005 /// This might not be thread-safe.
2006 #[unsafe(method(errorStatusCode))]
2007 #[unsafe(method_family = none)]
2008 pub unsafe fn errorStatusCode(&self) -> NSInteger;
2009
2010 /// The domain of the error.
2011 ///
2012 /// Corresponds to "domain".
2013 /// This property is not observable.
2014 ///
2015 /// This property is not atomic.
2016 ///
2017 /// # Safety
2018 ///
2019 /// This might not be thread-safe.
2020 #[unsafe(method(errorDomain))]
2021 #[unsafe(method_family = none)]
2022 pub unsafe fn errorDomain(&self) -> Retained<NSString>;
2023
2024 /// A description of the error encountered. Can be nil.
2025 ///
2026 /// If nil is returned further information is not available. Corresponds to "comment".
2027 /// This property is not observable.
2028 ///
2029 /// This property is not atomic.
2030 ///
2031 /// # Safety
2032 ///
2033 /// This might not be thread-safe.
2034 #[unsafe(method(errorComment))]
2035 #[unsafe(method_family = none)]
2036 pub unsafe fn errorComment(&self) -> Option<Retained<NSString>>;
2037
2038 /// The HTTP header fields returned by the server, if an HTTP response was received as part of this error.
2039 ///
2040 /// See -[NSHTTPURLResponse allHeaderFields] for more information.
2041 ///
2042 /// This property is not atomic.
2043 ///
2044 /// # Safety
2045 ///
2046 /// This might not be thread-safe.
2047 #[unsafe(method(allHTTPResponseHeaderFields))]
2048 #[unsafe(method_family = none)]
2049 pub unsafe fn allHTTPResponseHeaderFields(
2050 &self,
2051 ) -> Option<Retained<NSDictionary<NSString, NSString>>>;
2052 );
2053}
2054
2055/// AVMetricEventStreamPublisher.
2056impl AVPlayerItem {
2057 extern_methods!();
2058}
2059
2060#[cfg(feature = "AVMetrics")]
2061extern_conformance!(
2062 unsafe impl AVMetricEventStreamPublisher for AVPlayerItem {}
2063);