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:))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn setVideoGravity(&self, video_gravity: &AVLayerVideoGravity);
155
156 #[unsafe(method(isReadyForDisplay))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn isReadyForDisplay(&self) -> bool;
160
161 #[unsafe(method(videoBounds))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn videoBounds(&self) -> NSRect;
165
166 #[unsafe(method(contentOverlayView))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn contentOverlayView(&self) -> Option<Retained<NSView>>;
170
171 #[unsafe(method(updatesNowPlayingInfoCenter))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn updatesNowPlayingInfoCenter(&self) -> bool;
175
176 #[unsafe(method(setUpdatesNowPlayingInfoCenter:))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn setUpdatesNowPlayingInfoCenter(&self, updates_now_playing_info_center: bool);
180
181 #[unsafe(method(delegate))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn delegate(&self)
185 -> Option<Retained<ProtocolObject<dyn AVPlayerViewDelegate>>>;
186
187 #[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 #[unsafe(method(speeds))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn speeds(&self) -> Retained<NSArray<AVPlaybackSpeed>>;
206
207 #[cfg(feature = "AVPlaybackSpeed")]
208 #[unsafe(method(setSpeeds:))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn setSpeeds(&self, speeds: &NSArray<AVPlaybackSpeed>);
214
215 #[cfg(feature = "AVPlaybackSpeed")]
216 #[unsafe(method(selectedSpeed))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn selectedSpeed(&self) -> Option<Retained<AVPlaybackSpeed>>;
222
223 #[cfg(feature = "AVPlaybackSpeed")]
224 #[unsafe(method(selectSpeed:))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn selectSpeed(&self, speed: &AVPlaybackSpeed);
232
233 #[unsafe(method(allowsVideoFrameAnalysis))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn allowsVideoFrameAnalysis(&self) -> bool;
237
238 #[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 #[unsafe(method(videoFrameAnalysisTypes))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn videoFrameAnalysisTypes(&self) -> AVVideoFrameAnalysisType;
248
249 #[cfg(feature = "AVKitTypes")]
250 #[unsafe(method(setVideoFrameAnalysisTypes:))]
252 #[unsafe(method_family = none)]
253 pub unsafe fn setVideoFrameAnalysisTypes(
254 &self,
255 video_frame_analysis_types: AVVideoFrameAnalysisType,
256 );
257
258 #[unsafe(method(allowsMagnification))]
262 #[unsafe(method_family = none)]
263 pub unsafe fn allowsMagnification(&self) -> bool;
264
265 #[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 #[unsafe(method(magnification))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn magnification(&self) -> CGFloat;
277
278 #[cfg(feature = "objc2-core-foundation")]
279 #[unsafe(method(setMagnification:))]
281 #[unsafe(method_family = none)]
282 pub unsafe fn setMagnification(&self, magnification: CGFloat);
283
284 #[cfg(feature = "objc2-core-foundation")]
285 #[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 #[unsafe(method(preferredDisplayDynamicRange))]
307 #[unsafe(method_family = none)]
308 pub unsafe fn preferredDisplayDynamicRange(&self) -> AVDisplayDynamicRange;
309
310 #[cfg(feature = "AVKitTypes")]
311 #[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#[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 #[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#[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#[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#[cfg(feature = "objc2-app-kit")]
366#[cfg(target_os = "macos")]
367impl AVPlayerView {
368 extern_methods!(
369 #[unsafe(method(showsFrameSteppingButtons))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn showsFrameSteppingButtons(&self) -> bool;
373
374 #[unsafe(method(setShowsFrameSteppingButtons:))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn setShowsFrameSteppingButtons(&self, shows_frame_stepping_buttons: bool);
378
379 #[unsafe(method(showsSharingServiceButton))]
381 #[unsafe(method_family = none)]
382 pub unsafe fn showsSharingServiceButton(&self) -> bool;
383
384 #[unsafe(method(setShowsSharingServiceButton:))]
386 #[unsafe(method_family = none)]
387 pub unsafe fn setShowsSharingServiceButton(&self, shows_sharing_service_button: bool);
388
389 #[unsafe(method(actionPopUpButtonMenu))]
391 #[unsafe(method_family = none)]
392 pub unsafe fn actionPopUpButtonMenu(&self) -> Option<Retained<NSMenu>>;
393
394 #[unsafe(method(setActionPopUpButtonMenu:))]
396 #[unsafe(method_family = none)]
397 pub unsafe fn setActionPopUpButtonMenu(&self, action_pop_up_button_menu: Option<&NSMenu>);
398
399 #[unsafe(method(showsFullScreenToggleButton))]
401 #[unsafe(method_family = none)]
402 pub unsafe fn showsFullScreenToggleButton(&self) -> bool;
403
404 #[unsafe(method(setShowsFullScreenToggleButton:))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn setShowsFullScreenToggleButton(&self, shows_full_screen_toggle_button: bool);
408
409 #[unsafe(method(showsTimecodes))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn showsTimecodes(&self) -> bool;
413
414 #[unsafe(method(setShowsTimecodes:))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn setShowsTimecodes(&self, shows_timecodes: bool);
418 );
419}
420
421#[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#[cfg(feature = "objc2-app-kit")]
447#[cfg(target_os = "macos")]
448impl AVPlayerView {
449 extern_methods!(
450 #[unsafe(method(canBeginTrimming))]
452 #[unsafe(method_family = none)]
453 pub unsafe fn canBeginTrimming(&self) -> bool;
454
455 #[cfg(feature = "block2")]
456 #[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#[cfg(feature = "objc2-app-kit")]
470#[cfg(target_os = "macos")]
471impl AVPlayerView {
472 extern_methods!(
473 #[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#[cfg(feature = "objc2-app-kit")]
490#[cfg(target_os = "macos")]
491impl AVPlayerView {
492 extern_methods!(
493 #[unsafe(method(allowsPictureInPicturePlayback))]
495 #[unsafe(method_family = none)]
496 pub unsafe fn allowsPictureInPicturePlayback(&self) -> bool;
497
498 #[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 #[unsafe(method(pictureInPictureDelegate))]
508 #[unsafe(method_family = none)]
509 pub unsafe fn pictureInPictureDelegate(
510 &self,
511 ) -> Option<Retained<ProtocolObject<dyn AVPlayerViewPictureInPictureDelegate>>>;
512
513 #[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 pub unsafe trait AVPlayerViewDelegate: NSObjectProtocol {
532 #[cfg(feature = "objc2-app-kit")]
533 #[cfg(target_os = "macos")]
534 #[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 #[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 #[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 #[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 #[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 pub unsafe trait AVPlayerViewPictureInPictureDelegate: NSObjectProtocol {
593 #[cfg(feature = "objc2-app-kit")]
594 #[cfg(target_os = "macos")]
595 #[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 #[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 #[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 #[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 #[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 #[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 #[optional]
671 #[unsafe(method(playerViewShouldAutomaticallyDismissAtPictureInPictureStart:))]
672 #[unsafe(method_family = none)]
673 unsafe fn playerViewShouldAutomaticallyDismissAtPictureInPictureStart(
674 &self,
675 player_view: &AVPlayerView,
676 ) -> bool;
677 }
678);