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")]
66unsafe impl NSAccessibility for AVPlayerView {}
67
68#[cfg(feature = "objc2-app-kit")]
69#[cfg(target_os = "macos")]
70unsafe impl NSAccessibilityElementProtocol for AVPlayerView {}
71
72#[cfg(feature = "objc2-app-kit")]
73#[cfg(target_os = "macos")]
74unsafe impl NSAnimatablePropertyContainer for AVPlayerView {}
75
76#[cfg(feature = "objc2-app-kit")]
77#[cfg(target_os = "macos")]
78unsafe impl NSAppearanceCustomization for AVPlayerView {}
79
80#[cfg(feature = "objc2-app-kit")]
81#[cfg(target_os = "macos")]
82unsafe impl NSCoding for AVPlayerView {}
83
84#[cfg(feature = "objc2-app-kit")]
85#[cfg(target_os = "macos")]
86unsafe impl NSDraggingDestination for AVPlayerView {}
87
88#[cfg(feature = "objc2-app-kit")]
89#[cfg(target_os = "macos")]
90unsafe impl NSObjectProtocol for AVPlayerView {}
91
92#[cfg(feature = "objc2-app-kit")]
93#[cfg(target_os = "macos")]
94unsafe impl NSUserInterfaceItemIdentification for AVPlayerView {}
95
96#[cfg(feature = "objc2-app-kit")]
97#[cfg(target_os = "macos")]
98impl AVPlayerView {
99 extern_methods!(
100 #[cfg(feature = "objc2-av-foundation")]
101 #[unsafe(method(player))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn player(&self) -> Option<Retained<AVPlayer>>;
105
106 #[cfg(feature = "objc2-av-foundation")]
107 #[unsafe(method(setPlayer:))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn setPlayer(&self, player: Option<&AVPlayer>);
111
112 #[unsafe(method(controlsStyle))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn controlsStyle(&self) -> AVPlayerViewControlsStyle;
118
119 #[unsafe(method(setControlsStyle:))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn setControlsStyle(&self, controls_style: AVPlayerViewControlsStyle);
123
124 #[cfg(feature = "objc2-av-foundation")]
125 #[unsafe(method(videoGravity))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn videoGravity(&self) -> Retained<AVLayerVideoGravity>;
131
132 #[cfg(feature = "objc2-av-foundation")]
133 #[unsafe(method(setVideoGravity:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn setVideoGravity(&self, video_gravity: &AVLayerVideoGravity);
137
138 #[unsafe(method(isReadyForDisplay))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn isReadyForDisplay(&self) -> bool;
142
143 #[unsafe(method(videoBounds))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn videoBounds(&self) -> NSRect;
147
148 #[unsafe(method(contentOverlayView))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn contentOverlayView(&self) -> Option<Retained<NSView>>;
152
153 #[unsafe(method(updatesNowPlayingInfoCenter))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn updatesNowPlayingInfoCenter(&self) -> bool;
157
158 #[unsafe(method(setUpdatesNowPlayingInfoCenter:))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn setUpdatesNowPlayingInfoCenter(&self, updates_now_playing_info_center: bool);
162
163 #[unsafe(method(delegate))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn delegate(&self)
167 -> Option<Retained<ProtocolObject<dyn AVPlayerViewDelegate>>>;
168
169 #[unsafe(method(setDelegate:))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn setDelegate(
174 &self,
175 delegate: Option<&ProtocolObject<dyn AVPlayerViewDelegate>>,
176 );
177
178 #[cfg(feature = "AVPlaybackSpeed")]
179 #[unsafe(method(speeds))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn speeds(&self) -> Retained<NSArray<AVPlaybackSpeed>>;
187
188 #[cfg(feature = "AVPlaybackSpeed")]
189 #[unsafe(method(setSpeeds:))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn setSpeeds(&self, speeds: &NSArray<AVPlaybackSpeed>);
193
194 #[cfg(feature = "AVPlaybackSpeed")]
195 #[unsafe(method(selectedSpeed))]
199 #[unsafe(method_family = none)]
200 pub unsafe fn selectedSpeed(&self) -> Option<Retained<AVPlaybackSpeed>>;
201
202 #[cfg(feature = "AVPlaybackSpeed")]
203 #[unsafe(method(selectSpeed:))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn selectSpeed(&self, speed: &AVPlaybackSpeed);
211
212 #[unsafe(method(allowsVideoFrameAnalysis))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn allowsVideoFrameAnalysis(&self) -> bool;
216
217 #[unsafe(method(setAllowsVideoFrameAnalysis:))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn setAllowsVideoFrameAnalysis(&self, allows_video_frame_analysis: bool);
221
222 #[cfg(feature = "AVKitTypes")]
223 #[unsafe(method(videoFrameAnalysisTypes))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn videoFrameAnalysisTypes(&self) -> AVVideoFrameAnalysisType;
227
228 #[cfg(feature = "AVKitTypes")]
229 #[unsafe(method(setVideoFrameAnalysisTypes:))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn setVideoFrameAnalysisTypes(
233 &self,
234 video_frame_analysis_types: AVVideoFrameAnalysisType,
235 );
236
237 #[unsafe(method(allowsMagnification))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn allowsMagnification(&self) -> bool;
243
244 #[unsafe(method(setAllowsMagnification:))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn setAllowsMagnification(&self, allows_magnification: bool);
248
249 #[cfg(feature = "objc2-core-foundation")]
250 #[unsafe(method(magnification))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn magnification(&self) -> CGFloat;
256
257 #[cfg(feature = "objc2-core-foundation")]
258 #[unsafe(method(setMagnification:))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn setMagnification(&self, magnification: CGFloat);
262
263 #[cfg(feature = "objc2-core-foundation")]
264 #[unsafe(method(setMagnification:centeredAtPoint:))]
272 #[unsafe(method_family = none)]
273 pub unsafe fn setMagnification_centeredAtPoint(
274 &self,
275 magnification: CGFloat,
276 point: CGPoint,
277 );
278 );
279}
280
281#[cfg(feature = "objc2-app-kit")]
283#[cfg(target_os = "macos")]
284impl AVPlayerView {
285 extern_methods!(
286 #[unsafe(method(initWithFrame:))]
287 #[unsafe(method_family = init)]
288 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
289
290 #[unsafe(method(initWithCoder:))]
291 #[unsafe(method_family = init)]
292 pub unsafe fn initWithCoder(
293 this: Allocated<Self>,
294 coder: &NSCoder,
295 ) -> Option<Retained<Self>>;
296 );
297}
298
299#[cfg(feature = "objc2-app-kit")]
301#[cfg(target_os = "macos")]
302impl AVPlayerView {
303 extern_methods!(
304 #[unsafe(method(init))]
305 #[unsafe(method_family = init)]
306 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
307 );
308}
309
310#[cfg(feature = "objc2-app-kit")]
312#[cfg(target_os = "macos")]
313impl AVPlayerView {
314 extern_methods!(
315 #[unsafe(method(new))]
316 #[unsafe(method_family = new)]
317 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
318 );
319}
320
321#[cfg(feature = "objc2-app-kit")]
323#[cfg(target_os = "macos")]
324impl AVPlayerView {
325 extern_methods!(
326 #[unsafe(method(showsFrameSteppingButtons))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn showsFrameSteppingButtons(&self) -> bool;
330
331 #[unsafe(method(setShowsFrameSteppingButtons:))]
333 #[unsafe(method_family = none)]
334 pub unsafe fn setShowsFrameSteppingButtons(&self, shows_frame_stepping_buttons: bool);
335
336 #[unsafe(method(showsSharingServiceButton))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn showsSharingServiceButton(&self) -> bool;
340
341 #[unsafe(method(setShowsSharingServiceButton:))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn setShowsSharingServiceButton(&self, shows_sharing_service_button: bool);
345
346 #[unsafe(method(actionPopUpButtonMenu))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn actionPopUpButtonMenu(&self) -> Option<Retained<NSMenu>>;
350
351 #[unsafe(method(setActionPopUpButtonMenu:))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn setActionPopUpButtonMenu(&self, action_pop_up_button_menu: Option<&NSMenu>);
355
356 #[unsafe(method(showsFullScreenToggleButton))]
358 #[unsafe(method_family = none)]
359 pub unsafe fn showsFullScreenToggleButton(&self) -> bool;
360
361 #[unsafe(method(setShowsFullScreenToggleButton:))]
363 #[unsafe(method_family = none)]
364 pub unsafe fn setShowsFullScreenToggleButton(&self, shows_full_screen_toggle_button: bool);
365
366 #[unsafe(method(showsTimecodes))]
368 #[unsafe(method_family = none)]
369 pub unsafe fn showsTimecodes(&self) -> bool;
370
371 #[unsafe(method(setShowsTimecodes:))]
373 #[unsafe(method_family = none)]
374 pub unsafe fn setShowsTimecodes(&self, shows_timecodes: bool);
375 );
376}
377
378#[repr(transparent)]
385#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
386pub struct AVPlayerViewTrimResult(pub NSInteger);
387impl AVPlayerViewTrimResult {
388 #[doc(alias = "AVPlayerViewTrimOKButton")]
389 pub const OKButton: Self = Self(0);
390 #[doc(alias = "AVPlayerViewTrimCancelButton")]
391 pub const CancelButton: Self = Self(1);
392}
393
394unsafe impl Encode for AVPlayerViewTrimResult {
395 const ENCODING: Encoding = NSInteger::ENCODING;
396}
397
398unsafe impl RefEncode for AVPlayerViewTrimResult {
399 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
400}
401
402#[cfg(feature = "objc2-app-kit")]
404#[cfg(target_os = "macos")]
405impl AVPlayerView {
406 extern_methods!(
407 #[unsafe(method(canBeginTrimming))]
409 #[unsafe(method_family = none)]
410 pub unsafe fn canBeginTrimming(&self) -> bool;
411
412 #[cfg(feature = "block2")]
413 #[unsafe(method(beginTrimmingWithCompletionHandler:))]
417 #[unsafe(method_family = none)]
418 pub unsafe fn beginTrimmingWithCompletionHandler(
419 &self,
420 handler: Option<&block2::Block<dyn Fn(AVPlayerViewTrimResult)>>,
421 );
422 );
423}
424
425#[cfg(feature = "objc2-app-kit")]
427#[cfg(target_os = "macos")]
428impl AVPlayerView {
429 extern_methods!(
430 #[unsafe(method(flashChapterNumber:chapterTitle:))]
436 #[unsafe(method_family = none)]
437 pub unsafe fn flashChapterNumber_chapterTitle(
438 &self,
439 chapter_number: NSUInteger,
440 chapter_title: Option<&NSString>,
441 );
442 );
443}
444
445#[cfg(feature = "objc2-app-kit")]
447#[cfg(target_os = "macos")]
448impl AVPlayerView {
449 extern_methods!(
450 #[unsafe(method(allowsPictureInPicturePlayback))]
452 #[unsafe(method_family = none)]
453 pub unsafe fn allowsPictureInPicturePlayback(&self) -> bool;
454
455 #[unsafe(method(setAllowsPictureInPicturePlayback:))]
457 #[unsafe(method_family = none)]
458 pub unsafe fn setAllowsPictureInPicturePlayback(
459 &self,
460 allows_picture_in_picture_playback: bool,
461 );
462
463 #[unsafe(method(pictureInPictureDelegate))]
465 #[unsafe(method_family = none)]
466 pub unsafe fn pictureInPictureDelegate(
467 &self,
468 ) -> Option<Retained<ProtocolObject<dyn AVPlayerViewPictureInPictureDelegate>>>;
469
470 #[unsafe(method(setPictureInPictureDelegate:))]
473 #[unsafe(method_family = none)]
474 pub unsafe fn setPictureInPictureDelegate(
475 &self,
476 picture_in_picture_delegate: Option<
477 &ProtocolObject<dyn AVPlayerViewPictureInPictureDelegate>,
478 >,
479 );
480 );
481}
482
483extern_protocol!(
484 pub unsafe trait AVPlayerViewDelegate: NSObjectProtocol {
488 #[cfg(feature = "objc2-app-kit")]
489 #[cfg(target_os = "macos")]
490 #[optional]
494 #[unsafe(method(playerViewWillEnterFullScreen:))]
495 #[unsafe(method_family = none)]
496 unsafe fn playerViewWillEnterFullScreen(&self, player_view: &AVPlayerView);
497
498 #[cfg(feature = "objc2-app-kit")]
499 #[cfg(target_os = "macos")]
500 #[optional]
504 #[unsafe(method(playerViewDidEnterFullScreen:))]
505 #[unsafe(method_family = none)]
506 unsafe fn playerViewDidEnterFullScreen(&self, player_view: &AVPlayerView);
507
508 #[cfg(feature = "objc2-app-kit")]
509 #[cfg(target_os = "macos")]
510 #[optional]
514 #[unsafe(method(playerViewWillExitFullScreen:))]
515 #[unsafe(method_family = none)]
516 unsafe fn playerViewWillExitFullScreen(&self, player_view: &AVPlayerView);
517
518 #[cfg(feature = "objc2-app-kit")]
519 #[cfg(target_os = "macos")]
520 #[optional]
524 #[unsafe(method(playerViewDidExitFullScreen:))]
525 #[unsafe(method_family = none)]
526 unsafe fn playerViewDidExitFullScreen(&self, player_view: &AVPlayerView);
527
528 #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
529 #[cfg(target_os = "macos")]
530 #[optional]
536 #[unsafe(method(playerView:restoreUserInterfaceForFullScreenExitWithCompletionHandler:))]
537 #[unsafe(method_family = none)]
538 unsafe fn playerView_restoreUserInterfaceForFullScreenExitWithCompletionHandler(
539 &self,
540 player_view: &AVPlayerView,
541 completion_handler: &block2::Block<dyn Fn(Bool)>,
542 );
543 }
544);
545
546extern_protocol!(
547 pub unsafe trait AVPlayerViewPictureInPictureDelegate: NSObjectProtocol {
549 #[cfg(feature = "objc2-app-kit")]
550 #[cfg(target_os = "macos")]
551 #[optional]
555 #[unsafe(method(playerViewWillStartPictureInPicture:))]
556 #[unsafe(method_family = none)]
557 unsafe fn playerViewWillStartPictureInPicture(&self, player_view: &AVPlayerView);
558
559 #[cfg(feature = "objc2-app-kit")]
560 #[cfg(target_os = "macos")]
561 #[optional]
565 #[unsafe(method(playerViewDidStartPictureInPicture:))]
566 #[unsafe(method_family = none)]
567 unsafe fn playerViewDidStartPictureInPicture(&self, player_view: &AVPlayerView);
568
569 #[cfg(feature = "objc2-app-kit")]
570 #[cfg(target_os = "macos")]
571 #[optional]
577 #[unsafe(method(playerView:failedToStartPictureInPictureWithError:))]
578 #[unsafe(method_family = none)]
579 unsafe fn playerView_failedToStartPictureInPictureWithError(
580 &self,
581 player_view: &AVPlayerView,
582 error: &NSError,
583 );
584
585 #[cfg(feature = "objc2-app-kit")]
586 #[cfg(target_os = "macos")]
587 #[optional]
591 #[unsafe(method(playerViewWillStopPictureInPicture:))]
592 #[unsafe(method_family = none)]
593 unsafe fn playerViewWillStopPictureInPicture(&self, player_view: &AVPlayerView);
594
595 #[cfg(feature = "objc2-app-kit")]
596 #[cfg(target_os = "macos")]
597 #[optional]
601 #[unsafe(method(playerViewDidStopPictureInPicture:))]
602 #[unsafe(method_family = none)]
603 unsafe fn playerViewDidStopPictureInPicture(&self, player_view: &AVPlayerView);
604
605 #[cfg(all(feature = "block2", feature = "objc2-app-kit"))]
606 #[cfg(target_os = "macos")]
607 #[optional]
613 #[unsafe(method(playerView:restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:))]
614 #[unsafe(method_family = none)]
615 unsafe fn playerView_restoreUserInterfaceForPictureInPictureStopWithCompletionHandler(
616 &self,
617 player_view: &AVPlayerView,
618 completion_handler: &block2::Block<dyn Fn(Bool)>,
619 );
620
621 #[cfg(feature = "objc2-app-kit")]
622 #[cfg(target_os = "macos")]
623 #[optional]
627 #[unsafe(method(playerViewShouldAutomaticallyDismissAtPictureInPictureStart:))]
628 #[unsafe(method_family = none)]
629 unsafe fn playerViewShouldAutomaticallyDismissAtPictureInPictureStart(
630 &self,
631 player_view: &AVPlayerView,
632 ) -> bool;
633 }
634);