objc2_av_kit/generated/
AVPlayerView.rs1use 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#[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 #[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 #[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 #[unsafe(method(setPlayer:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn setPlayer(&self, player: Option<&AVPlayer>);
127
128 #[unsafe(method(controlsStyle))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn controlsStyle(&self) -> AVPlayerViewControlsStyle;
134
135 #[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 #[unsafe(method(videoGravity))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn videoGravity(&self) -> Retained<AVLayerVideoGravity>;
147
148 #[cfg(feature = "objc2-av-foundation")]
149 #[unsafe(method(setVideoGravity:))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn setVideoGravity(&self, video_gravity: &AVLayerVideoGravity);
153
154 #[unsafe(method(isReadyForDisplay))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn isReadyForDisplay(&self) -> bool;
158
159 #[unsafe(method(videoBounds))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn videoBounds(&self) -> NSRect;
163
164 #[unsafe(method(contentOverlayView))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn contentOverlayView(&self) -> Option<Retained<NSView>>;
168
169 #[unsafe(method(updatesNowPlayingInfoCenter))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn updatesNowPlayingInfoCenter(&self) -> bool;
173
174 #[unsafe(method(setUpdatesNowPlayingInfoCenter:))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn setUpdatesNowPlayingInfoCenter(&self, updates_now_playing_info_center: bool);
178
179 #[unsafe(method(delegate))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn delegate(&self)
183 -> Option<Retained<ProtocolObject<dyn AVPlayerViewDelegate>>>;
184
185 #[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 #[unsafe(method(speeds))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn speeds(&self) -> Retained<NSArray<AVPlaybackSpeed>>;
203
204 #[cfg(feature = "AVPlaybackSpeed")]
205 #[unsafe(method(setSpeeds:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn setSpeeds(&self, speeds: &NSArray<AVPlaybackSpeed>);
209
210 #[cfg(feature = "AVPlaybackSpeed")]
211 #[unsafe(method(selectedSpeed))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn selectedSpeed(&self) -> Option<Retained<AVPlaybackSpeed>>;
217
218 #[cfg(feature = "AVPlaybackSpeed")]
219 #[unsafe(method(selectSpeed:))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn selectSpeed(&self, speed: &AVPlaybackSpeed);
227
228 #[unsafe(method(allowsVideoFrameAnalysis))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn allowsVideoFrameAnalysis(&self) -> bool;
232
233 #[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 #[unsafe(method(videoFrameAnalysisTypes))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn videoFrameAnalysisTypes(&self) -> AVVideoFrameAnalysisType;
243
244 #[cfg(feature = "AVKitTypes")]
245 #[unsafe(method(setVideoFrameAnalysisTypes:))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn setVideoFrameAnalysisTypes(
249 &self,
250 video_frame_analysis_types: AVVideoFrameAnalysisType,
251 );
252
253 #[unsafe(method(allowsMagnification))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn allowsMagnification(&self) -> bool;
259
260 #[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 #[unsafe(method(magnification))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn magnification(&self) -> CGFloat;
272
273 #[cfg(feature = "objc2-core-foundation")]
274 #[unsafe(method(setMagnification:))]
276 #[unsafe(method_family = none)]
277 pub unsafe fn setMagnification(&self, magnification: CGFloat);
278
279 #[cfg(feature = "objc2-core-foundation")]
280 #[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#[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#[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#[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#[cfg(feature = "objc2-app-kit")]
339#[cfg(target_os = "macos")]
340impl AVPlayerView {
341 extern_methods!(
342 #[unsafe(method(showsFrameSteppingButtons))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn showsFrameSteppingButtons(&self) -> bool;
346
347 #[unsafe(method(setShowsFrameSteppingButtons:))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn setShowsFrameSteppingButtons(&self, shows_frame_stepping_buttons: bool);
351
352 #[unsafe(method(showsSharingServiceButton))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn showsSharingServiceButton(&self) -> bool;
356
357 #[unsafe(method(setShowsSharingServiceButton:))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn setShowsSharingServiceButton(&self, shows_sharing_service_button: bool);
361
362 #[unsafe(method(actionPopUpButtonMenu))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn actionPopUpButtonMenu(&self) -> Option<Retained<NSMenu>>;
366
367 #[unsafe(method(setActionPopUpButtonMenu:))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn setActionPopUpButtonMenu(&self, action_pop_up_button_menu: Option<&NSMenu>);
371
372 #[unsafe(method(showsFullScreenToggleButton))]
374 #[unsafe(method_family = none)]
375 pub unsafe fn showsFullScreenToggleButton(&self) -> bool;
376
377 #[unsafe(method(setShowsFullScreenToggleButton:))]
379 #[unsafe(method_family = none)]
380 pub unsafe fn setShowsFullScreenToggleButton(&self, shows_full_screen_toggle_button: bool);
381
382 #[unsafe(method(showsTimecodes))]
384 #[unsafe(method_family = none)]
385 pub unsafe fn showsTimecodes(&self) -> bool;
386
387 #[unsafe(method(setShowsTimecodes:))]
389 #[unsafe(method_family = none)]
390 pub unsafe fn setShowsTimecodes(&self, shows_timecodes: bool);
391 );
392}
393
394#[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#[cfg(feature = "objc2-app-kit")]
420#[cfg(target_os = "macos")]
421impl AVPlayerView {
422 extern_methods!(
423 #[unsafe(method(canBeginTrimming))]
425 #[unsafe(method_family = none)]
426 pub unsafe fn canBeginTrimming(&self) -> bool;
427
428 #[cfg(feature = "block2")]
429 #[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#[cfg(feature = "objc2-app-kit")]
443#[cfg(target_os = "macos")]
444impl AVPlayerView {
445 extern_methods!(
446 #[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#[cfg(feature = "objc2-app-kit")]
463#[cfg(target_os = "macos")]
464impl AVPlayerView {
465 extern_methods!(
466 #[unsafe(method(allowsPictureInPicturePlayback))]
468 #[unsafe(method_family = none)]
469 pub unsafe fn allowsPictureInPicturePlayback(&self) -> bool;
470
471 #[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 #[unsafe(method(pictureInPictureDelegate))]
481 #[unsafe(method_family = none)]
482 pub unsafe fn pictureInPictureDelegate(
483 &self,
484 ) -> Option<Retained<ProtocolObject<dyn AVPlayerViewPictureInPictureDelegate>>>;
485
486 #[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 pub unsafe trait AVPlayerViewDelegate: NSObjectProtocol {
504 #[cfg(feature = "objc2-app-kit")]
505 #[cfg(target_os = "macos")]
506 #[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 #[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 #[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 #[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 #[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 pub unsafe trait AVPlayerViewPictureInPictureDelegate: NSObjectProtocol {
565 #[cfg(feature = "objc2-app-kit")]
566 #[cfg(target_os = "macos")]
567 #[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 #[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 #[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 #[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 #[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 #[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 #[optional]
643 #[unsafe(method(playerViewShouldAutomaticallyDismissAtPictureInPictureStart:))]
644 #[unsafe(method_family = none)]
645 unsafe fn playerViewShouldAutomaticallyDismissAtPictureInPictureStart(
646 &self,
647 player_view: &AVPlayerView,
648 ) -> bool;
649 }
650);