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
21extern_conformance!(
22 unsafe impl NSCopying for MPAdTimeRange {}
23);
24
25unsafe impl CopyingHelper for MPAdTimeRange {
26 type Result = Self;
27}
28
29extern_conformance!(
30 unsafe impl NSObjectProtocol for MPAdTimeRange {}
31);
32
33impl MPAdTimeRange {
34 extern_methods!(
35 #[cfg(feature = "objc2-core-media")]
36 #[unsafe(method(timeRange))]
39 #[unsafe(method_family = none)]
40 pub unsafe fn timeRange(&self) -> CMTimeRange;
41
42 #[cfg(feature = "objc2-core-media")]
43 #[unsafe(method(setTimeRange:))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn setTimeRange(&self, time_range: CMTimeRange);
47
48 #[unsafe(method(new))]
49 #[unsafe(method_family = new)]
50 pub unsafe fn new() -> Retained<Self>;
51
52 #[unsafe(method(init))]
53 #[unsafe(method_family = init)]
54 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
55
56 #[cfg(feature = "objc2-core-media")]
57 #[unsafe(method(initWithTimeRange:))]
58 #[unsafe(method_family = init)]
59 pub unsafe fn initWithTimeRange(
60 this: Allocated<Self>,
61 time_range: CMTimeRange,
62 ) -> Retained<Self>;
63 );
64}
65
66extern_class!(
67 #[unsafe(super(NSObject))]
69 #[derive(Debug, PartialEq, Eq, Hash)]
70 pub struct MPNowPlayingSession;
71);
72
73extern_conformance!(
74 unsafe impl NSObjectProtocol for MPNowPlayingSession {}
75);
76
77impl MPNowPlayingSession {
78 extern_methods!(
79 #[cfg(feature = "objc2-av-foundation")]
80 #[unsafe(method(initWithPlayers:))]
82 #[unsafe(method_family = init)]
83 pub unsafe fn initWithPlayers(
84 this: Allocated<Self>,
85 players: &NSArray<AVPlayer>,
86 ) -> Retained<Self>;
87
88 #[unsafe(method(new))]
89 #[unsafe(method_family = new)]
90 pub unsafe fn new() -> Retained<Self>;
91
92 #[unsafe(method(init))]
93 #[unsafe(method_family = init)]
94 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
95
96 #[cfg(feature = "objc2-av-foundation")]
97 #[unsafe(method(players))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn players(&self, mtm: MainThreadMarker) -> Retained<NSArray<AVPlayer>>;
101
102 #[unsafe(method(delegate))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn delegate(
105 &self,
106 ) -> Option<Retained<ProtocolObject<dyn MPNowPlayingSessionDelegate>>>;
107
108 #[unsafe(method(setDelegate:))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn setDelegate(
114 &self,
115 delegate: Option<&ProtocolObject<dyn MPNowPlayingSessionDelegate>>,
116 );
117
118 #[unsafe(method(automaticallyPublishesNowPlayingInfo))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn automaticallyPublishesNowPlayingInfo(&self) -> bool;
123
124 #[unsafe(method(setAutomaticallyPublishesNowPlayingInfo:))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn setAutomaticallyPublishesNowPlayingInfo(
128 &self,
129 automatically_publishes_now_playing_info: bool,
130 );
131
132 #[cfg(feature = "MPNowPlayingInfoCenter")]
133 #[unsafe(method(nowPlayingInfoCenter))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn nowPlayingInfoCenter(&self) -> Retained<MPNowPlayingInfoCenter>;
137
138 #[cfg(feature = "MPRemoteCommandCenter")]
139 #[unsafe(method(remoteCommandCenter))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn remoteCommandCenter(&self) -> Retained<MPRemoteCommandCenter>;
143
144 #[unsafe(method(canBecomeActive))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn canBecomeActive(&self) -> bool;
148
149 #[unsafe(method(isActive))]
151 #[unsafe(method_family = none)]
152 pub unsafe fn isActive(&self) -> bool;
153
154 #[cfg(feature = "block2")]
155 #[unsafe(method(becomeActiveIfPossibleWithCompletion:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn becomeActiveIfPossibleWithCompletion(
159 &self,
160 completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
161 );
162
163 #[cfg(feature = "objc2-av-foundation")]
164 #[unsafe(method(addPlayer:))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn addPlayer(&self, player: &AVPlayer);
168
169 #[cfg(feature = "objc2-av-foundation")]
170 #[unsafe(method(removePlayer:))]
172 #[unsafe(method_family = none)]
173 pub unsafe fn removePlayer(&self, player: &AVPlayer);
174 );
175}
176
177extern_protocol!(
178 pub unsafe trait MPNowPlayingSessionDelegate: NSObjectProtocol {
180 #[optional]
182 #[unsafe(method(nowPlayingSessionDidChangeActive:))]
183 #[unsafe(method_family = none)]
184 unsafe fn nowPlayingSessionDidChangeActive(
185 &self,
186 now_playing_session: &MPNowPlayingSession,
187 );
188
189 #[optional]
191 #[unsafe(method(nowPlayingSessionDidChangeCanBecomeActive:))]
192 #[unsafe(method_family = none)]
193 unsafe fn nowPlayingSessionDidChangeCanBecomeActive(
194 &self,
195 now_playing_session: &MPNowPlayingSession,
196 );
197 }
198);