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        #[unsafe(method(setVideoGravity:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setVideoGravity(&self, video_gravity: &AVLayerVideoGravity);
153
154        /// Boolean indicating that the first video frame has been made ready for display for the current item of the associated AVPlayer.
155        #[unsafe(method(isReadyForDisplay))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn isReadyForDisplay(&self) -> bool;
158
159        /// The current size and position of the video image as displayed within the receiver's view's bounds.
160        #[unsafe(method(videoBounds))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn videoBounds(&self) -> NSRect;
163
164        /// Use the content overlay view to add additional custom views between the video content and the controls.
165        #[unsafe(method(contentOverlayView))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn contentOverlayView(&self) -> Option<Retained<NSView>>;
168
169        /// Whether or not the now playing info center should be updated. Default is YES.
170        #[unsafe(method(updatesNowPlayingInfoCenter))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn updatesNowPlayingInfoCenter(&self) -> bool;
173
174        /// Setter for [`updatesNowPlayingInfoCenter`][Self::updatesNowPlayingInfoCenter].
175        #[unsafe(method(setUpdatesNowPlayingInfoCenter:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn setUpdatesNowPlayingInfoCenter(&self, updates_now_playing_info_center: bool);
178
179        /// The receiver's delegate.
180        #[unsafe(method(delegate))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn delegate(&self)
183            -> Option<Retained<ProtocolObject<dyn AVPlayerViewDelegate>>>;
184
185        /// This is a [weak property][objc2::topics::weak_property].
186        /// Setter for [`delegate`][Self::delegate].
187        #[unsafe(method(setDelegate:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn setDelegate(
190            &self,
191            delegate: Option<&ProtocolObject<dyn AVPlayerViewDelegate>>,
192        );
193
194        #[cfg(feature = "AVPlaybackSpeed")]
195        /// A list of user selectable playback speeds to be shown in the playback speed control.
196        ///
197        /// By default this property will be set to the systemDefaultSpeeds class property. Setting this property to nil will hide the playback speed selection UI.
198        ///
199        /// 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.
200        #[unsafe(method(speeds))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn speeds(&self) -> Retained<NSArray<AVPlaybackSpeed>>;
203
204        #[cfg(feature = "AVPlaybackSpeed")]
205        /// Setter for [`speeds`][Self::speeds].
206        #[unsafe(method(setSpeeds:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setSpeeds(&self, speeds: &NSArray<AVPlaybackSpeed>);
209
210        #[cfg(feature = "AVPlaybackSpeed")]
211        /// The currently selected playback speed.
212        ///
213        /// 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.
214        #[unsafe(method(selectedSpeed))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn selectedSpeed(&self) -> Option<Retained<AVPlaybackSpeed>>;
217
218        #[cfg(feature = "AVPlaybackSpeed")]
219        /// Parameter `speed`: The playback speed to select.
220        ///
221        /// Sets the input AVPlaybackSpeed as the selected speed.
222        ///
223        /// Calls to selectSpeed with AVPlaybackSpeeds not contained within the speeds property array will be ignored.
224        #[unsafe(method(selectSpeed:))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn selectSpeed(&self, speed: &AVPlaybackSpeed);
227
228        /// 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.
229        #[unsafe(method(allowsVideoFrameAnalysis))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn allowsVideoFrameAnalysis(&self) -> bool;
232
233        /// Setter for [`allowsVideoFrameAnalysis`][Self::allowsVideoFrameAnalysis].
234        #[unsafe(method(setAllowsVideoFrameAnalysis:))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn setAllowsVideoFrameAnalysis(&self, allows_video_frame_analysis: bool);
237
238        #[cfg(feature = "AVKitTypes")]
239        /// The types of items AVPlayerView looks for in a paused video frame.
240        #[unsafe(method(videoFrameAnalysisTypes))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn videoFrameAnalysisTypes(&self) -> AVVideoFrameAnalysisType;
243
244        #[cfg(feature = "AVKitTypes")]
245        /// Setter for [`videoFrameAnalysisTypes`][Self::videoFrameAnalysisTypes].
246        #[unsafe(method(setVideoFrameAnalysisTypes:))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn setVideoFrameAnalysisTypes(
249            &self,
250            video_frame_analysis_types: AVVideoFrameAnalysisType,
251        );
252
253        /// Whether the magnify gesture will change the video's view magnification.
254        ///
255        /// 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.
256        #[unsafe(method(allowsMagnification))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn allowsMagnification(&self) -> bool;
259
260        /// Setter for [`allowsMagnification`][Self::allowsMagnification].
261        #[unsafe(method(setAllowsMagnification:))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn setAllowsMagnification(&self, allows_magnification: bool);
264
265        #[cfg(feature = "objc2-core-foundation")]
266        /// The factor by which the video's view is currently scaled.
267        ///
268        /// 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.
269        #[unsafe(method(magnification))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn magnification(&self) -> CGFloat;
272
273        #[cfg(feature = "objc2-core-foundation")]
274        /// Setter for [`magnification`][Self::magnification].
275        #[unsafe(method(setMagnification:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn setMagnification(&self, magnification: CGFloat);
278
279        #[cfg(feature = "objc2-core-foundation")]
280        /// Scales the video's view by a specified factor and centers the result on a specified point.
281        ///
282        /// Parameter `magnification`: The factor by which to scale the video's view.
283        ///
284        /// Parameter `point`: The point (in view space) on which to center magnification.
285        ///
286        /// 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.
287        #[unsafe(method(setMagnification:centeredAtPoint:))]
288        #[unsafe(method_family = none)]
289        pub unsafe fn setMagnification_centeredAtPoint(
290            &self,
291            magnification: CGFloat,
292            point: CGPoint,
293        );
294    );
295}
296
297/// Methods declared on superclass `NSView`.
298#[cfg(feature = "objc2-app-kit")]
299#[cfg(target_os = "macos")]
300impl AVPlayerView {
301    extern_methods!(
302        #[unsafe(method(initWithFrame:))]
303        #[unsafe(method_family = init)]
304        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
305
306        #[unsafe(method(initWithCoder:))]
307        #[unsafe(method_family = init)]
308        pub unsafe fn initWithCoder(
309            this: Allocated<Self>,
310            coder: &NSCoder,
311        ) -> Option<Retained<Self>>;
312    );
313}
314
315/// Methods declared on superclass `NSResponder`.
316#[cfg(feature = "objc2-app-kit")]
317#[cfg(target_os = "macos")]
318impl AVPlayerView {
319    extern_methods!(
320        #[unsafe(method(init))]
321        #[unsafe(method_family = init)]
322        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
323    );
324}
325
326/// Methods declared on superclass `NSObject`.
327#[cfg(feature = "objc2-app-kit")]
328#[cfg(target_os = "macos")]
329impl AVPlayerView {
330    extern_methods!(
331        #[unsafe(method(new))]
332        #[unsafe(method_family = new)]
333        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
334    );
335}
336
337/// AVPlayerViewCustomization.
338#[cfg(feature = "objc2-app-kit")]
339#[cfg(target_os = "macos")]
340impl AVPlayerView {
341    extern_methods!(
342        /// Replace scanning controls in the playback UI with frame stepping buttons. Default is NO.
343        #[unsafe(method(showsFrameSteppingButtons))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn showsFrameSteppingButtons(&self) -> bool;
346
347        /// Setter for [`showsFrameSteppingButtons`][Self::showsFrameSteppingButtons].
348        #[unsafe(method(setShowsFrameSteppingButtons:))]
349        #[unsafe(method_family = none)]
350        pub unsafe fn setShowsFrameSteppingButtons(&self, shows_frame_stepping_buttons: bool);
351
352        /// Whether or not the controls pane will show a sharing service button when the current player item can be shared. Default is NO.
353        #[unsafe(method(showsSharingServiceButton))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn showsSharingServiceButton(&self) -> bool;
356
357        /// Setter for [`showsSharingServiceButton`][Self::showsSharingServiceButton].
358        #[unsafe(method(setShowsSharingServiceButton:))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn setShowsSharingServiceButton(&self, shows_sharing_service_button: bool);
361
362        /// Clients can set this property in order to show an action pop up button. Default is nil.
363        #[unsafe(method(actionPopUpButtonMenu))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn actionPopUpButtonMenu(&self) -> Option<Retained<NSMenu>>;
366
367        /// Setter for [`actionPopUpButtonMenu`][Self::actionPopUpButtonMenu].
368        #[unsafe(method(setActionPopUpButtonMenu:))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn setActionPopUpButtonMenu(&self, action_pop_up_button_menu: Option<&NSMenu>);
371
372        /// Whether or not the controls pane will show a full screen toggle button. Default is NO.
373        #[unsafe(method(showsFullScreenToggleButton))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn showsFullScreenToggleButton(&self) -> bool;
376
377        /// Setter for [`showsFullScreenToggleButton`][Self::showsFullScreenToggleButton].
378        #[unsafe(method(setShowsFullScreenToggleButton:))]
379        #[unsafe(method_family = none)]
380        pub unsafe fn setShowsFullScreenToggleButton(&self, shows_full_screen_toggle_button: bool);
381
382        /// If timecodes are available, allow the AVPlayerView controls to enter timecode mode. Default is NO.
383        #[unsafe(method(showsTimecodes))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn showsTimecodes(&self) -> bool;
386
387        /// Setter for [`showsTimecodes`][Self::showsTimecodes].
388        #[unsafe(method(setShowsTimecodes:))]
389        #[unsafe(method_family = none)]
390        pub unsafe fn setShowsTimecodes(&self, shows_timecodes: bool);
391    );
392}
393
394/// The user selected the Trim button.
395///
396/// The user selected the Cancel button.
397///
398/// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avplayerviewtrimresult?language=objc)
399// NS_ENUM
400#[repr(transparent)]
401#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
402pub struct AVPlayerViewTrimResult(pub NSInteger);
403impl AVPlayerViewTrimResult {
404    #[doc(alias = "AVPlayerViewTrimOKButton")]
405    pub const OKButton: Self = Self(0);
406    #[doc(alias = "AVPlayerViewTrimCancelButton")]
407    pub const CancelButton: Self = Self(1);
408}
409
410unsafe impl Encode for AVPlayerViewTrimResult {
411    const ENCODING: Encoding = NSInteger::ENCODING;
412}
413
414unsafe impl RefEncode for AVPlayerViewTrimResult {
415    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
416}
417
418/// AVPlayerViewTrimming.
419#[cfg(feature = "objc2-app-kit")]
420#[cfg(target_os = "macos")]
421impl AVPlayerView {
422    extern_methods!(
423        /// Whether or not the current media can be trimmed.
424        #[unsafe(method(canBeginTrimming))]
425        #[unsafe(method_family = none)]
426        pub unsafe fn canBeginTrimming(&self) -> bool;
427
428        #[cfg(feature = "block2")]
429        /// Parameter `handler`: A completion handler that is executed when the user selects either the Trim or Cancel button in the trimming UI.
430        ///
431        /// Sets the controls panel into trimming mode and blocks until the user selects either the Trim or the Cancel button.
432        #[unsafe(method(beginTrimmingWithCompletionHandler:))]
433        #[unsafe(method_family = none)]
434        pub unsafe fn beginTrimmingWithCompletionHandler(
435            &self,
436            handler: Option<&block2::DynBlock<dyn Fn(AVPlayerViewTrimResult)>>,
437        );
438    );
439}
440
441/// AVPlayerViewChapterIndicator.
442#[cfg(feature = "objc2-app-kit")]
443#[cfg(target_os = "macos")]
444impl AVPlayerView {
445    extern_methods!(
446        /// Parameter `chapterNumber`: The chapter number (required).
447        ///
448        /// Parameter `chapterTitle`: The chapter title (optional).
449        ///
450        /// Display the provided chapter number and title momentarily.
451        #[unsafe(method(flashChapterNumber:chapterTitle:))]
452        #[unsafe(method_family = none)]
453        pub unsafe fn flashChapterNumber_chapterTitle(
454            &self,
455            chapter_number: NSUInteger,
456            chapter_title: Option<&NSString>,
457        );
458    );
459}
460
461/// AVPlayerViewPictureInPictureSupport.
462#[cfg(feature = "objc2-app-kit")]
463#[cfg(target_os = "macos")]
464impl AVPlayerView {
465    extern_methods!(
466        /// Whether or not the receiver allows Picture in Picture playback. Default is NO.
467        #[unsafe(method(allowsPictureInPicturePlayback))]
468        #[unsafe(method_family = none)]
469        pub unsafe fn allowsPictureInPicturePlayback(&self) -> bool;
470
471        /// Setter for [`allowsPictureInPicturePlayback`][Self::allowsPictureInPicturePlayback].
472        #[unsafe(method(setAllowsPictureInPicturePlayback:))]
473        #[unsafe(method_family = none)]
474        pub unsafe fn setAllowsPictureInPicturePlayback(
475            &self,
476            allows_picture_in_picture_playback: bool,
477        );
478
479        /// A delegate for customizing Picture in Picture playback experience.
480        #[unsafe(method(pictureInPictureDelegate))]
481        #[unsafe(method_family = none)]
482        pub unsafe fn pictureInPictureDelegate(
483            &self,
484        ) -> Option<Retained<ProtocolObject<dyn AVPlayerViewPictureInPictureDelegate>>>;
485
486        /// This is a [weak property][objc2::topics::weak_property].
487        /// Setter for [`pictureInPictureDelegate`][Self::pictureInPictureDelegate].
488        #[unsafe(method(setPictureInPictureDelegate:))]
489        #[unsafe(method_family = none)]
490        pub unsafe fn setPictureInPictureDelegate(
491            &self,
492            picture_in_picture_delegate: Option<
493                &ProtocolObject<dyn AVPlayerViewPictureInPictureDelegate>,
494            >,
495        );
496    );
497}
498
499extern_protocol!(
500    /// A protocol for delegates of AVPlayerView.
501    ///
502    /// See also [Apple's documentation](https://developer.apple.com/documentation/avkit/avplayerviewdelegate?language=objc)
503    pub unsafe trait AVPlayerViewDelegate: NSObjectProtocol {
504        #[cfg(feature = "objc2-app-kit")]
505        #[cfg(target_os = "macos")]
506        /// Parameter `playerView`: The player view.
507        ///
508        /// The delegate can implement this method to be notified when the AVPlayerView will enter full screen.
509        #[optional]
510        #[unsafe(method(playerViewWillEnterFullScreen:))]
511        #[unsafe(method_family = none)]
512        unsafe fn playerViewWillEnterFullScreen(&self, player_view: &AVPlayerView);
513
514        #[cfg(feature = "objc2-app-kit")]
515        #[cfg(target_os = "macos")]
516        /// Parameter `playerView`: The player view.
517        ///
518        /// The delegate can implement this method to be notified when the AVPlayerView did enter full screen.
519        #[optional]
520        #[unsafe(method(playerViewDidEnterFullScreen:))]
521        #[unsafe(method_family = none)]
522        unsafe fn playerViewDidEnterFullScreen(&self, player_view: &AVPlayerView);
523
524        #[cfg(feature = "objc2-app-kit")]
525        #[cfg(target_os = "macos")]
526        /// Parameter `playerView`: The player view.
527        ///
528        /// The delegate can implement this method to be notified when the AVPlayerView will exit full screen.
529        #[optional]
530        #[unsafe(method(playerViewWillExitFullScreen:))]
531        #[unsafe(method_family = none)]
532        unsafe fn playerViewWillExitFullScreen(&self, player_view: &AVPlayerView);
533
534        #[cfg(feature = "objc2-app-kit")]
535        #[cfg(target_os = "macos")]
536        /// Parameter `playerView`: The player view.
537        ///
538        /// The delegate can implement this method to be notified when the AVPlayerView did exit full screen.
539        #[optional]
540        #[unsafe(method(playerViewDidExitFullScreen:))]
541        #[unsafe(method_family = none)]
542        unsafe fn playerViewDidExitFullScreen(&self, player_view: &AVPlayerView);
543
544        #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
545        #[cfg(target_os = "macos")]
546        /// Parameter `playerView`: The player view.
547        ///
548        /// Parameter `completionHandler`: The completion handler the delegate must call after restoring the interface for an exit full screen transition.
549        ///
550        /// The delegate can implement this method to restore the user interface before exiting fullscreen.
551        #[optional]
552        #[unsafe(method(playerView:restoreUserInterfaceForFullScreenExitWithCompletionHandler:))]
553        #[unsafe(method_family = none)]
554        unsafe fn playerView_restoreUserInterfaceForFullScreenExitWithCompletionHandler(
555            &self,
556            player_view: &AVPlayerView,
557            completion_handler: &block2::DynBlock<dyn Fn(Bool)>,
558        );
559    }
560);
561
562extern_protocol!(
563    /// [Apple's documentation](https://developer.apple.com/documentation/avkit/avplayerviewpictureinpicturedelegate?language=objc)
564    pub unsafe trait AVPlayerViewPictureInPictureDelegate: NSObjectProtocol {
565        #[cfg(feature = "objc2-app-kit")]
566        #[cfg(target_os = "macos")]
567        /// Parameter `playerView`: The player view.
568        ///
569        /// Delegate can implement this method to be notified when Picture in Picture will start.
570        #[optional]
571        #[unsafe(method(playerViewWillStartPictureInPicture:))]
572        #[unsafe(method_family = none)]
573        unsafe fn playerViewWillStartPictureInPicture(&self, player_view: &AVPlayerView);
574
575        #[cfg(feature = "objc2-app-kit")]
576        #[cfg(target_os = "macos")]
577        /// Parameter `playerView`: The player view.
578        ///
579        /// Delegate can implement this method to be notified when Picture in Picture did start.
580        #[optional]
581        #[unsafe(method(playerViewDidStartPictureInPicture:))]
582        #[unsafe(method_family = none)]
583        unsafe fn playerViewDidStartPictureInPicture(&self, player_view: &AVPlayerView);
584
585        #[cfg(feature = "objc2-app-kit")]
586        #[cfg(target_os = "macos")]
587        /// Parameter `playerView`: The player view.
588        ///
589        /// Parameter `error`: An error describing why it failed.
590        ///
591        /// Delegate can implement this method to be notified when Picture in Picture failed to start.
592        #[optional]
593        #[unsafe(method(playerView:failedToStartPictureInPictureWithError:))]
594        #[unsafe(method_family = none)]
595        unsafe fn playerView_failedToStartPictureInPictureWithError(
596            &self,
597            player_view: &AVPlayerView,
598            error: &NSError,
599        );
600
601        #[cfg(feature = "objc2-app-kit")]
602        #[cfg(target_os = "macos")]
603        /// Parameter `playerView`: The player view.
604        ///
605        /// Delegate can implement this method to be notified when Picture in Picture will stop.
606        #[optional]
607        #[unsafe(method(playerViewWillStopPictureInPicture:))]
608        #[unsafe(method_family = none)]
609        unsafe fn playerViewWillStopPictureInPicture(&self, player_view: &AVPlayerView);
610
611        #[cfg(feature = "objc2-app-kit")]
612        #[cfg(target_os = "macos")]
613        /// Parameter `playerView`: The player view.
614        ///
615        /// Delegate can implement this method to be notified when Picture in Picture did stop.
616        #[optional]
617        #[unsafe(method(playerViewDidStopPictureInPicture:))]
618        #[unsafe(method_family = none)]
619        unsafe fn playerViewDidStopPictureInPicture(&self, player_view: &AVPlayerView);
620
621        #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
622        #[cfg(target_os = "macos")]
623        /// Parameter `playerView`: The player view.
624        ///
625        /// Parameter `completionHandler`: The completion handler the delegate needs to call after restore.
626        ///
627        /// Delegate can implement this method to restore the user interface before Picture in Picture stops.
628        #[optional]
629        #[unsafe(method(playerView:restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:))]
630        #[unsafe(method_family = none)]
631        unsafe fn playerView_restoreUserInterfaceForPictureInPictureStopWithCompletionHandler(
632            &self,
633            player_view: &AVPlayerView,
634            completion_handler: &block2::DynBlock<dyn Fn(Bool)>,
635        );
636
637        #[cfg(feature = "objc2-app-kit")]
638        #[cfg(target_os = "macos")]
639        /// Parameter `playerView`: The player view.
640        ///
641        /// Delegate can implement this method and return NO to prevent player view from automatically being miniaturized or losing focus when Picture in Picture starts.
642        #[optional]
643        #[unsafe(method(playerViewShouldAutomaticallyDismissAtPictureInPictureStart:))]
644        #[unsafe(method_family = none)]
645        unsafe fn playerViewShouldAutomaticallyDismissAtPictureInPictureStart(
646            &self,
647            player_view: &AVPlayerView,
648        ) -> bool;
649    }
650);