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:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn setDelegate(
113 &self,
114 delegate: Option<&ProtocolObject<dyn MPNowPlayingSessionDelegate>>,
115 );
116
117 #[unsafe(method(automaticallyPublishesNowPlayingInfo))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn automaticallyPublishesNowPlayingInfo(&self) -> bool;
122
123 #[unsafe(method(setAutomaticallyPublishesNowPlayingInfo:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn setAutomaticallyPublishesNowPlayingInfo(
127 &self,
128 automatically_publishes_now_playing_info: bool,
129 );
130
131 #[cfg(feature = "MPNowPlayingInfoCenter")]
132 #[unsafe(method(nowPlayingInfoCenter))]
134 #[unsafe(method_family = none)]
135 pub unsafe fn nowPlayingInfoCenter(&self) -> Retained<MPNowPlayingInfoCenter>;
136
137 #[cfg(feature = "MPRemoteCommandCenter")]
138 #[unsafe(method(remoteCommandCenter))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn remoteCommandCenter(&self) -> Retained<MPRemoteCommandCenter>;
142
143 #[unsafe(method(canBecomeActive))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn canBecomeActive(&self) -> bool;
147
148 #[unsafe(method(isActive))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn isActive(&self) -> bool;
152
153 #[cfg(feature = "block2")]
154 #[unsafe(method(becomeActiveIfPossibleWithCompletion:))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn becomeActiveIfPossibleWithCompletion(
158 &self,
159 completion: Option<&block2::DynBlock<dyn Fn(Bool)>>,
160 );
161
162 #[cfg(feature = "objc2-av-foundation")]
163 #[unsafe(method(addPlayer:))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn addPlayer(&self, player: &AVPlayer);
167
168 #[cfg(feature = "objc2-av-foundation")]
169 #[unsafe(method(removePlayer:))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn removePlayer(&self, player: &AVPlayer);
173 );
174}
175
176extern_protocol!(
177 pub unsafe trait MPNowPlayingSessionDelegate: NSObjectProtocol {
179 #[optional]
181 #[unsafe(method(nowPlayingSessionDidChangeActive:))]
182 #[unsafe(method_family = none)]
183 unsafe fn nowPlayingSessionDidChangeActive(
184 &self,
185 now_playing_session: &MPNowPlayingSession,
186 );
187
188 #[optional]
190 #[unsafe(method(nowPlayingSessionDidChangeCanBecomeActive:))]
191 #[unsafe(method_family = none)]
192 unsafe fn nowPlayingSessionDidChangeCanBecomeActive(
193 &self,
194 now_playing_session: &MPNowPlayingSession,
195 );
196 }
197);