objc2_media_player/generated/
MPNowPlayingSession.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-av-foundation")]
7use objc2_av_foundation::*;
8#[cfg(feature = "objc2-core-media")]
9use objc2_core_media::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern_class!(
15 #[unsafe(super(NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 pub struct MPAdTimeRange;
19);
20
21unsafe impl NSCopying for MPAdTimeRange {}
22
23unsafe impl CopyingHelper for MPAdTimeRange {
24 type Result = Self;
25}
26
27unsafe impl NSObjectProtocol for MPAdTimeRange {}
28
29impl MPAdTimeRange {
30 extern_methods!(
31 #[cfg(feature = "objc2-core-media")]
32 #[unsafe(method(timeRange))]
35 #[unsafe(method_family = none)]
36 pub unsafe fn timeRange(&self) -> CMTimeRange;
37
38 #[cfg(feature = "objc2-core-media")]
39 #[unsafe(method(setTimeRange:))]
41 #[unsafe(method_family = none)]
42 pub unsafe fn setTimeRange(&self, time_range: CMTimeRange);
43
44 #[unsafe(method(new))]
45 #[unsafe(method_family = new)]
46 pub unsafe fn new() -> Retained<Self>;
47
48 #[unsafe(method(init))]
49 #[unsafe(method_family = init)]
50 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
51
52 #[cfg(feature = "objc2-core-media")]
53 #[unsafe(method(initWithTimeRange:))]
54 #[unsafe(method_family = init)]
55 pub unsafe fn initWithTimeRange(
56 this: Allocated<Self>,
57 time_range: CMTimeRange,
58 ) -> Retained<Self>;
59 );
60}
61
62extern_class!(
63 #[unsafe(super(NSObject))]
65 #[derive(Debug, PartialEq, Eq, Hash)]
66 pub struct MPNowPlayingSession;
67);
68
69unsafe impl NSObjectProtocol for MPNowPlayingSession {}
70
71impl MPNowPlayingSession {
72 extern_methods!(
73 #[cfg(feature = "objc2-av-foundation")]
74 #[unsafe(method(initWithPlayers:))]
76 #[unsafe(method_family = init)]
77 pub unsafe fn initWithPlayers(
78 this: Allocated<Self>,
79 players: &NSArray<AVPlayer>,
80 ) -> Retained<Self>;
81
82 #[unsafe(method(new))]
83 #[unsafe(method_family = new)]
84 pub unsafe fn new() -> Retained<Self>;
85
86 #[unsafe(method(init))]
87 #[unsafe(method_family = init)]
88 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
89
90 #[cfg(feature = "objc2-av-foundation")]
91 #[unsafe(method(players))]
93 #[unsafe(method_family = none)]
94 pub unsafe fn players(&self, mtm: MainThreadMarker) -> Retained<NSArray<AVPlayer>>;
95
96 #[unsafe(method(delegate))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn delegate(
99 &self,
100 ) -> Option<Retained<ProtocolObject<dyn MPNowPlayingSessionDelegate>>>;
101
102 #[unsafe(method(setDelegate:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn setDelegate(
107 &self,
108 delegate: Option<&ProtocolObject<dyn MPNowPlayingSessionDelegate>>,
109 );
110
111 #[unsafe(method(automaticallyPublishesNowPlayingInfo))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn automaticallyPublishesNowPlayingInfo(&self) -> bool;
116
117 #[unsafe(method(setAutomaticallyPublishesNowPlayingInfo:))]
119 #[unsafe(method_family = none)]
120 pub unsafe fn setAutomaticallyPublishesNowPlayingInfo(
121 &self,
122 automatically_publishes_now_playing_info: bool,
123 );
124
125 #[cfg(feature = "MPNowPlayingInfoCenter")]
126 #[unsafe(method(nowPlayingInfoCenter))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn nowPlayingInfoCenter(&self) -> Retained<MPNowPlayingInfoCenter>;
130
131 #[cfg(feature = "MPRemoteCommandCenter")]
132 #[unsafe(method(remoteCommandCenter))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn remoteCommandCenter(&self) -> Retained<MPRemoteCommandCenter>;
136
137 #[unsafe(method(canBecomeActive))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn canBecomeActive(&self) -> bool;
141
142 #[unsafe(method(isActive))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn isActive(&self) -> bool;
146
147 #[cfg(feature = "block2")]
148 #[unsafe(method(becomeActiveIfPossibleWithCompletion:))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn becomeActiveIfPossibleWithCompletion(
152 &self,
153 completion: Option<&block2::Block<dyn Fn(Bool)>>,
154 );
155
156 #[cfg(feature = "objc2-av-foundation")]
157 #[unsafe(method(addPlayer:))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn addPlayer(&self, player: &AVPlayer);
161
162 #[cfg(feature = "objc2-av-foundation")]
163 #[unsafe(method(removePlayer:))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn removePlayer(&self, player: &AVPlayer);
167 );
168}
169
170extern_protocol!(
171 pub unsafe trait MPNowPlayingSessionDelegate: NSObjectProtocol {
173 #[optional]
175 #[unsafe(method(nowPlayingSessionDidChangeActive:))]
176 #[unsafe(method_family = none)]
177 unsafe fn nowPlayingSessionDidChangeActive(
178 &self,
179 now_playing_session: &MPNowPlayingSession,
180 );
181
182 #[optional]
184 #[unsafe(method(nowPlayingSessionDidChangeCanBecomeActive:))]
185 #[unsafe(method_family = none)]
186 unsafe fn nowPlayingSessionDidChangeCanBecomeActive(
187 &self,
188 now_playing_session: &MPNowPlayingSession,
189 );
190 }
191);