objc2_av_foundation/generated/AVPlayerInterstitialEventController.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-media")]
7use objc2_core_media::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// These constants can be specified when creating AVPlayerInterstitialEvents in order to configure their behavior.
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventrestrictions?language=objc)
15// NS_OPTIONS
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct AVPlayerInterstitialEventRestrictions(pub NSUInteger);
19bitflags::bitflags! {
20 impl AVPlayerInterstitialEventRestrictions: NSUInteger {
21/// Indicates that the user may freely employ playback controls, as available, both within the primary content and in the interstitial content specified for the event.
22 #[doc(alias = "AVPlayerInterstitialEventRestrictionNone")]
23 const None = 0;
24/// Indicates that seeking within the primary content from a date prior to the date of the event to a date subsequent to the date of the event is not permitted.
25 #[doc(alias = "AVPlayerInterstitialEventRestrictionConstrainsSeekingForwardInPrimaryContent")]
26 const ConstrainsSeekingForwardInPrimaryContent = 1<<0;
27/// Indicates that advancing the currentTime within an interstitial item, either by seeking ahead or by setting the playback rate to a value greater than the item's asset's preferredRate, is not permitted.
28 #[doc(alias = "AVPlayerInterstitialEventRestrictionRequiresPlaybackAtPreferredRateForAdvancement")]
29 const RequiresPlaybackAtPreferredRateForAdvancement = 1<<2;
30/// Indicates that advancing the currentTime within an interstitial item, either by seeking ahead or by setting the playback rate to a value greater than the item's asset's preferredRate, is not permitted.
31 #[doc(alias = "AVPlayerInterstitialEventRestrictionDefaultPolicy")]
32 const DefaultPolicy = AVPlayerInterstitialEventRestrictions::None.0;
33 }
34}
35
36unsafe impl Encode for AVPlayerInterstitialEventRestrictions {
37 const ENCODING: Encoding = NSUInteger::ENCODING;
38}
39
40unsafe impl RefEncode for AVPlayerInterstitialEventRestrictions {
41 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
42}
43
44/// A particular cue can be specified when creating AVPlayerInterstitialEvents to override the start time/date to a predefined position.
45///
46/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventcue?language=objc)
47// NS_TYPED_ENUM
48pub type AVPlayerInterstitialEventCue = NSString;
49
50extern "C" {
51 /// No cue specified; event playback should start at event time (or date).
52 ///
53 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventnocue?language=objc)
54 pub static AVPlayerInterstitialEventNoCue: &'static AVPlayerInterstitialEventCue;
55}
56
57extern "C" {
58 /// Event playback should occur before starting primary playback, regardless of initial primary playback position.
59 ///
60 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventjoincue?language=objc)
61 pub static AVPlayerInterstitialEventJoinCue: &'static AVPlayerInterstitialEventCue;
62}
63
64extern "C" {
65 /// Event playback should occur after primary playback ends without error, either at the end of the primary asset or at the client-specified forward playback end time.
66 ///
67 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventleavecue?language=objc)
68 pub static AVPlayerInterstitialEventLeaveCue: &'static AVPlayerInterstitialEventCue;
69}
70
71/// These constants specify how an event occupies time on AVPlayerItemIntegratedTimeline.
72///
73/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventtimelineoccupancy?language=objc)
74// NS_ENUM
75#[repr(transparent)]
76#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
77pub struct AVPlayerInterstitialEventTimelineOccupancy(pub NSInteger);
78impl AVPlayerInterstitialEventTimelineOccupancy {
79 /// Indicates this interstitial event occupies a single point on AVPlayerItemIntegratedTimeline.
80 #[doc(alias = "AVPlayerInterstitialEventTimelineOccupancySinglePoint")]
81 pub const SinglePoint: Self = Self(0);
82 /// Indicates this interstitial event fills AVPlayerItemIntegratedTimeline with the duration of this event.
83 #[doc(alias = "AVPlayerInterstitialEventTimelineOccupancyFill")]
84 pub const Fill: Self = Self(1);
85}
86
87unsafe impl Encode for AVPlayerInterstitialEventTimelineOccupancy {
88 const ENCODING: Encoding = NSInteger::ENCODING;
89}
90
91unsafe impl RefEncode for AVPlayerInterstitialEventTimelineOccupancy {
92 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
93}
94
95/// These constants describe the status of the asset list response for an AVPlayerInterstitialEvent.
96///
97/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventassetlistresponsestatus?language=objc)
98// NS_ENUM
99#[repr(transparent)]
100#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
101pub struct AVPlayerInterstitialEventAssetListResponseStatus(pub NSInteger);
102impl AVPlayerInterstitialEventAssetListResponseStatus {
103 /// Indicates that the asset list response is now available and non-nil, meaning the asset list read was successful.
104 #[doc(alias = "AVPlayerInterstitialEventAssetListResponseStatusAvailable")]
105 pub const Available: Self = Self(0);
106 /// Indicates that asset list response has been cleared and reverted to its original state of nil.
107 #[doc(alias = "AVPlayerInterstitialEventAssetListResponseStatusCleared")]
108 pub const Cleared: Self = Self(1);
109 /// Indicates that the asset list response is unavailable, meaning the asset list read failed.
110 #[doc(alias = "AVPlayerInterstitialEventAssetListResponseStatusUnavailable")]
111 pub const Unavailable: Self = Self(2);
112}
113
114unsafe impl Encode for AVPlayerInterstitialEventAssetListResponseStatus {
115 const ENCODING: Encoding = NSInteger::ENCODING;
116}
117
118unsafe impl RefEncode for AVPlayerInterstitialEventAssetListResponseStatus {
119 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
120}
121
122/// These constants describe the state for a skippable AVPlayerInterstitialEvent.
123///
124/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventskippableeventstate?language=objc)
125// NS_ENUM
126#[repr(transparent)]
127#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
128pub struct AVPlayerInterstitialEventSkippableEventState(pub NSInteger);
129impl AVPlayerInterstitialEventSkippableEventState {
130 /// Indicates that the interstitial event is not skippable.
131 #[doc(alias = "AVPlayerInterstitialEventSkippableEventStateNotSkippable")]
132 pub const NotSkippable: Self = Self(0);
133 /// Indicates that the interstitial event will eventually become eligible to be skipped.
134 #[doc(alias = "AVPlayerInterstitialEventSkippableEventStateNotYetEligible")]
135 pub const NotYetEligible: Self = Self(1);
136 /// Indicates that the interstitial event is currently skippable.
137 #[doc(alias = "AVPlayerInterstitialEventSkippableEventStateEligible")]
138 pub const Eligible: Self = Self(2);
139 /// Indicates that the interstitial event is no longer eligible to be skipped.
140 #[doc(alias = "AVPlayerInterstitialEventSkippableEventStateNoLongerEligible")]
141 pub const NoLongerEligible: Self = Self(3);
142}
143
144unsafe impl Encode for AVPlayerInterstitialEventSkippableEventState {
145 const ENCODING: Encoding = NSInteger::ENCODING;
146}
147
148unsafe impl RefEncode for AVPlayerInterstitialEventSkippableEventState {
149 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
150}
151
152extern_class!(
153 /// An AVPlayerInterstitialEvent provides instructions for temporarily suspending the playback of primary content in order to play alternative interstitial content instead, resuming playback of the primary content when playback of the interstitial content is complete or is canceled.
154 ///
155 /// The primary content is specified as an instance of AVPlayerItem, designated as the primary item of the interstitial event.
156 ///
157 /// The timing of interstitial playback is specified as a date within the date range of the primary item. Interstitial events are currently possible only for items with an intrinsic mapping from their timeline to real-time dates.
158 ///
159 /// The alternative interstitial content is specified as an array of one or more AVPlayerItems that will be used as templates for the creation of items for interstitial playback. In other words, these template items are not the actual items that will be played during interstitial playback; instead they are used to generate the items that are to be played, with property values that match the configuration of your template items.
160 ///
161 /// If you wish to observe the scheduling and progress of interstitial events, use an AVPlayerInterstitialEventMonitor. If you wish to specify your own schedule of interstitial events, use an AVPlayerInterstitialEventController.
162 ///
163 /// Note that while previously AVPlayerInterstitialEvent was an immutable object, it is now mutable. This allows it to be created and customized before being set on an AVPlayerInterstitialEventController.
164 ///
165 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialevent?language=objc)
166 #[unsafe(super(NSObject))]
167 #[derive(Debug, PartialEq, Eq, Hash)]
168 pub struct AVPlayerInterstitialEvent;
169);
170
171extern_conformance!(
172 unsafe impl NSCopying for AVPlayerInterstitialEvent {}
173);
174
175unsafe impl CopyingHelper for AVPlayerInterstitialEvent {
176 type Result = Self;
177}
178
179extern_conformance!(
180 unsafe impl NSObjectProtocol for AVPlayerInterstitialEvent {}
181);
182
183impl AVPlayerInterstitialEvent {
184 extern_methods!(
185 #[unsafe(method(init))]
186 #[unsafe(method_family = init)]
187 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
188
189 #[unsafe(method(new))]
190 #[unsafe(method_family = new)]
191 pub unsafe fn new() -> Retained<Self>;
192
193 #[cfg(all(feature = "AVPlayerItem", feature = "objc2-core-media"))]
194 /// Returns an instance of AVPlayerInterstitialEvent for use in scheduling interstitial playback.
195 ///
196 /// - Parameter primaryItem: An AVPlayerItem representing the primary content during the playback of which the interstitial event should occur. The primaryItem must have an AVAsset that provides an intrinsic mapping from its timeline to real-time dates.
197 /// - Parameter identifier: An external identifier for the event.
198 /// - Parameter time: The time within the duration of the primary item at which playback of the primary content should be temporarily suspended and the interstitial items played.
199 /// - Parameter templateItems: An array of AVPlayerItems with configurations that will be reproduced for the playback of interstitial content. An NSInvalidArgumentException will be raised if any of the template items employs an AVAsset that lacks a URL, such as an AVComposition.
200 /// - Parameter restrictions: Indicates restrictions on the use of end user playback controls that are imposed by the event.
201 /// - Parameter resumptionOffset: Specifies the offset in time at which playback of the primary item should resume after interstitial playback has finished. Definite numeric values are supported. The value kCMTimeIndefinite can also be used, in order to specify that the effective resumption time offset should accord with the wallclock time elapsed during interstitial playback.
202 /// - Parameter playoutLimit: Specifies the offset from the beginning of the interstitial at which interstitial playback should end, if the interstitial asset(s) are longer. Pass a positive numeric value, or kCMTimeInvalid to indicate no playout limit.
203 /// - Parameter userDefinedAttributes: Storage for attributes defined by the client or the content vendor. Attribute names should begin with X- for uniformity with server insertion.
204 ///
205 /// - Returns: An instance of AVPlayerInterstitialEvent.
206 ///
207 /// # Safety
208 ///
209 /// `user_defined_attributes` generic should be of the correct type.
210 #[deprecated = "Use interstitialEventWithPrimaryItem:time: instead"]
211 #[unsafe(method(interstitialEventWithPrimaryItem:identifier:time:templateItems:restrictions:resumptionOffset:playoutLimit:userDefinedAttributes:))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn interstitialEventWithPrimaryItem_identifier_time_templateItems_restrictions_resumptionOffset_playoutLimit_userDefinedAttributes(
214 primary_item: &AVPlayerItem,
215 identifier: Option<&NSString>,
216 time: CMTime,
217 template_items: &NSArray<AVPlayerItem>,
218 restrictions: AVPlayerInterstitialEventRestrictions,
219 resumption_offset: CMTime,
220 playout_limit: CMTime,
221 user_defined_attributes: Option<&NSDictionary>,
222 ) -> Retained<Self>;
223
224 #[cfg(all(feature = "AVPlayerItem", feature = "objc2-core-media"))]
225 /// Returns an instance of AVPlayerInterstitialEvent for use in scheduling interstitial playback.
226 ///
227 /// - Parameter primaryItem: An AVPlayerItem representing the primary content during the playback of which the interstitial event should occur. The primaryItem must have an AVAsset that provides an intrinsic mapping from its timeline to real-time dates.
228 /// - Parameter identifier: An external identifier for the event.
229 /// - Parameter date: The date within the date range of the primary item at which playback of the primary content should be temporarily suspended and the interstitial items played.
230 /// - Parameter templateItems: An array of AVPlayerItems with configurations that will be reproduced for the playback of interstitial content. An NSInvalidArgumentException will be raised if any of the template items employs an AVAsset that lacks a URL, such as an AVComposition.
231 /// - Parameter restrictions: Indicates restrictions on the use of end user playback controls that are imposed by the event.
232 /// - Parameter resumptionOffset: Specifies the offset in time at which playback of the primary item should resume after interstitial playback has finished. Definite numeric values are supported. The value kCMTimeIndefinite can also be used, in order to specify that the effective resumption time offset should accord with the wallclock time elapsed during interstitial playback.
233 /// - Parameter playoutLimit: Specifies the offset from the beginning of the interstitial at which interstitial playback should end, if the interstitial asset(s) are longer. Pass a positive numeric value, or kCMTimeInvalid to indicate no playout limit.
234 /// - Parameter userDefinedAttributes: Storage for attributes defined by the client or the content vendor. Attribute names should begin with X- for uniformity with server insertion.
235 ///
236 /// - Returns: An instance of AVPlayerInterstitialEvent.
237 ///
238 /// # Safety
239 ///
240 /// `user_defined_attributes` generic should be of the correct type.
241 #[deprecated = "Use interstitialEventWithPrimaryItem:date: instead"]
242 #[unsafe(method(interstitialEventWithPrimaryItem:identifier:date:templateItems:restrictions:resumptionOffset:playoutLimit:userDefinedAttributes:))]
243 #[unsafe(method_family = none)]
244 pub unsafe fn interstitialEventWithPrimaryItem_identifier_date_templateItems_restrictions_resumptionOffset_playoutLimit_userDefinedAttributes(
245 primary_item: &AVPlayerItem,
246 identifier: Option<&NSString>,
247 date: &NSDate,
248 template_items: &NSArray<AVPlayerItem>,
249 restrictions: AVPlayerInterstitialEventRestrictions,
250 resumption_offset: CMTime,
251 playout_limit: CMTime,
252 user_defined_attributes: Option<&NSDictionary>,
253 ) -> Retained<Self>;
254
255 #[cfg(all(feature = "AVPlayerItem", feature = "objc2-core-media"))]
256 /// Returns an instance of AVPlayerInterstitialEvent for use in scheduling interstitial playback.
257 ///
258 /// - Parameter primaryItem: An AVPlayerItem representing the primary content during the playback of which the interstitial event should occur. The primaryItem must have an AVAsset that provides an intrinsic mapping from its timeline to real-time dates.
259 /// - Parameter time: The time within the duration of the primary item at which playback of the primary content should be temporarily suspended and the interstitial items played.
260 ///
261 /// - Returns: An instance of AVPlayerInterstitialEvent.
262 #[unsafe(method(interstitialEventWithPrimaryItem:time:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn interstitialEventWithPrimaryItem_time(
265 primary_item: &AVPlayerItem,
266 time: CMTime,
267 ) -> Retained<Self>;
268
269 #[cfg(feature = "AVPlayerItem")]
270 /// Returns an instance of AVPlayerInterstitialEvent for use in scheduling interstitial playback.
271 ///
272 /// - Parameter primaryItem: An AVPlayerItem representing the primary content during the playback of which the interstitial event should occur. The primaryItem must have an AVAsset that provides an intrinsic mapping from its timeline to real-time dates.
273 /// - Parameter date: The date within the date range of the primary item at which playback of the primary content should be temporarily suspended and the interstitial items played.
274 ///
275 /// - Returns: An instance of AVPlayerInterstitialEvent.
276 #[unsafe(method(interstitialEventWithPrimaryItem:date:))]
277 #[unsafe(method_family = none)]
278 pub unsafe fn interstitialEventWithPrimaryItem_date(
279 primary_item: &AVPlayerItem,
280 date: &NSDate,
281 ) -> Retained<Self>;
282
283 #[cfg(feature = "AVPlayerItem")]
284 /// An AVPlayerItem representing the primary content during the playback of which the interstitial event should occur. The primaryItem must have an AVAsset that provides an intrinsic mapping from its timeline to real-time dates.
285 #[unsafe(method(primaryItem))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn primaryItem(&self, mtm: MainThreadMarker) -> Option<Retained<AVPlayerItem>>;
288
289 /// An external identifier for the event.
290 ///
291 /// If an event is set on an AVPlayerInterstitialEventController that already has an event with the same identifier, the old event will be replaced by the new one.
292 #[unsafe(method(identifier))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn identifier(&self) -> Retained<NSString>;
295
296 #[cfg(feature = "objc2-core-media")]
297 /// The time within the duration of the primary item at which playback of the primary content should be temporarily suspended and the interstitial items played.
298 ///
299 /// Will have a value equal to kCMTimeInvalid if the event was initialized with a date instead of a time.
300 #[unsafe(method(time))]
301 #[unsafe(method_family = none)]
302 pub unsafe fn time(&self) -> CMTime;
303
304 /// The date within the date range of the primary item at which playback of the primary content should be temporarily suspended and the interstitial items played.
305 ///
306 /// Will have a value of nil if the event was initialized with a time instead of a date.
307 #[unsafe(method(date))]
308 #[unsafe(method_family = none)]
309 pub unsafe fn date(&self) -> Option<Retained<NSDate>>;
310
311 #[cfg(feature = "AVPlayerItem")]
312 /// An array of AVPlayerItems with configurations that will be reproduced for the playback of interstitial content.
313 ///
314 /// If you want the instances of AVURLAsset used during interstitial playback to be identical to the ones you specify for templateItems in AVPlayerInterstitialEvents that you set on an AVPlayerInterstitialEventController, rather than equivalent AVURLAssets with the same URL, you must create them with a value for the key AVURLAssetPrimarySessionIdentifierKey that's equal to the httpSessionIdentifier of the primary AVPlayerItem's asset. See AVAsset.h. This is especially useful if you require the use of a custom AVAssetResourceLoader delegate for interstitial assets.
315 ///
316 /// An NSInvalidArgumentException will be raised if any of the template items employs an AVAsset that lacks a URL, such as an AVComposition.
317 #[unsafe(method(templateItems))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn templateItems(
320 &self,
321 mtm: MainThreadMarker,
322 ) -> Retained<NSArray<AVPlayerItem>>;
323
324 /// Indicates restrictions on the use of end user playback controls that are imposed by the event.
325 #[unsafe(method(restrictions))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn restrictions(&self) -> AVPlayerInterstitialEventRestrictions;
328
329 #[cfg(feature = "objc2-core-media")]
330 /// Specifies the offset in time at which playback of the primary item should resume after interstitial playback has finished.
331 ///
332 /// Definite numeric values are supported. The value kCMTimeIndefinite can also be used, in order to specify that the effective resumption time offset should accord with the wallclock time elapsed during interstitial playback; this value is typically suitable for live broadcasts. The default value is kCMTimeZero.
333 #[unsafe(method(resumptionOffset))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn resumptionOffset(&self) -> CMTime;
336
337 #[cfg(feature = "objc2-core-media")]
338 /// Specifies the offset in time at which playback of the interstitial event should end.
339 ///
340 /// Can be any positive numeric value, or invalid. The default value is kCMTimeInvalid, which means there is no limit.
341 #[unsafe(method(playoutLimit))]
342 #[unsafe(method_family = none)]
343 pub unsafe fn playoutLimit(&self) -> CMTime;
344
345 /// Specifies that the start time of interstitial playback should be snapped to a segment boundary of the primary asset
346 ///
347 /// If true, the start time or date of the interstitial will be adjusted to the nearest segment boundary when the primary player is playing an HTTP Live Streaming asset.
348 #[unsafe(method(alignsStartWithPrimarySegmentBoundary))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn alignsStartWithPrimarySegmentBoundary(&self) -> bool;
351
352 /// Specifies that the resumption time of primary playback should be snapped to a segment boundary of the primary asset
353 ///
354 /// If true, the resumption time of primary playback following an interstitial will be adjusted to the nearest segment boundary when the primary player is playing an HTTP Live Streaming asset.
355 #[unsafe(method(alignsResumptionWithPrimarySegmentBoundary))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn alignsResumptionWithPrimarySegmentBoundary(&self) -> bool;
358
359 /// The cue property is used to schedule event playback at a predefined position of primary playback.
360 #[unsafe(method(cue))]
361 #[unsafe(method_family = none)]
362 pub unsafe fn cue(&self) -> Retained<AVPlayerInterstitialEventCue>;
363
364 /// Specifies that the interstitial should be scheduled for playback once only, and suppressed for subsequent replay.
365 ///
366 /// The "once" provision takes effect at the start of interstitial playback. The interstitial will not be scheduled again even if the first playback is canceled before completion.
367 #[unsafe(method(willPlayOnce))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn willPlayOnce(&self) -> bool;
370
371 /// Attributes of the event defined by the content vendor or the client.
372 ///
373 /// Dictionary keys are attribute names. Dictionary values are attribute values.
374 #[unsafe(method(userDefinedAttributes))]
375 #[unsafe(method_family = none)]
376 pub unsafe fn userDefinedAttributes(&self) -> Retained<NSDictionary>;
377
378 /// The asset list JSON response as a dictionary, or nil if no asset list response has been loaded for the event.
379 ///
380 /// If the AVPlayerInterstitialEvent's templateItems is empty and the assetListResponse is nil, then an asset list read is expected. If the AVPlayerInterstitialEvent's templateItems is not empty and the assetListResponse is nil, then an asset list read is not expected.
381 #[unsafe(method(assetListResponse))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn assetListResponse(&self) -> Option<Retained<NSDictionary>>;
384
385 /// Indicates this event's occupancy on AVPlayerItemIntegratedTimeline. The default value is AVPlayerInterstitialEventTimelineSinglePointOccupancy.
386 #[unsafe(method(timelineOccupancy))]
387 #[unsafe(method_family = none)]
388 pub unsafe fn timelineOccupancy(&self) -> AVPlayerInterstitialEventTimelineOccupancy;
389
390 /// Indicates this event will supplement the primary content and should be presented unified with the primary item. The default value is NO.
391 #[unsafe(method(supplementsPrimaryContent))]
392 #[unsafe(method_family = none)]
393 pub unsafe fn supplementsPrimaryContent(&self) -> bool;
394
395 /// Indicates this event's content is dynamic and server may respond with different interstitial assets for other particpants in coordinated playback.
396 ///
397 /// Indicates this event's content is dynamic and server may respond with different interstitial assets for other particpants in coordinated playback. If this value is set to NO and the primary asset is particpating in coordinated playback, this event will participate in coordinated playback as well. The default value is YES.
398 #[unsafe(method(contentMayVary))]
399 #[unsafe(method_family = none)]
400 pub unsafe fn contentMayVary(&self) -> bool;
401
402 #[cfg(feature = "objc2-core-media")]
403 /// The time range within the duration of the interstitial event for which a skip button should be displayed.
404 ///
405 /// The start of the time range should indicate at which point the skip button should appear. The duration of the time range should indicate how long the skip button should be available. If this value is set to kCMTimePositiveInfinity, then the skip button will be available for the remainder of the interstitial's duration after appearing. If either the start or duration of the time range is kCMTimeInvalid, then the interstitial will NOT be eligible to be skipped.
406 #[unsafe(method(skipControlTimeRange))]
407 #[unsafe(method_family = none)]
408 pub unsafe fn skipControlTimeRange(&self) -> CMTimeRange;
409
410 /// The key defined in the AVPlayerInterstitialEventController's localizedStringsBundle that points to the localized label for the skip button.
411 ///
412 /// If the value of the property is nil, the skip button may contain a generic label depending on the implementation of the UI that's in use. To ensure the best available user experience in various playback configurations, including external playback, set a value for this property that provides localized translations of skip control labels.
413 #[unsafe(method(skipControlLocalizedLabelBundleKey))]
414 #[unsafe(method_family = none)]
415 pub unsafe fn skipControlLocalizedLabelBundleKey(&self) -> Option<Retained<NSString>>;
416 );
417}
418
419extern_class!(
420 /// An AVPlayerInterstitialEventMonitor allows you to observe the scheduling and progress of interstitial events, specified either intrinsically within the content of primary items, such as via use of directives carried by HLS media playlists, or via use of an AVPlayerInterstitialEventController.
421 ///
422 /// The schedule of interstitial events is provided as an array of AVPlayerInterstitialEvents. For each AVPlayerInterstitialEvent, when the primary player's current item is the primary item of the interstitial event and its currentDate reaches the date of the event, playback of the primary item by the primary player is temporarily suspended, i.e. its timeControlStatus changes to AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate and its reasonForWaitingToPlay will change to AVPlayerWaitingDuringInterstitialEventReason. During this suspension, playback of items that replicate the interstitial template items of the event are played by the interstitial player, which temporarily assumes the output configuration of the primary player; for example, its visual content will be routed to AVPlayerLayers that reference the primary player. Once the interstitial player has advanced through playback of the interstitial items specified by the event or its current item otherwise becomes nil, playback of the primary content will resume, at an offset from the time at which it was suspended as specified by the event.
423 ///
424 /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
425 ///
426 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitor?language=objc)
427 #[unsafe(super(NSObject))]
428 #[derive(Debug, PartialEq, Eq, Hash)]
429 pub struct AVPlayerInterstitialEventMonitor;
430);
431
432unsafe impl Send for AVPlayerInterstitialEventMonitor {}
433
434unsafe impl Sync for AVPlayerInterstitialEventMonitor {}
435
436extern_conformance!(
437 unsafe impl NSObjectProtocol for AVPlayerInterstitialEventMonitor {}
438);
439
440impl AVPlayerInterstitialEventMonitor {
441 extern_methods!(
442 #[cfg(feature = "AVPlayer")]
443 /// Returns an instance of AVPlayerInterstitialEvent for use in observing and scheduling interstitial playback.
444 ///
445 /// - Parameter primaryPlayer: The AVPlayer that will play the primaryItems of the receiver's interstitial events.
446 ///
447 /// - Returns: An instance of AVPlayerInterstitialEventMonitor.
448 #[unsafe(method(interstitialEventMonitorWithPrimaryPlayer:))]
449 #[unsafe(method_family = none)]
450 pub unsafe fn interstitialEventMonitorWithPrimaryPlayer(
451 primary_player: &AVPlayer,
452 ) -> Retained<Self>;
453
454 #[cfg(feature = "AVPlayer")]
455 #[unsafe(method(initWithPrimaryPlayer:))]
456 #[unsafe(method_family = init)]
457 pub unsafe fn initWithPrimaryPlayer(
458 this: Allocated<Self>,
459 primary_player: &AVPlayer,
460 ) -> Retained<Self>;
461
462 #[cfg(feature = "AVPlayer")]
463 /// The AVPlayer that will play the primaryItems of the receiver's interstitial events.
464 ///
465 /// This property is not atomic.
466 ///
467 /// # Safety
468 ///
469 /// This might not be thread-safe.
470 #[unsafe(method(primaryPlayer))]
471 #[unsafe(method_family = none)]
472 pub unsafe fn primaryPlayer(&self, mtm: MainThreadMarker) -> Option<Retained<AVPlayer>>;
473
474 #[cfg(feature = "AVPlayer")]
475 /// The AVQueuePlayer that will play interstitial items during suspension of playback of primary items.
476 ///
477 /// This property is not atomic.
478 ///
479 /// # Safety
480 ///
481 /// This might not be thread-safe.
482 #[unsafe(method(interstitialPlayer))]
483 #[unsafe(method_family = none)]
484 pub unsafe fn interstitialPlayer(&self, mtm: MainThreadMarker) -> Retained<AVQueuePlayer>;
485
486 /// Provides the current schedule of interstitial events, specified either intrinsically within the content of primary items, such as via use of directives carried by HLS media playlists, or via use of an AVPlayerInterstitialEventController.
487 ///
488 /// When interstitial events follow a schedule specified intrinsically within the content of primary items, the value of this property will typically change whenever the currentItem of the primaryPlayer changes. For HLS content that specifies interstitials via the use of DATERANGE tags, the value of this property may also change whenever the set of DATERANGE tags in the currentItem's media playlist changes.
489 /// When interstitial events follow a schedule specified via use of an AVPlayerInterstitialEventController, the value of this property changes only when a new schedule is set on the AVPlayerInterstitialEventController.
490 /// The events returned in this array are immutable. Attempting to mutate them will trigger an exception. To alter an event, make a copy and mutate the copy.
491 #[unsafe(method(events))]
492 #[unsafe(method_family = none)]
493 pub unsafe fn events(&self) -> Retained<NSArray<AVPlayerInterstitialEvent>>;
494
495 /// The current interstitial event. Has a value of nil during playback of primary content by the primary player.
496 #[unsafe(method(currentEvent))]
497 #[unsafe(method_family = none)]
498 pub unsafe fn currentEvent(&self) -> Option<Retained<AVPlayerInterstitialEvent>>;
499
500 /// The skippable event state for the currentEvent.
501 ///
502 /// If currentEvent is nil, then the value will be AVPlayerInterstitialEventSkippableEventStateNotSkippable.
503 #[unsafe(method(currentEventSkippableState))]
504 #[unsafe(method_family = none)]
505 pub unsafe fn currentEventSkippableState(
506 &self,
507 ) -> AVPlayerInterstitialEventSkippableEventState;
508
509 /// The skip control label for the currentEvent.
510 ///
511 /// If a localizedStringsBundle has been set on the AVPlayerInterstitialEventController, and a skipControlLocalizedLabelBundleKey is set on the currentEvent, then this value will be the localized string that was matched to the event's skipControlLocalizedLabelBundleKey for the corresponding system language in the supplied Bundle, if any.
512 /// If currentEvent is nil, then the value will be nil.
513 #[unsafe(method(currentEventSkipControlLabel))]
514 #[unsafe(method_family = none)]
515 pub unsafe fn currentEventSkipControlLabel(&self) -> Option<Retained<NSString>>;
516 );
517}
518
519/// Methods declared on superclass `NSObject`.
520impl AVPlayerInterstitialEventMonitor {
521 extern_methods!(
522 #[unsafe(method(init))]
523 #[unsafe(method_family = init)]
524 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
525
526 #[unsafe(method(new))]
527 #[unsafe(method_family = new)]
528 pub unsafe fn new() -> Retained<Self>;
529 );
530}
531
532extern "C" {
533 /// A notification that's posted whenever the value of events of an AVPlayerInterstitialEventMonitor is changed.
534 ///
535 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitoreventsdidchangenotification?language=objc)
536 pub static AVPlayerInterstitialEventMonitorEventsDidChangeNotification:
537 &'static NSNotificationName;
538}
539
540extern "C" {
541 /// A notification that's posted whenever the currentEvent of an AVPlayerInterstitialEventMonitor changes.
542 ///
543 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorcurrenteventdidchangenotification?language=objc)
544 pub static AVPlayerInterstitialEventMonitorCurrentEventDidChangeNotification:
545 &'static NSNotificationName;
546}
547
548extern "C" {
549 /// A notification that is posted whenever an AVPlayerInterstitialEvent's asset list response status changes.
550 ///
551 /// Carries a userInfo dictionary that can contain the following keys and values:
552 /// 1. AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeEventKey, with a value that indicates the AVPlayerInterstitialEvent for which the asset response status has changed.
553 /// 2. AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeStatusKey, with a value of type AVPlayerInterstitialEventAssetListResponseStatus, indicating the changed asset response status.
554 /// 3. AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeErrorKey, with a value of type NSError that carries additional information about the failure to read the asset list. This key is only present when the new AVPlayerInterstitialEventAssetListResponseStatus is AVPlayerInterstitialEventAssetListResponseStatusUnavailable.
555 ///
556 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorassetlistresponsestatusdidchangenotification?language=objc)
557 pub static AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeNotification:
558 &'static NSNotificationName;
559}
560
561extern "C" {
562 /// The dictionary key for the AVPlayerInterstitial event that had its asset list response status changed in the payload of the AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeNotification.
563 ///
564 /// The value corresponding to this key is of type AVPlayerInterstitialEvent.
565 ///
566 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorassetlistresponsestatusdidchangeeventkey?language=objc)
567 pub static AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeEventKey:
568 &'static NSString;
569}
570
571extern "C" {
572 /// The dictionary key for the asset list response status in the payload of the AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeNotification.
573 ///
574 /// The value corresponding to this key is of type AVPlayerInterstitialEventAssetListResponseStatus.
575 ///
576 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorassetlistresponsestatusdidchangestatuskey?language=objc)
577 pub static AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeStatusKey:
578 &'static NSString;
579}
580
581extern "C" {
582 /// The dictionary key for the NSError in the payload of the AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeNotification.
583 ///
584 /// The value corresponding to this key is of type NSError. This key only exists in the payload of AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeNotification if AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeStatusKey in the same payload points to a value of AVPlayerInterstitialEventAssetListResponseStatusUnavailable.
585 ///
586 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorassetlistresponsestatusdidchangeerrorkey?language=objc)
587 pub static AVPlayerInterstitialEventMonitorAssetListResponseStatusDidChangeErrorKey:
588 &'static NSString;
589}
590
591extern "C" {
592 /// A notification that's posted whenever the currentEventSkippableState of an AVPlayerInterstitialEventMonitor changes.
593 ///
594 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorcurrenteventskippablestatedidchangenotification?language=objc)
595 pub static AVPlayerInterstitialEventMonitorCurrentEventSkippableStateDidChangeNotification:
596 &'static NSNotificationName;
597}
598
599extern "C" {
600 /// The dictionary key for the AVPlayerInterstitial event that had its skippable event state changed in the payload of the AVPlayerInterstitialEventMonitorCurrentEventSkippableStateDidChangeNotification.
601 ///
602 /// The value corresponding to this key is of type AVPlayerInterstitialEvent.
603 ///
604 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorcurrenteventskippablestatedidchangeeventkey?language=objc)
605 pub static AVPlayerInterstitialEventMonitorCurrentEventSkippableStateDidChangeEventKey:
606 &'static NSString;
607}
608
609extern "C" {
610 /// The dictionary key for the skippable event state in the payload of the AVPlayerInterstitialEventMonitorCurrentEventSkippableStateDidChangeNotification.
611 ///
612 /// The value corresponding to this key is an NSNumber containing type AVPlayerInterstitialEventSkippableEventState.
613 ///
614 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorcurrenteventskippablestatedidchangestatekey?language=objc)
615 pub static AVPlayerInterstitialEventMonitorCurrentEventSkippableStateDidChangeStateKey:
616 &'static NSString;
617}
618
619extern "C" {
620 /// The dictionary key for the skip label of the event in the payload of the AVPlayerInterstitialEventMonitorCurrentEventSkippableStateDidChangeNotification.
621 ///
622 /// The value corresponding to this key is an NSString that's the localized skip label if a localizedStringsBundle is set on the AVPlayerInterstitialEventController and a skipControlLocalizedLabelBundleKey on the AVPlayerInterstitialEvent whose skippable event state changed. Note that this key will not be present if there is no localizedStringsBundle set, or if the currentEventSkippableState changed to AVPlayerInterstitialEventSkippableEventStateNotSkippable.
623 ///
624 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorcurrenteventskippablestatedidchangeskipcontrollabelkey?language=objc)
625 pub static AVPlayerInterstitialEventMonitorCurrentEventSkippableStateDidChangeSkipControlLabelKey:
626 &'static NSString;
627}
628
629extern "C" {
630 /// A notification that's posted whenever an event was skipped via skip control.
631 ///
632 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorcurrenteventskippednotification?language=objc)
633 pub static AVPlayerInterstitialEventMonitorCurrentEventSkippedNotification:
634 &'static NSNotificationName;
635}
636
637extern "C" {
638 /// The dictionary key for the AVPlayerInterstitialEvent that was skipped in the payload of the AVPlayerInterstitialEventMonitorCurrentEventSkippedNotification.
639 ///
640 /// The value corresponding to this key is of type AVPlayerInterstitialEvent.
641 ///
642 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorcurrenteventskippedeventkey?language=objc)
643 pub static AVPlayerInterstitialEventMonitorCurrentEventSkippedEventKey: &'static NSString;
644}
645
646extern "C" {
647 /// A notification that is posted whenever an AVPlayerInterstitialEvent with loaded assets was unscheduled prior to playing.
648 ///
649 /// Carries a userInfo dictionary that can contain the following keys and values:
650 /// 1. AVPlayerInterstitialEventMonitorInterstitialEventWasUnscheduledEventKey, with a value that indicates which AVPlayerInterstitialEvent was unscheduled.
651 /// 2. AVPlayerInterstitialEventMonitorInterstitialEventWasUnscheduledErrorKey, with an NSError value. This key will only be present if the AVPlayerInterstitialEvent was unscheduled due to an error.
652 ///
653 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorinterstitialeventwasunschedulednotification?language=objc)
654 pub static AVPlayerInterstitialEventMonitorInterstitialEventWasUnscheduledNotification:
655 &'static NSNotificationName;
656}
657
658extern "C" {
659 /// The dictionary key for the AVPlayerInterstitialEvent that was unscheduled in the payload of the AVPlayerInterstitialEventMonitorInterstitialEventWasUnscheduledNotification.
660 ///
661 /// The value corresponding to this key is of type AVPlayerInterstitialEvent.
662 ///
663 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorinterstitialeventwasunscheduledeventkey?language=objc)
664 pub static AVPlayerInterstitialEventMonitorInterstitialEventWasUnscheduledEventKey:
665 &'static NSString;
666}
667
668extern "C" {
669 /// The dictionary key to indicate whether the event that was unscheduled was due to an error.
670 ///
671 /// The value corresponding to this key is of type NSError. This key only exists in the payload of AVPlayerInterstitialEventMonitorInterstitialEventWasUnscheduledNotification if the interstitial event was unscheduled due to an error.
672 ///
673 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorinterstitialeventwasunschedulederrorkey?language=objc)
674 pub static AVPlayerInterstitialEventMonitorInterstitialEventWasUnscheduledErrorKey:
675 &'static NSString;
676}
677
678extern "C" {
679 /// A notification that is posted whenever an AVPlayerInterstitialEvent finished playing.
680 ///
681 /// Carries a userInfo dictionary that can contain the following keys and values:
682 /// 1. AVPlayerInterstitialEventMonitorInterstitialEventDidFinishEventKey, with a value that indicates the AVPlayerInterstitialEvent that finished playing.
683 /// 2. AVPlayerInterstitialEventMonitorInterstitialEventDidFinishPlayoutTimeKey, with a value that indicates how long that AVPlayerInterstitialEvent played out for.
684 /// 3. AVPlayerInterstitialEventMonitorInterstitialEventDidFinishDidPlayEntireEventKey, with a value that indicates whether the AVPlayerInterstitialEvent was fully played out.
685 ///
686 /// Note that cancelling an AVPlayerInterstitialEvent after playback started but prior to playback finishing will also trigger this event.
687 ///
688 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorinterstitialeventdidfinishnotification?language=objc)
689 pub static AVPlayerInterstitialEventMonitorInterstitialEventDidFinishNotification:
690 &'static NSNotificationName;
691}
692
693extern "C" {
694 /// The dictionary key for the AVPlayerInterstitialEvent that finished playing in the payload of the AVPlayerInterstitialEventMonitorInterstitialEventDidFinishNotification.
695 ///
696 /// The value corresponding to this key is of type AVPlayerInterstitialEvent.
697 ///
698 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorinterstitialeventdidfinisheventkey?language=objc)
699 pub static AVPlayerInterstitialEventMonitorInterstitialEventDidFinishEventKey:
700 &'static NSString;
701}
702
703extern "C" {
704 /// The dictionary key for the playout time of the event that finished playing in the payload of the AVPlayerInterstitialEventMonitorInterstitialEventDidFinishNotification.
705 ///
706 /// The value corresponding to this key is of type CMTime as a NSDictionary.
707 ///
708 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorinterstitialeventdidfinishplayouttimekey?language=objc)
709 pub static AVPlayerInterstitialEventMonitorInterstitialEventDidFinishPlayoutTimeKey:
710 &'static NSString;
711}
712
713extern "C" {
714 /// The dictionary key to indicate whether the event that finished playing was fully played out in the payload of the AVPlayerInterstitialEventMonitorInterstitialEventDidFinishNotification.
715 ///
716 /// The value corresponding to this key is of type NSNumber with a BOOL value.
717 ///
718 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventmonitorinterstitialeventdidfinishdidplayentireeventkey?language=objc)
719 pub static AVPlayerInterstitialEventMonitorInterstitialEventDidFinishDidPlayEntireEventKey:
720 &'static NSString;
721}
722
723extern_class!(
724 /// An AVPlayerInterstitialEventController allows you to specify a schedule of interstitial events for items played by a primary player. By creating an instance of AVPlayerInterstitialEventController and setting a schedule of interstitial events, you pre-empt directives the are intrinsic to the items played by the primary player, if any exist, causing them to be ignored.
725 ///
726 /// The schedule of interstitial events is specified as an array of AVPlayerInterstitialEvents. For each AVPlayerInterstitialEvent, when the primary player's current item is the primary item of the interstitial event and its currentDate reaches the date of the event, playback of the primary item by the primary player is temporarily suspended, i.e. its timeControlStatus changes to AVPlayerTimeControlStatusWaitingToPlayAtSpecifiedRate and its reasonForWaitingToPlay will change to AVPlayerWaitingDuringInterstitialEventReason. During this suspension, playback of items that replicate the interstitial template items of the event are played by the interstitial player, which temporarily assumes the output configuration of the primary player; for example, its visual content will be routed to AVPlayerLayers that reference the primary player. Once the interstitial player has advanced through playback of the interstitial items specified by the event or its current item otherwise becomes nil, playback of the primary content will resume, at an offset from the time at which it was suspended as specified by the event.
727 ///
728 /// Subclasses of this type that are used from Swift must fulfill the requirements of a Sendable type.
729 ///
730 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerinterstitialeventcontroller?language=objc)
731 #[unsafe(super(AVPlayerInterstitialEventMonitor, NSObject))]
732 #[derive(Debug, PartialEq, Eq, Hash)]
733 pub struct AVPlayerInterstitialEventController;
734);
735
736extern_conformance!(
737 unsafe impl NSObjectProtocol for AVPlayerInterstitialEventController {}
738);
739
740impl AVPlayerInterstitialEventController {
741 extern_methods!(
742 #[cfg(feature = "AVPlayer")]
743 /// Returns an instance of AVPlayerInterstitialEvent for use in observing and scheduling interstitial playback.
744 ///
745 /// This method throws an exception if the primary player is an interstitial player.
746 ///
747 /// - Parameter primaryPlayer: The AVPlayer that will play the primaryItems of the receiver's interstitial events.
748 ///
749 /// - Returns: An instance of AVPlayerInterstitialEventController.
750 #[unsafe(method(interstitialEventControllerWithPrimaryPlayer:))]
751 #[unsafe(method_family = none)]
752 pub unsafe fn interstitialEventControllerWithPrimaryPlayer(
753 primary_player: &AVPlayer,
754 ) -> Retained<Self>;
755
756 #[cfg(feature = "AVPlayer")]
757 /// This method throws an exception if the primary player is an interstitial player.
758 #[unsafe(method(initWithPrimaryPlayer:))]
759 #[unsafe(method_family = init)]
760 pub unsafe fn initWithPrimaryPlayer(
761 this: Allocated<Self>,
762 primary_player: &AVPlayer,
763 ) -> Retained<Self>;
764
765 /// Specifies the current schedule of interstitial events.
766 ///
767 /// Setting this property to a non-nil value cancels and overrides all previously scheduled future interstitial events, including those that are intrinsically specified by the content of primary items, such as directives carried by HLS media playlists. Setting it to nil causes its value to be reset in accordance with the content of the current primary item.
768 ///
769 /// If you change the value of events during an interstitial event and the current event is not included in the new value of events, the current event is nevertheless allowed to continue until completion. If you wish to cancel the current event, use -cancelCurrentEventWithResumptionOffset:.
770 ///
771 /// If interstitial events are scheduled with dates that coincide either with the date of another scheduled interstitial event or with the date range of the primary content that's omitted according to the resumption offset of another scheduled interstitial event, the primary content will remain suspended until all coinciding interstitial events have been completed. The effective resumption offset will be the sum of the resumption offsets of the coinciding interstitial events. (Note that the sum of a numeric CMTime and kCMTimeIndefinite is kCMTimeIndefinite.)
772 ///
773 /// If interstitial events are scheduled for the same date, they are ordered according to their position in the events array.
774 ///
775 /// The receiver will make a copy of the events that are set on it. Subsequent mutations on the original events will have no effect on the copy.
776 ///
777 /// An NSInvalidArgumentException will be raised if an under-specified AVPlayerInterstitialEvent is set, such as one with a nil primaryItem, or with neither a time nor a date.
778 #[unsafe(method(events))]
779 #[unsafe(method_family = none)]
780 pub unsafe fn events(&self) -> Retained<NSArray<AVPlayerInterstitialEvent>>;
781
782 /// Setter for [`events`][Self::events].
783 ///
784 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
785 #[unsafe(method(setEvents:))]
786 #[unsafe(method_family = none)]
787 pub unsafe fn setEvents(&self, events: Option<&NSArray<AVPlayerInterstitialEvent>>);
788
789 #[cfg(feature = "objc2-core-media")]
790 /// Causes the playback of any and all interstitial content currently in progress to be abandoned and the playback of primary content to be resumed.
791 ///
792 /// If invoked during the handling of coinciding interstitial events, they will all be canceled.
793 /// When you cancel interstitial events via the use of this method, the value of resumptionOffset that you pass overrides the events' resumptionOffset.
794 /// Has no effect while currentEvent is nil.
795 ///
796 /// - Parameter resumptionOffset: Specifies the offset in time at which playback of the primary player's current item should resume after interstitial playback has finished. To specify that the effective resumption time offset should match with the wallclock time elapsed during interstitial playback, pass a value of kCMTimeIndefinite. To specify that the effective resumption time offset should match with the projected playback time, pass a value of kCMTimeInvalid.
797 #[unsafe(method(cancelCurrentEventWithResumptionOffset:))]
798 #[unsafe(method_family = none)]
799 pub unsafe fn cancelCurrentEventWithResumptionOffset(&self, resumption_offset: CMTime);
800
801 /// Causes the playback of the currently playing interstital event to be abandoned.
802 ///
803 /// Note that coinciding events will NOT be skipped.
804 /// This results in AVPlayerInterstitialEventMonitorCurrentEventSkippedNotification being posted.
805 /// Has no effect while the currentEvent is nil.
806 #[unsafe(method(skipCurrentEvent))]
807 #[unsafe(method_family = none)]
808 pub unsafe fn skipCurrentEvent(&self);
809
810 /// The bundle that contains the localized strings to be used by the AVPlayerInterstitialEventController.
811 ///
812 /// If the value of the property is nil, any UI elements triggered by the AVPlayerInterstitialEventController, such as the skip button, may contain a generic label based on the implementation of the UI that's in use. To ensure the best available user experience in various playback configurations, including external playback, set a value for this property that provides localized translations of skip control labels.
813 #[unsafe(method(localizedStringsBundle))]
814 #[unsafe(method_family = none)]
815 pub unsafe fn localizedStringsBundle(&self) -> Option<Retained<NSBundle>>;
816
817 /// Setter for [`localizedStringsBundle`][Self::localizedStringsBundle].
818 ///
819 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
820 #[unsafe(method(setLocalizedStringsBundle:))]
821 #[unsafe(method_family = none)]
822 pub unsafe fn setLocalizedStringsBundle(&self, localized_strings_bundle: Option<&NSBundle>);
823
824 /// The name of the table in the bundle that contains the localized strings to be used by the AVPlayerInterstitialEventController.
825 ///
826 /// If the value of the property is nil, it will default to "Localizable"
827 #[unsafe(method(localizedStringsTableName))]
828 #[unsafe(method_family = none)]
829 pub unsafe fn localizedStringsTableName(&self) -> Option<Retained<NSString>>;
830
831 /// Setter for [`localizedStringsTableName`][Self::localizedStringsTableName].
832 ///
833 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
834 #[unsafe(method(setLocalizedStringsTableName:))]
835 #[unsafe(method_family = none)]
836 pub unsafe fn setLocalizedStringsTableName(
837 &self,
838 localized_strings_table_name: Option<&NSString>,
839 );
840 );
841}
842
843/// Methods declared on superclass `AVPlayerInterstitialEventMonitor`.
844impl AVPlayerInterstitialEventController {
845 extern_methods!(
846 #[cfg(feature = "AVPlayer")]
847 /// Returns an instance of AVPlayerInterstitialEvent for use in observing and scheduling interstitial playback.
848 ///
849 /// - Parameter primaryPlayer: The AVPlayer that will play the primaryItems of the receiver's interstitial events.
850 ///
851 /// - Returns: An instance of AVPlayerInterstitialEventMonitor.
852 #[unsafe(method(interstitialEventMonitorWithPrimaryPlayer:))]
853 #[unsafe(method_family = none)]
854 pub unsafe fn interstitialEventMonitorWithPrimaryPlayer(
855 primary_player: &AVPlayer,
856 ) -> Retained<Self>;
857 );
858}
859
860/// Methods declared on superclass `NSObject`.
861impl AVPlayerInterstitialEventController {
862 extern_methods!(
863 #[unsafe(method(init))]
864 #[unsafe(method_family = init)]
865 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
866
867 #[unsafe(method(new))]
868 #[unsafe(method_family = new)]
869 pub unsafe fn new() -> Retained<Self>;
870 );
871}
872
873extern "C" {
874 /// Indicates that the player is waiting for the completion of an interstitial event.
875 ///
876 /// The player is waiting for playback because an interstitial event is currently in progress. Interstitial events can be monitored via use of an AVPlayerInterstitialEventMonitor.
877 ///
878 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avplayerwaitingduringinterstitialeventreason?language=objc)
879 #[cfg(feature = "AVPlayer")]
880 pub static AVPlayerWaitingDuringInterstitialEventReason: &'static AVPlayerWaitingReason;
881}
882
883/// AVPlayerInterstitialSupport.
884#[cfg(feature = "AVPlayer")]
885impl AVPlayer {
886 extern_methods!();
887}
888
889/// AVPlayerInterstitialSupport.
890#[cfg(feature = "AVPlayerItem")]
891impl AVPlayerItem {
892 extern_methods!(
893 /// Allows interstitials to be played according to a schedule that's specified by server-side directives. The default value is YES. A value of NO prevents automatic scheduling of future server-side interstitial events. Events specified by an AVPlayerInterstitialEventController override server-side events, regardless of the value of this property.
894 ///
895 /// Before macOS 13, iOS 16, tvOS 16, and watchOS 9, this property must be accessed on the main thread/queue.
896 #[unsafe(method(automaticallyHandlesInterstitialEvents))]
897 #[unsafe(method_family = none)]
898 pub unsafe fn automaticallyHandlesInterstitialEvents(&self) -> bool;
899
900 /// Setter for [`automaticallyHandlesInterstitialEvents`][Self::automaticallyHandlesInterstitialEvents].
901 #[unsafe(method(setAutomaticallyHandlesInterstitialEvents:))]
902 #[unsafe(method_family = none)]
903 pub unsafe fn setAutomaticallyHandlesInterstitialEvents(
904 &self,
905 automatically_handles_interstitial_events: bool,
906 );
907
908 /// If the item was created automatically according to a template item for looping, for interstitial playback, or for other purposes, indicates the AVPlayerItem that was used as the template.
909 #[unsafe(method(templatePlayerItem))]
910 #[unsafe(method_family = none)]
911 pub unsafe fn templatePlayerItem(&self) -> Option<Retained<AVPlayerItem>>;
912 );
913}