objc2_av_kit/generated/
AVPlayerView.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-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-av-foundation")]
10use objc2_av_foundation::*;
11#[cfg(feature = "objc2-core-foundation")]
12use objc2_core_foundation::*;
13use objc2_foundation::*;
14
15use crate::*;
16
17/// No controls pane is associated with the view.
18///
19/// The inline controls pane is associated with the view.
20///
21/// The floating controls pane is associated with the view.
22///
23/// The minimal controls pane is associated with the view.
24///
25/// The default controls pane is associated with the view.
26///
27/// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avplayerviewcontrolsstyle?language=objc)
28// NS_ENUM
29#[repr(transparent)]
30#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
31pub struct AVPlayerViewControlsStyle(pub NSInteger);
32impl AVPlayerViewControlsStyle {
33    #[doc(alias = "AVPlayerViewControlsStyleNone")]
34    pub const None: Self = Self(0);
35    #[doc(alias = "AVPlayerViewControlsStyleInline")]
36    pub const Inline: Self = Self(1);
37    #[doc(alias = "AVPlayerViewControlsStyleFloating")]
38    pub const Floating: Self = Self(2);
39    #[doc(alias = "AVPlayerViewControlsStyleMinimal")]
40    pub const Minimal: Self = Self(3);
41    #[doc(alias = "AVPlayerViewControlsStyleDefault")]
42    pub const Default: Self = Self(AVPlayerViewControlsStyle::Inline.0);
43}
44
45unsafe impl Encode for AVPlayerViewControlsStyle {
46    const ENCODING: Encoding = NSInteger::ENCODING;
47}
48
49unsafe impl RefEncode for AVPlayerViewControlsStyle {
50    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
51}
52
53extern_class!(
54    /// AVPlayerView is a subclass of NSView that can be used to display the visual content of an AVPlayer object and the standard playback controls.
55    ///
56    /// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avplayerview?language=objc)
57    #[unsafe(super(NSView, NSResponder, NSObject))]
58    #[derive(Debug, PartialEq, Eq, Hash)]
59    #[cfg(feature = "objc2-app-kit")]
60    #[cfg(target_os = "macos")]
61    pub struct AVPlayerView;
62);
63
64#[cfg(feature = "objc2-app-kit")]
65#[cfg(target_os = "macos")]
66extern_conformance!(
67    unsafe impl NSAccessibility for AVPlayerView {}
68);
69
70#[cfg(feature = "objc2-app-kit")]
71#[cfg(target_os = "macos")]
72extern_conformance!(
73    unsafe impl NSAccessibilityElementProtocol for AVPlayerView {}
74);
75
76#[cfg(feature = "objc2-app-kit")]
77#[cfg(target_os = "macos")]
78extern_conformance!(
79    unsafe impl NSAnimatablePropertyContainer for AVPlayerView {}
80);
81
82#[cfg(feature = "objc2-app-kit")]
83#[cfg(target_os = "macos")]
84extern_conformance!(
85    unsafe impl NSAppearanceCustomization for AVPlayerView {}
86);
87
88#[cfg(feature = "objc2-app-kit")]
89#[cfg(target_os = "macos")]
90extern_conformance!(
91    unsafe impl NSCoding for AVPlayerView {}
92);
93
94#[cfg(feature = "objc2-app-kit")]
95#[cfg(target_os = "macos")]
96extern_conformance!(
97    unsafe impl NSDraggingDestination for AVPlayerView {}
98);
99
100#[cfg(feature = "objc2-app-kit")]
101#[cfg(target_os = "macos")]
102extern_conformance!(
103    unsafe impl NSObjectProtocol for AVPlayerView {}
104);
105
106#[cfg(feature = "objc2-app-kit")]
107#[cfg(target_os = "macos")]
108extern_conformance!(
109    unsafe impl NSUserInterfaceItemIdentification for AVPlayerView {}
110);
111
112#[cfg(feature = "objc2-app-kit")]
113#[cfg(target_os = "macos")]
114impl AVPlayerView {
115    extern_methods!(
116        #[cfg(feature = "objc2-av-foundation")]
117        /// The player from which to source the media content for the view.
118        #[unsafe(method(player))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn player(&self) -> Option<Retained<AVPlayer>>;
121
122        #[cfg(feature = "objc2-av-foundation")]
123        /// Setter for [`player`][Self::player].
124        #[unsafe(method(setPlayer:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn setPlayer(&self, player: Option<&AVPlayer>);
127
128        /// The style of the playback controls pane currently associated with the view.
129        ///
130        /// After macOS 11, the floating style controls will always be used when presenting in fullscreen and AVPlayerViewControlsStyleNone is not specified.
131        #[unsafe(method(controlsStyle))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn controlsStyle(&self) -> AVPlayerViewControlsStyle;
134
135        /// Setter for [`controlsStyle`][Self::controlsStyle].
136        #[unsafe(method(setControlsStyle:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setControlsStyle(&self, controls_style: AVPlayerViewControlsStyle);
139
140        #[cfg(feature = "objc2-av-foundation")]
141        /// A string defining how the video is displayed within an AVPlayerLayer bounds rect.
142        ///
143        /// Options are AVLayerVideoGravityResizeAspect, AVLayerVideoGravityResizeAspectFill and AVLayerVideoGravityResize. AVLayerVideoGravityResizeAspect is default.
144        #[unsafe(method(videoGravity))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn videoGravity(&self) -> Retained<AVLayerVideoGravity>;
147
148        #[cfg(feature = "objc2-av-foundation")]
149        /// Setter for [`videoGravity`][Self::videoGravity].
150        ///
151        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
152        #[unsafe(method(setVideoGravity:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setVideoGravity(&self, video_gravity: &AVLayerVideoGravity);
155
156        /// Boolean indicating that the first video frame has been made ready for display for the current item of the associated AVPlayer.
157        #[unsafe(method(isReadyForDisplay))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn isReadyForDisplay(&self) -> bool;
160
161        /// The current size and position of the video image as displayed within the receiver's view's bounds.
162        #[unsafe(method(videoBounds))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn videoBounds(&self) -> NSRect;
165
166        /// Use the content overlay view to add additional custom views between the video content and the controls.
167        #[unsafe(method(contentOverlayView))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn contentOverlayView(&self) -> Option<Retained<NSView>>;
170
171        /// Whether or not the now playing info center should be updated. Default is YES.
172        #[unsafe(method(updatesNowPlayingInfoCenter))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn updatesNowPlayingInfoCenter(&self) -> bool;
175
176        /// Setter for [`updatesNowPlayingInfoCenter`][Self::updatesNowPlayingInfoCenter].
177        #[unsafe(method(setUpdatesNowPlayingInfoCenter:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setUpdatesNowPlayingInfoCenter(&self, updates_now_playing_info_center: bool);
180
181        /// The receiver's delegate.
182        #[unsafe(method(delegate))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn delegate(&self)
185            -> Option<Retained<ProtocolObject<dyn AVPlayerViewDelegate>>>;
186
187        /// Setter for [`delegate`][Self::delegate].
188        ///
189        /// This is a [weak property][objc2::topics::weak_property].
190        #[unsafe(method(setDelegate:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn setDelegate(
193            &self,
194            delegate: Option<&ProtocolObject<dyn AVPlayerViewDelegate>>,
195        );
196
197        #[cfg(feature = "AVPlaybackSpeed")]
198        /// A list of user selectable playback speeds to be shown in the playback speed control.
199        ///
200        /// By default this property will be set to the systemDefaultSpeeds class property. Setting this property to nil will hide the playback speed selection UI.
201        ///
202        /// To set the currently selected playback speed programmatically, either set the defaultRate on the AVPlayer associated with this view controller or use the selectSpeed method on AVPlayerView.
203        #[unsafe(method(speeds))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn speeds(&self) -> Retained<NSArray<AVPlaybackSpeed>>;
206
207        #[cfg(feature = "AVPlaybackSpeed")]
208        /// Setter for [`speeds`][Self::speeds].
209        ///
210        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
211        #[unsafe(method(setSpeeds:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn setSpeeds(&self, speeds: &NSArray<AVPlaybackSpeed>);
214
215        #[cfg(feature = "AVPlaybackSpeed")]
216        /// The currently selected playback speed.
217        ///
218        /// Changes to the associated AVPlayer's defaultRate will be reflected in this property and vice versa. If the associated AVPlayer's defaultRate is set to a value that does not match a speed in the speeds list property, the selected speed will be nil.
219        #[unsafe(method(selectedSpeed))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn selectedSpeed(&self) -> Option<Retained<AVPlaybackSpeed>>;
222
223        #[cfg(feature = "AVPlaybackSpeed")]
224        /// Parameter `speed`: The playback speed to select.
225        ///
226        /// Sets the input AVPlaybackSpeed as the selected speed.
227        ///
228        /// Calls to selectSpeed with AVPlaybackSpeeds not contained within the speeds property array will be ignored.
229        #[unsafe(method(selectSpeed:))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn selectSpeed(&self, speed: &AVPlaybackSpeed);
232
233        /// When set to YES, the AVPlayerView will try to find objects, text and people while the media is paused. When an object is found, the user will be able to interact with it selecting and right clicking to present a context menu. Default is YES.
234        #[unsafe(method(allowsVideoFrameAnalysis))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn allowsVideoFrameAnalysis(&self) -> bool;
237
238        /// Setter for [`allowsVideoFrameAnalysis`][Self::allowsVideoFrameAnalysis].
239        #[unsafe(method(setAllowsVideoFrameAnalysis:))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn setAllowsVideoFrameAnalysis(&self, allows_video_frame_analysis: bool);
242
243        #[cfg(feature = "AVKitTypes")]
244        /// The types of items AVPlayerView looks for in a paused video frame.
245        #[unsafe(method(videoFrameAnalysisTypes))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn videoFrameAnalysisTypes(&self) -> AVVideoFrameAnalysisType;
248
249        #[cfg(feature = "AVKitTypes")]
250        /// Setter for [`videoFrameAnalysisTypes`][Self::videoFrameAnalysisTypes].
251        #[unsafe(method(setVideoFrameAnalysisTypes:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn setVideoFrameAnalysisTypes(
254            &self,
255            video_frame_analysis_types: AVVideoFrameAnalysisType,
256        );
257
258        /// Whether the magnify gesture will change the video's view magnification.
259        ///
260        /// The default value is NO. This property only effects whether the magnify gesture triggers magnification. A client can still programmatically change magnification even when the value of this is NO. This behavior matches the behavior of NSScrollView.
261        #[unsafe(method(allowsMagnification))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn allowsMagnification(&self) -> bool;
264
265        /// Setter for [`allowsMagnification`][Self::allowsMagnification].
266        #[unsafe(method(setAllowsMagnification:))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn setAllowsMagnification(&self, allows_magnification: bool);
269
270        #[cfg(feature = "objc2-core-foundation")]
271        /// The factor by which the video's view is currently scaled.
272        ///
273        /// The default value is 1.0. The value cannot be smaller than 1.0 or larger 64.0. Nearest neighbor interpolation will be used once the content has been zoomed past a certain factor.
274        #[unsafe(method(magnification))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn magnification(&self) -> CGFloat;
277
278        #[cfg(feature = "objc2-core-foundation")]
279        /// Setter for [`magnification`][Self::magnification].
280        #[unsafe(method(setMagnification:))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn setMagnification(&self, magnification: CGFloat);
283
284        #[cfg(feature = "objc2-core-foundation")]
285        /// Scales the video's view by a specified factor and centers the result on a specified point.
286        ///
287        /// Parameter `magnification`: The factor by which to scale the video's view.
288        ///
289        /// Parameter `point`: The point (in view space) on which to center magnification.
290        ///
291        /// The magnification cannot be smaller than 1.0 or larger 64.0. Nearest neighbor interpolation will be used once the content has been zoomed past a certain factor.
292        #[unsafe(method(setMagnification:centeredAtPoint:))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn setMagnification_centeredAtPoint(
295            &self,
296            magnification: CGFloat,
297            point: CGPoint,
298        );
299
300        #[cfg(feature = "AVKitTypes")]
301        /// Describes how High Dynamic Range (HDR) video content renders.
302        ///
303        /// Defaults to ``AVDisplayDynamicRangeAutomatic``.
304        ///
305        /// - Note: This property will only have effect if the video content supports HDR.
306        #[unsafe(method(preferredDisplayDynamicRange))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn preferredDisplayDynamicRange(&self) -> AVDisplayDynamicRange;
309
310        #[cfg(feature = "AVKitTypes")]
311        /// Setter for [`preferredDisplayDynamicRange`][Self::preferredDisplayDynamicRange].
312        #[unsafe(method(setPreferredDisplayDynamicRange:))]
313        #[unsafe(method_family = none)]
314        pub unsafe fn setPreferredDisplayDynamicRange(
315            &self,
316            preferred_display_dynamic_range: AVDisplayDynamicRange,
317        );
318    );
319}
320
321/// Methods declared on superclass `NSView`.
322#[cfg(feature = "objc2-app-kit")]
323#[cfg(target_os = "macos")]
324impl AVPlayerView {
325    extern_methods!(
326        #[unsafe(method(initWithFrame:))]
327        #[unsafe(method_family = init)]
328        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
329
330        /// # Safety
331        ///
332        /// `coder` possibly has further requirements.
333        #[unsafe(method(initWithCoder:))]
334        #[unsafe(method_family = init)]
335        pub unsafe fn initWithCoder(
336            this: Allocated<Self>,
337            coder: &NSCoder,
338        ) -> Option<Retained<Self>>;
339    );
340}
341
342/// Methods declared on superclass `NSResponder`.
343#[cfg(feature = "objc2-app-kit")]
344#[cfg(target_os = "macos")]
345impl AVPlayerView {
346    extern_methods!(
347        #[unsafe(method(init))]
348        #[unsafe(method_family = init)]
349        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
350    );
351}
352
353/// Methods declared on superclass `NSObject`.
354#[cfg(feature = "objc2-app-kit")]
355#[cfg(target_os = "macos")]
356impl AVPlayerView {
357    extern_methods!(
358        #[unsafe(method(new))]
359        #[unsafe(method_family = new)]
360        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
361    );
362}
363
364/// AVPlayerViewCustomization.
365#[cfg(feature = "objc2-app-kit")]
366#[cfg(target_os = "macos")]
367impl AVPlayerView {
368    extern_methods!(
369        /// Replace scanning controls in the playback UI with frame stepping buttons. Default is NO.
370        #[unsafe(method(showsFrameSteppingButtons))]
371        #[unsafe(method_family = none)]
372        pub unsafe fn showsFrameSteppingButtons(&self) -> bool;
373
374        /// Setter for [`showsFrameSteppingButtons`][Self::showsFrameSteppingButtons].
375        #[unsafe(method(setShowsFrameSteppingButtons:))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn setShowsFrameSteppingButtons(&self, shows_frame_stepping_buttons: bool);
378
379        /// Whether or not the controls pane will show a sharing service button when the current player item can be shared. Default is NO.
380        #[unsafe(method(showsSharingServiceButton))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn showsSharingServiceButton(&self) -> bool;
383
384        /// Setter for [`showsSharingServiceButton`][Self::showsSharingServiceButton].
385        #[unsafe(method(setShowsSharingServiceButton:))]
386        #[unsafe(method_family = none)]
387        pub unsafe fn setShowsSharingServiceButton(&self, shows_sharing_service_button: bool);
388
389        /// Clients can set this property in order to show an action pop up button. Default is nil.
390        #[unsafe(method(actionPopUpButtonMenu))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn actionPopUpButtonMenu(&self) -> Option<Retained<NSMenu>>;
393
394        /// Setter for [`actionPopUpButtonMenu`][Self::actionPopUpButtonMenu].
395        #[unsafe(method(setActionPopUpButtonMenu:))]
396        #[unsafe(method_family = none)]
397        pub unsafe fn setActionPopUpButtonMenu(&self, action_pop_up_button_menu: Option<&NSMenu>);
398
399        /// Whether or not the controls pane will show a full screen toggle button. Default is NO.
400        #[unsafe(method(showsFullScreenToggleButton))]
401        #[unsafe(method_family = none)]
402        pub unsafe fn showsFullScreenToggleButton(&self) -> bool;
403
404        /// Setter for [`showsFullScreenToggleButton`][Self::showsFullScreenToggleButton].
405        #[unsafe(method(setShowsFullScreenToggleButton:))]
406        #[unsafe(method_family = none)]
407        pub unsafe fn setShowsFullScreenToggleButton(&self, shows_full_screen_toggle_button: bool);
408
409        /// If timecodes are available, allow the AVPlayerView controls to enter timecode mode. Default is NO.
410        #[unsafe(method(showsTimecodes))]
411        #[unsafe(method_family = none)]
412        pub unsafe fn showsTimecodes(&self) -> bool;
413
414        /// Setter for [`showsTimecodes`][Self::showsTimecodes].
415        #[unsafe(method(setShowsTimecodes:))]
416        #[unsafe(method_family = none)]
417        pub unsafe fn setShowsTimecodes(&self, shows_timecodes: bool);
418    );
419}
420
421/// The user selected the Trim button.
422///
423/// The user selected the Cancel button.
424///
425/// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avplayerviewtrimresult?language=objc)
426// NS_ENUM
427#[repr(transparent)]
428#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
429pub struct AVPlayerViewTrimResult(pub NSInteger);
430impl AVPlayerViewTrimResult {
431    #[doc(alias = "AVPlayerViewTrimOKButton")]
432    pub const OKButton: Self = Self(0);
433    #[doc(alias = "AVPlayerViewTrimCancelButton")]
434    pub const CancelButton: Self = Self(1);
435}
436
437unsafe impl Encode for AVPlayerViewTrimResult {
438    const ENCODING: Encoding = NSInteger::ENCODING;
439}
440
441unsafe impl RefEncode for AVPlayerViewTrimResult {
442    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
443}
444
445/// AVPlayerViewTrimming.
446#[cfg(feature = "objc2-app-kit")]
447#[cfg(target_os = "macos")]
448impl AVPlayerView {
449    extern_methods!(
450        /// Whether or not the current media can be trimmed.
451        #[unsafe(method(canBeginTrimming))]
452        #[unsafe(method_family = none)]
453        pub unsafe fn canBeginTrimming(&self) -> bool;
454
455        #[cfg(feature = "block2")]
456        /// Parameter `handler`: A completion handler that is executed when the user selects either the Trim or Cancel button in the trimming UI.
457        ///
458        /// Sets the controls panel into trimming mode and blocks until the user selects either the Trim or the Cancel button.
459        #[unsafe(method(beginTrimmingWithCompletionHandler:))]
460        #[unsafe(method_family = none)]
461        pub unsafe fn beginTrimmingWithCompletionHandler(
462            &self,
463            handler: Option<&block2::DynBlock<dyn Fn(AVPlayerViewTrimResult)>>,
464        );
465    );
466}
467
468/// AVPlayerViewChapterIndicator.
469#[cfg(feature = "objc2-app-kit")]
470#[cfg(target_os = "macos")]
471impl AVPlayerView {
472    extern_methods!(
473        /// Parameter `chapterNumber`: The chapter number (required).
474        ///
475        /// Parameter `chapterTitle`: The chapter title (optional).
476        ///
477        /// Display the provided chapter number and title momentarily.
478        #[unsafe(method(flashChapterNumber:chapterTitle:))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn flashChapterNumber_chapterTitle(
481            &self,
482            chapter_number: NSUInteger,
483            chapter_title: Option<&NSString>,
484        );
485    );
486}
487
488/// AVPlayerViewPictureInPictureSupport.
489#[cfg(feature = "objc2-app-kit")]
490#[cfg(target_os = "macos")]
491impl AVPlayerView {
492    extern_methods!(
493        /// Whether or not the receiver allows Picture in Picture playback. Default is NO.
494        #[unsafe(method(allowsPictureInPicturePlayback))]
495        #[unsafe(method_family = none)]
496        pub unsafe fn allowsPictureInPicturePlayback(&self) -> bool;
497
498        /// Setter for [`allowsPictureInPicturePlayback`][Self::allowsPictureInPicturePlayback].
499        #[unsafe(method(setAllowsPictureInPicturePlayback:))]
500        #[unsafe(method_family = none)]
501        pub unsafe fn setAllowsPictureInPicturePlayback(
502            &self,
503            allows_picture_in_picture_playback: bool,
504        );
505
506        /// A delegate for customizing Picture in Picture playback experience.
507        #[unsafe(method(pictureInPictureDelegate))]
508        #[unsafe(method_family = none)]
509        pub unsafe fn pictureInPictureDelegate(
510            &self,
511        ) -> Option<Retained<ProtocolObject<dyn AVPlayerViewPictureInPictureDelegate>>>;
512
513        /// Setter for [`pictureInPictureDelegate`][Self::pictureInPictureDelegate].
514        ///
515        /// This is a [weak property][objc2::topics::weak_property].
516        #[unsafe(method(setPictureInPictureDelegate:))]
517        #[unsafe(method_family = none)]
518        pub unsafe fn setPictureInPictureDelegate(
519            &self,
520            picture_in_picture_delegate: Option<
521                &ProtocolObject<dyn AVPlayerViewPictureInPictureDelegate>,
522            >,
523        );
524    );
525}
526
527extern_protocol!(
528    /// A protocol for delegates of AVPlayerView.
529    ///
530    /// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avplayerviewdelegate?language=objc)
531    pub unsafe trait AVPlayerViewDelegate: NSObjectProtocol {
532        #[cfg(feature = "objc2-app-kit")]
533        #[cfg(target_os = "macos")]
534        /// Parameter `playerView`: The player view.
535        ///
536        /// The delegate can implement this method to be notified when the AVPlayerView will enter full screen.
537        #[optional]
538        #[unsafe(method(playerViewWillEnterFullScreen:))]
539        #[unsafe(method_family = none)]
540        unsafe fn playerViewWillEnterFullScreen(&self, player_view: &AVPlayerView);
541
542        #[cfg(feature = "objc2-app-kit")]
543        #[cfg(target_os = "macos")]
544        /// Parameter `playerView`: The player view.
545        ///
546        /// The delegate can implement this method to be notified when the AVPlayerView did enter full screen.
547        #[optional]
548        #[unsafe(method(playerViewDidEnterFullScreen:))]
549        #[unsafe(method_family = none)]
550        unsafe fn playerViewDidEnterFullScreen(&self, player_view: &AVPlayerView);
551
552        #[cfg(feature = "objc2-app-kit")]
553        #[cfg(target_os = "macos")]
554        /// Parameter `playerView`: The player view.
555        ///
556        /// The delegate can implement this method to be notified when the AVPlayerView will exit full screen.
557        #[optional]
558        #[unsafe(method(playerViewWillExitFullScreen:))]
559        #[unsafe(method_family = none)]
560        unsafe fn playerViewWillExitFullScreen(&self, player_view: &AVPlayerView);
561
562        #[cfg(feature = "objc2-app-kit")]
563        #[cfg(target_os = "macos")]
564        /// Parameter `playerView`: The player view.
565        ///
566        /// The delegate can implement this method to be notified when the AVPlayerView did exit full screen.
567        #[optional]
568        #[unsafe(method(playerViewDidExitFullScreen:))]
569        #[unsafe(method_family = none)]
570        unsafe fn playerViewDidExitFullScreen(&self, player_view: &AVPlayerView);
571
572        #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
573        #[cfg(target_os = "macos")]
574        /// Parameter `playerView`: The player view.
575        ///
576        /// Parameter `completionHandler`: The completion handler the delegate must call after restoring the interface for an exit full screen transition.
577        ///
578        /// The delegate can implement this method to restore the user interface before exiting fullscreen.
579        #[optional]
580        #[unsafe(method(playerView:restoreUserInterfaceForFullScreenExitWithCompletionHandler:))]
581        #[unsafe(method_family = none)]
582        unsafe fn playerView_restoreUserInterfaceForFullScreenExitWithCompletionHandler(
583            &self,
584            player_view: &AVPlayerView,
585            completion_handler: &block2::DynBlock<dyn Fn(Bool)>,
586        );
587    }
588);
589
590extern_protocol!(
591    /// [Apple's documentation](https://developer.apple.com/documentation/avkit/avplayerviewpictureinpicturedelegate?language=objc)
592    pub unsafe trait AVPlayerViewPictureInPictureDelegate: NSObjectProtocol {
593        #[cfg(feature = "objc2-app-kit")]
594        #[cfg(target_os = "macos")]
595        /// Parameter `playerView`: The player view.
596        ///
597        /// Delegate can implement this method to be notified when Picture in Picture will start.
598        #[optional]
599        #[unsafe(method(playerViewWillStartPictureInPicture:))]
600        #[unsafe(method_family = none)]
601        unsafe fn playerViewWillStartPictureInPicture(&self, player_view: &AVPlayerView);
602
603        #[cfg(feature = "objc2-app-kit")]
604        #[cfg(target_os = "macos")]
605        /// Parameter `playerView`: The player view.
606        ///
607        /// Delegate can implement this method to be notified when Picture in Picture did start.
608        #[optional]
609        #[unsafe(method(playerViewDidStartPictureInPicture:))]
610        #[unsafe(method_family = none)]
611        unsafe fn playerViewDidStartPictureInPicture(&self, player_view: &AVPlayerView);
612
613        #[cfg(feature = "objc2-app-kit")]
614        #[cfg(target_os = "macos")]
615        /// Parameter `playerView`: The player view.
616        ///
617        /// Parameter `error`: An error describing why it failed.
618        ///
619        /// Delegate can implement this method to be notified when Picture in Picture failed to start.
620        #[optional]
621        #[unsafe(method(playerView:failedToStartPictureInPictureWithError:))]
622        #[unsafe(method_family = none)]
623        unsafe fn playerView_failedToStartPictureInPictureWithError(
624            &self,
625            player_view: &AVPlayerView,
626            error: &NSError,
627        );
628
629        #[cfg(feature = "objc2-app-kit")]
630        #[cfg(target_os = "macos")]
631        /// Parameter `playerView`: The player view.
632        ///
633        /// Delegate can implement this method to be notified when Picture in Picture will stop.
634        #[optional]
635        #[unsafe(method(playerViewWillStopPictureInPicture:))]
636        #[unsafe(method_family = none)]
637        unsafe fn playerViewWillStopPictureInPicture(&self, player_view: &AVPlayerView);
638
639        #[cfg(feature = "objc2-app-kit")]
640        #[cfg(target_os = "macos")]
641        /// Parameter `playerView`: The player view.
642        ///
643        /// Delegate can implement this method to be notified when Picture in Picture did stop.
644        #[optional]
645        #[unsafe(method(playerViewDidStopPictureInPicture:))]
646        #[unsafe(method_family = none)]
647        unsafe fn playerViewDidStopPictureInPicture(&self, player_view: &AVPlayerView);
648
649        #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
650        #[cfg(target_os = "macos")]
651        /// Parameter `playerView`: The player view.
652        ///
653        /// Parameter `completionHandler`: The completion handler the delegate needs to call after restore.
654        ///
655        /// Delegate can implement this method to restore the user interface before Picture in Picture stops.
656        #[optional]
657        #[unsafe(method(playerView:restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:))]
658        #[unsafe(method_family = none)]
659        unsafe fn playerView_restoreUserInterfaceForPictureInPictureStopWithCompletionHandler(
660            &self,
661            player_view: &AVPlayerView,
662            completion_handler: &block2::DynBlock<dyn Fn(Bool)>,
663        );
664
665        #[cfg(feature = "objc2-app-kit")]
666        #[cfg(target_os = "macos")]
667        /// Parameter `playerView`: The player view.
668        ///
669        /// Delegate can implement this method and return NO to prevent player view from automatically being miniaturized or losing focus when Picture in Picture starts.
670        #[optional]
671        #[unsafe(method(playerViewShouldAutomaticallyDismissAtPictureInPictureStart:))]
672        #[unsafe(method_family = none)]
673        unsafe fn playerViewShouldAutomaticallyDismissAtPictureInPictureStart(
674            &self,
675            player_view: &AVPlayerView,
676        ) -> bool;
677    }
678);