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