@basmilius/apple-devices 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +528 -345
- package/dist/index.mjs +404 -47
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -5,6 +5,240 @@ import { EventEmitter } from "node:events";
|
|
|
5
5
|
import { AccessoryCredentials, AudioSource, CommandError, DeviceIdentity, DiscoveryResult, TimingServer } from "@basmilius/apple-common";
|
|
6
6
|
import { AttentionState, ButtonPressType, HidCommandKey, LaunchableApp, MediaControlCommandKey, Protocol as Protocol$1, TextInputState, UserAccount } from "@basmilius/apple-companion-link";
|
|
7
7
|
|
|
8
|
+
//#region src/airplay/const.d.ts
|
|
9
|
+
/** Symbol used to access the underlying AirPlay Protocol instance from an AirPlayDevice. */
|
|
10
|
+
declare const PROTOCOL: unique symbol;
|
|
11
|
+
/** Symbol used to subscribe AirPlayState to DataStream events. */
|
|
12
|
+
declare const STATE_SUBSCRIBE_SYMBOL: unique symbol;
|
|
13
|
+
/** Symbol used to unsubscribe AirPlayState from DataStream events. */
|
|
14
|
+
declare const STATE_UNSUBSCRIBE_SYMBOL: unique symbol;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/airplay/remote.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Error thrown when a SendCommand request fails on the Apple TV side.
|
|
19
|
+
* Contains the specific send error and handler return status for diagnostics.
|
|
20
|
+
*/
|
|
21
|
+
declare class SendCommandError extends CommandError {
|
|
22
|
+
/** The send error reported by the Apple TV. */
|
|
23
|
+
readonly sendError: Proto.SendError_Enum;
|
|
24
|
+
/** The handler return status reported by the Apple TV. */
|
|
25
|
+
readonly handlerReturnStatus: Proto.HandlerReturnStatus_Enum;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new SendCommandError.
|
|
28
|
+
*
|
|
29
|
+
* @param sendError - The send error code from the Apple TV.
|
|
30
|
+
* @param handlerReturnStatus - The handler return status from the Apple TV.
|
|
31
|
+
*/
|
|
32
|
+
constructor(sendError: Proto.SendError_Enum, handlerReturnStatus: Proto.HandlerReturnStatus_Enum);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Remote control for an AirPlay device.
|
|
36
|
+
* Provides HID-based navigation and media keys (USB usage pages: Generic Desktop 0x01
|
|
37
|
+
* and Consumer 0x0c), SendCommand-based media controls, keyboard/text input,
|
|
38
|
+
* and touch/gesture simulation.
|
|
39
|
+
*/
|
|
40
|
+
declare class export_default$1 {
|
|
41
|
+
#private;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new Remote controller.
|
|
44
|
+
*
|
|
45
|
+
* @param device - The AirPlay device to control.
|
|
46
|
+
*/
|
|
47
|
+
constructor(device: export_default);
|
|
48
|
+
/** Sends an Up navigation key press (Generic Desktop, usage 0x8C). */
|
|
49
|
+
up(): Promise<void>;
|
|
50
|
+
/** Sends a Down navigation key press (Generic Desktop, usage 0x8D). */
|
|
51
|
+
down(): Promise<void>;
|
|
52
|
+
/** Sends a Left navigation key press (Generic Desktop, usage 0x8B). */
|
|
53
|
+
left(): Promise<void>;
|
|
54
|
+
/** Sends a Right navigation key press (Generic Desktop, usage 0x8A). */
|
|
55
|
+
right(): Promise<void>;
|
|
56
|
+
/** Sends a Menu key press (Generic Desktop, usage 0x86). */
|
|
57
|
+
menu(): Promise<void>;
|
|
58
|
+
/** Sends a Select/Enter key press (Generic Desktop, usage 0x89). */
|
|
59
|
+
select(): Promise<void>;
|
|
60
|
+
/** Sends a Home button press (Consumer, usage 0x40). */
|
|
61
|
+
home(): Promise<void>;
|
|
62
|
+
/** Sends a Suspend/Sleep key press to put the device to sleep (Generic Desktop, usage 0x82). */
|
|
63
|
+
suspend(): Promise<void>;
|
|
64
|
+
/** Sends a Wake key press to wake the device (Generic Desktop, usage 0x83). */
|
|
65
|
+
wake(): Promise<void>;
|
|
66
|
+
/** Sends a Play key press (Consumer, usage 0xB0). */
|
|
67
|
+
play(): Promise<void>;
|
|
68
|
+
/** Sends a Pause key press (Consumer, usage 0xB1). */
|
|
69
|
+
pause(): Promise<void>;
|
|
70
|
+
/** Toggles play/pause based on the current playback state. */
|
|
71
|
+
playPause(): Promise<void>;
|
|
72
|
+
/** Sends a Stop key press (Consumer, usage 0xB7). */
|
|
73
|
+
stop(): Promise<void>;
|
|
74
|
+
/** Sends a Next Track key press (Consumer, usage 0xB5). */
|
|
75
|
+
next(): Promise<void>;
|
|
76
|
+
/** Sends a Previous Track key press (Consumer, usage 0xB6). */
|
|
77
|
+
previous(): Promise<void>;
|
|
78
|
+
/** Sends a Volume Up key press (Consumer, usage 0xE9). */
|
|
79
|
+
volumeUp(): Promise<void>;
|
|
80
|
+
/** Sends a Volume Down key press (Consumer, usage 0xEA). */
|
|
81
|
+
volumeDown(): Promise<void>;
|
|
82
|
+
/** Sends a Mute key press (Consumer, usage 0xE2). */
|
|
83
|
+
mute(): Promise<void>;
|
|
84
|
+
/** Sends a Top Menu key press (Consumer, usage 0x60). */
|
|
85
|
+
topMenu(): Promise<void>;
|
|
86
|
+
/** Sends a Channel Up key press (Consumer, usage 0x9C). */
|
|
87
|
+
channelUp(): Promise<void>;
|
|
88
|
+
/** Sends a Channel Down key press (Consumer, usage 0x9D). */
|
|
89
|
+
channelDown(): Promise<void>;
|
|
90
|
+
/** Sends a Play command via the MRP SendCommand protocol. */
|
|
91
|
+
commandPlay(): Promise<void>;
|
|
92
|
+
/** Sends a Pause command via the MRP SendCommand protocol. */
|
|
93
|
+
commandPause(): Promise<void>;
|
|
94
|
+
/** Sends a TogglePlayPause command via the MRP SendCommand protocol. */
|
|
95
|
+
commandTogglePlayPause(): Promise<void>;
|
|
96
|
+
/** Sends a Stop command via the MRP SendCommand protocol. */
|
|
97
|
+
commandStop(): Promise<void>;
|
|
98
|
+
/** Sends a NextTrack command via the MRP SendCommand protocol. */
|
|
99
|
+
commandNextTrack(): Promise<void>;
|
|
100
|
+
/** Sends a PreviousTrack command via the MRP SendCommand protocol. */
|
|
101
|
+
commandPreviousTrack(): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Sends a SkipForward command with a configurable interval.
|
|
104
|
+
*
|
|
105
|
+
* @param interval - Seconds to skip forward (defaults to 15).
|
|
106
|
+
*/
|
|
107
|
+
commandSkipForward(interval?: number): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Sends a SkipBackward command with a configurable interval.
|
|
110
|
+
*
|
|
111
|
+
* @param interval - Seconds to skip backward (defaults to 15).
|
|
112
|
+
*/
|
|
113
|
+
commandSkipBackward(interval?: number): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Seeks to an absolute playback position.
|
|
116
|
+
*
|
|
117
|
+
* @param position - The target position in seconds.
|
|
118
|
+
*/
|
|
119
|
+
commandSeekToPosition(position: number): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Sets the shuffle mode.
|
|
122
|
+
*
|
|
123
|
+
* @param mode - The desired shuffle mode.
|
|
124
|
+
*/
|
|
125
|
+
commandSetShuffleMode(mode: Proto.ShuffleMode_Enum): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Sets the repeat mode.
|
|
128
|
+
*
|
|
129
|
+
* @param mode - The desired repeat mode.
|
|
130
|
+
*/
|
|
131
|
+
commandSetRepeatMode(mode: Proto.RepeatMode_Enum): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Changes the playback rate (speed).
|
|
134
|
+
*
|
|
135
|
+
* @param rate - The desired playback rate (e.g. 1.0 for normal, 2.0 for double speed).
|
|
136
|
+
*/
|
|
137
|
+
commandChangePlaybackRate(rate: number): Promise<void>;
|
|
138
|
+
/** Cycles the shuffle mode to the next value. */
|
|
139
|
+
commandAdvanceShuffleMode(): Promise<void>;
|
|
140
|
+
/** Cycles the repeat mode to the next value. */
|
|
141
|
+
commandAdvanceRepeatMode(): Promise<void>;
|
|
142
|
+
/** Begins fast-forwarding playback. */
|
|
143
|
+
commandBeginFastForward(): Promise<void>;
|
|
144
|
+
/** Ends fast-forwarding playback. */
|
|
145
|
+
commandEndFastForward(): Promise<void>;
|
|
146
|
+
/** Begins rewinding playback. */
|
|
147
|
+
commandBeginRewind(): Promise<void>;
|
|
148
|
+
/** Ends rewinding playback. */
|
|
149
|
+
commandEndRewind(): Promise<void>;
|
|
150
|
+
/** Skips to the next chapter. */
|
|
151
|
+
commandNextChapter(): Promise<void>;
|
|
152
|
+
/** Skips to the previous chapter. */
|
|
153
|
+
commandPreviousChapter(): Promise<void>;
|
|
154
|
+
/** Marks the current track as liked. */
|
|
155
|
+
commandLikeTrack(): Promise<void>;
|
|
156
|
+
/** Marks the current track as disliked. */
|
|
157
|
+
commandDislikeTrack(): Promise<void>;
|
|
158
|
+
/** Bookmarks the current track. */
|
|
159
|
+
commandBookmarkTrack(): Promise<void>;
|
|
160
|
+
/** Adds the currently playing item to the user's library. */
|
|
161
|
+
commandAddNowPlayingItemToLibrary(): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Sets a sleep timer that will stop playback after the specified duration.
|
|
164
|
+
* The timer works by attaching sleep timer options to a Pause command.
|
|
165
|
+
*
|
|
166
|
+
* @param seconds - Timer duration in seconds. Use 0 to cancel an active timer.
|
|
167
|
+
* @param stopMode - Stop mode: 0 = stop playback, 1 = pause, 2 = end of track, 3 = end of queue.
|
|
168
|
+
*/
|
|
169
|
+
commandSetSleepTimer(seconds: number, stopMode?: number): Promise<void>;
|
|
170
|
+
/**
|
|
171
|
+
* Sets the text input field to the given text, replacing any existing content.
|
|
172
|
+
*
|
|
173
|
+
* @param text - The text to set.
|
|
174
|
+
*/
|
|
175
|
+
textSet(text: string): Promise<void>;
|
|
176
|
+
/**
|
|
177
|
+
* Appends text to the current text input field content.
|
|
178
|
+
*
|
|
179
|
+
* @param text - The text to append.
|
|
180
|
+
*/
|
|
181
|
+
textAppend(text: string): Promise<void>;
|
|
182
|
+
/** Clears the text input field. */
|
|
183
|
+
textClear(): Promise<void>;
|
|
184
|
+
/** Requests the current keyboard session state from the Apple TV. */
|
|
185
|
+
getKeyboardSession(): Promise<void>;
|
|
186
|
+
/**
|
|
187
|
+
* Simulates a tap at the given coordinates.
|
|
188
|
+
*
|
|
189
|
+
* @param x - Horizontal position in the virtual touch area.
|
|
190
|
+
* @param y - Vertical position in the virtual touch area.
|
|
191
|
+
* @param finger - Finger index for multi-touch (defaults to 1).
|
|
192
|
+
*/
|
|
193
|
+
tap(x: number, y: number, finger?: number): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Simulates an upward swipe gesture.
|
|
196
|
+
*
|
|
197
|
+
* @param duration - Swipe duration in milliseconds (defaults to 200).
|
|
198
|
+
*/
|
|
199
|
+
swipeUp(duration?: number): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Simulates a downward swipe gesture.
|
|
202
|
+
*
|
|
203
|
+
* @param duration - Swipe duration in milliseconds (defaults to 200).
|
|
204
|
+
*/
|
|
205
|
+
swipeDown(duration?: number): Promise<void>;
|
|
206
|
+
/**
|
|
207
|
+
* Simulates a leftward swipe gesture.
|
|
208
|
+
*
|
|
209
|
+
* @param duration - Swipe duration in milliseconds (defaults to 200).
|
|
210
|
+
*/
|
|
211
|
+
swipeLeft(duration?: number): Promise<void>;
|
|
212
|
+
/**
|
|
213
|
+
* Simulates a rightward swipe gesture.
|
|
214
|
+
*
|
|
215
|
+
* @param duration - Swipe duration in milliseconds (defaults to 200).
|
|
216
|
+
*/
|
|
217
|
+
swipeRight(duration?: number): Promise<void>;
|
|
218
|
+
/**
|
|
219
|
+
* Sends a double press of a HID key (two press-and-release cycles with a 150ms gap).
|
|
220
|
+
*
|
|
221
|
+
* @param usePage - USB HID usage page (1 = Generic Desktop, 12 = Consumer).
|
|
222
|
+
* @param usage - USB HID usage code.
|
|
223
|
+
*/
|
|
224
|
+
doublePress(usePage: number, usage: number): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Sends a long press of a HID key (hold for a configurable duration).
|
|
227
|
+
*
|
|
228
|
+
* @param usePage - USB HID usage page (1 = Generic Desktop, 12 = Consumer).
|
|
229
|
+
* @param usage - USB HID usage code.
|
|
230
|
+
* @param duration - Hold duration in milliseconds (defaults to 1000).
|
|
231
|
+
*/
|
|
232
|
+
longPress(usePage: number, usage: number, duration?: number): Promise<void>;
|
|
233
|
+
/**
|
|
234
|
+
* Sends a single press-and-release of a HID key with a 25ms hold.
|
|
235
|
+
*
|
|
236
|
+
* @param usePage - USB HID usage page (1 = Generic Desktop, 12 = Consumer).
|
|
237
|
+
* @param usage - USB HID usage code.
|
|
238
|
+
*/
|
|
239
|
+
pressAndRelease(usePage: number, usage: number): Promise<void>;
|
|
240
|
+
}
|
|
241
|
+
//#endregion
|
|
8
242
|
//#region src/airplay/player.d.ts
|
|
9
243
|
/**
|
|
10
244
|
* Represents a single media player within an app on the Apple TV.
|
|
@@ -25,12 +259,9 @@ declare class Player {
|
|
|
25
259
|
/** Current playback queue, or null if unavailable. */
|
|
26
260
|
get playbackQueue(): Proto.PlaybackQueue | null;
|
|
27
261
|
/**
|
|
28
|
-
* Effective playback state.
|
|
29
|
-
* reports Playing but the playback rate is 0 (effectively paused).
|
|
262
|
+
* Effective playback state.
|
|
30
263
|
*/
|
|
31
264
|
get playbackState(): Proto.PlaybackState_Enum;
|
|
32
|
-
/** The raw playback state as reported by the Apple TV, without corrections. */
|
|
33
|
-
get rawPlaybackState(): Proto.PlaybackState_Enum;
|
|
34
265
|
/** Timestamp of the last playback state update, used to discard stale updates. */
|
|
35
266
|
get playbackStateTimestamp(): number;
|
|
36
267
|
/** List of commands supported by this player. */
|
|
@@ -141,377 +372,151 @@ declare class Player {
|
|
|
141
372
|
*/
|
|
142
373
|
setSupportedCommands(supportedCommands: Proto.CommandInfo[]): void;
|
|
143
374
|
/**
|
|
144
|
-
* Merges updated content item data into the existing playback queue.
|
|
145
|
-
* Updates metadata, artwork, lyrics, and info fields for the matching item.
|
|
146
|
-
*
|
|
147
|
-
* @param item - The content item with updated fields.
|
|
148
|
-
*/
|
|
149
|
-
updateContentItem(item: Proto.ContentItem): void;
|
|
150
|
-
}
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region src/airplay/client.d.ts
|
|
153
|
-
/**
|
|
154
|
-
* Represents a now-playing app (client) on the Apple TV.
|
|
155
|
-
* Each client is identified by its bundle identifier and can contain multiple players.
|
|
156
|
-
* Proxies now-playing getters to the active player, merging player-specific and
|
|
157
|
-
* default supported commands.
|
|
158
|
-
*/
|
|
159
|
-
declare class Client {
|
|
160
|
-
#private;
|
|
161
|
-
/** Bundle identifier of the app (e.g. "com.apple.TVMusic"). */
|
|
162
|
-
get bundleIdentifier(): string;
|
|
163
|
-
/** Human-readable display name of the app. */
|
|
164
|
-
get displayName(): string;
|
|
165
|
-
/** Map of all known players for this client, keyed by player identifier. */
|
|
166
|
-
get players(): Map<string, Player>;
|
|
167
|
-
/** The currently active player, or null if none is active. Falls back to the default player. */
|
|
168
|
-
get activePlayer(): Player | null;
|
|
169
|
-
/** Now-playing info from the active player, or null. */
|
|
170
|
-
get nowPlayingInfo(): Proto.NowPlayingInfo | null;
|
|
171
|
-
/** Playback queue from the active player, or null. */
|
|
172
|
-
get playbackQueue(): Proto.PlaybackQueue | null;
|
|
173
|
-
/** Playback state from the active player, or Unknown. */
|
|
174
|
-
get playbackState(): Proto.PlaybackState_Enum;
|
|
175
|
-
/** Timestamp of the last playback state update from the active player. */
|
|
176
|
-
get playbackStateTimestamp(): number;
|
|
177
|
-
/**
|
|
178
|
-
* Merged list of supported commands from the active player and client defaults.
|
|
179
|
-
* Player commands take precedence; default commands are appended if not already present.
|
|
180
|
-
*/
|
|
181
|
-
get supportedCommands(): Proto.CommandInfo[];
|
|
182
|
-
/** Current track title from the active player. */
|
|
183
|
-
get title(): string;
|
|
184
|
-
/** Current track artist from the active player. */
|
|
185
|
-
get artist(): string;
|
|
186
|
-
/** Current track album from the active player. */
|
|
187
|
-
get album(): string;
|
|
188
|
-
/** Genre of the current content from the active player. */
|
|
189
|
-
get genre(): string;
|
|
190
|
-
/** Series name for TV show content from the active player. */
|
|
191
|
-
get seriesName(): string;
|
|
192
|
-
/** Season number for TV show content from the active player. */
|
|
193
|
-
get seasonNumber(): number;
|
|
194
|
-
/** Episode number for TV show content from the active player. */
|
|
195
|
-
get episodeNumber(): number;
|
|
196
|
-
/** Media type of the current content from the active player. */
|
|
197
|
-
get mediaType(): Proto.ContentItemMetadata_MediaType;
|
|
198
|
-
/** Content identifier of the current item from the active player. */
|
|
199
|
-
get contentIdentifier(): string;
|
|
200
|
-
/** Duration of the current track in seconds from the active player. */
|
|
201
|
-
get duration(): number;
|
|
202
|
-
/** Playback rate from the active player (1.0 = normal, 0 = paused). */
|
|
203
|
-
get playbackRate(): number;
|
|
204
|
-
/** Whether the active player is currently playing. */
|
|
205
|
-
get isPlaying(): boolean;
|
|
206
|
-
/** Current shuffle mode from the active player. */
|
|
207
|
-
get shuffleMode(): Proto.ShuffleMode_Enum;
|
|
208
|
-
/** Current repeat mode from the active player. */
|
|
209
|
-
get repeatMode(): Proto.RepeatMode_Enum;
|
|
210
|
-
/** Extrapolated elapsed time in seconds from the active player. */
|
|
211
|
-
get elapsedTime(): number;
|
|
212
|
-
/** Artwork identifier for change detection from the active player. */
|
|
213
|
-
get artworkId(): string | null;
|
|
214
|
-
/**
|
|
215
|
-
* Resolves the best available artwork URL from the active player.
|
|
216
|
-
*
|
|
217
|
-
* @param width - Desired artwork width in pixels.
|
|
218
|
-
* @param height - Desired artwork height in pixels (-1 for automatic).
|
|
219
|
-
* @returns The artwork URL, or null if unavailable.
|
|
220
|
-
*/
|
|
221
|
-
artworkUrl(width?: number, height?: number): string | null;
|
|
222
|
-
/** Current content item from the active player's playback queue. */
|
|
223
|
-
get currentItem(): Proto.ContentItem | null;
|
|
224
|
-
/** Metadata of the current content item from the active player. */
|
|
225
|
-
get currentItemMetadata(): Proto.ContentItemMetadata | null;
|
|
226
|
-
/** Raw artwork data (image bytes) from the active player. */
|
|
227
|
-
get currentItemArtwork(): Uint8Array | null;
|
|
228
|
-
/** Artwork URL at default dimensions from the active player. */
|
|
229
|
-
get currentItemArtworkUrl(): string | null;
|
|
230
|
-
/** Lyrics for the current content item from the active player. */
|
|
231
|
-
get currentItemLyrics(): Proto.LyricsItem | null;
|
|
232
|
-
/**
|
|
233
|
-
* Creates a new Client instance.
|
|
234
|
-
*
|
|
235
|
-
* @param bundleIdentifier - Bundle identifier of the app.
|
|
236
|
-
* @param displayName - Human-readable app name.
|
|
237
|
-
*/
|
|
238
|
-
constructor(bundleIdentifier: string, displayName: string);
|
|
239
|
-
/**
|
|
240
|
-
* Gets an existing player or creates a new one if it does not exist.
|
|
241
|
-
*
|
|
242
|
-
* @param identifier - Unique player identifier.
|
|
243
|
-
* @param displayName - Human-readable player name (defaults to identifier).
|
|
244
|
-
* @returns The existing or newly created Player.
|
|
245
|
-
*/
|
|
246
|
-
getOrCreatePlayer(identifier: string, displayName?: string): Player;
|
|
247
|
-
/**
|
|
248
|
-
* Sets the active player by identifier.
|
|
249
|
-
*
|
|
250
|
-
* @param identifier - Identifier of the player to activate.
|
|
251
|
-
*/
|
|
252
|
-
setActivePlayer(identifier: string): void;
|
|
253
|
-
/**
|
|
254
|
-
* Removes a player from this client. If the removed player was active,
|
|
255
|
-
* the active player is reset to null (falling back to the default player).
|
|
256
|
-
*
|
|
257
|
-
* @param identifier - Identifier of the player to remove.
|
|
258
|
-
*/
|
|
259
|
-
removePlayer(identifier: string): void;
|
|
260
|
-
/**
|
|
261
|
-
* Sets the default supported commands for this client. These are used as
|
|
262
|
-
* fallback when the active player has no commands of its own.
|
|
263
|
-
*
|
|
264
|
-
* @param supportedCommands - The default command list.
|
|
265
|
-
*/
|
|
266
|
-
setDefaultSupportedCommands(supportedCommands: Proto.CommandInfo[]): void;
|
|
267
|
-
/**
|
|
268
|
-
* Finds a command by type, checking the active player first,
|
|
269
|
-
* then falling back to the default supported commands.
|
|
270
|
-
*
|
|
271
|
-
* @param command - The command to look up.
|
|
272
|
-
* @returns The command info, or null if not found.
|
|
273
|
-
*/
|
|
274
|
-
findCommand(command: Proto.Command): Proto.CommandInfo | null;
|
|
275
|
-
/**
|
|
276
|
-
* Checks whether a command is supported and enabled, checking both
|
|
277
|
-
* the active player and default commands.
|
|
278
|
-
*
|
|
279
|
-
* @param command - The command to check.
|
|
280
|
-
* @returns True if the command is supported and enabled.
|
|
281
|
-
*/
|
|
282
|
-
isCommandSupported(command: Proto.Command): boolean;
|
|
283
|
-
/**
|
|
284
|
-
* Updates the display name for this client.
|
|
285
|
-
*
|
|
286
|
-
* @param displayName - The new display name.
|
|
287
|
-
*/
|
|
288
|
-
updateDisplayName(displayName: string): void;
|
|
289
|
-
}
|
|
290
|
-
//#endregion
|
|
291
|
-
//#region src/airplay/const.d.ts
|
|
292
|
-
/** Symbol used to access the underlying AirPlay Protocol instance from an AirPlayDevice. */
|
|
293
|
-
declare const PROTOCOL: unique symbol;
|
|
294
|
-
/** Symbol used to subscribe AirPlayState to DataStream events. */
|
|
295
|
-
declare const STATE_SUBSCRIBE_SYMBOL: unique symbol;
|
|
296
|
-
/** Symbol used to unsubscribe AirPlayState from DataStream events. */
|
|
297
|
-
declare const STATE_UNSUBSCRIBE_SYMBOL: unique symbol;
|
|
298
|
-
//#endregion
|
|
299
|
-
//#region src/airplay/remote.d.ts
|
|
300
|
-
/**
|
|
301
|
-
* Error thrown when a SendCommand request fails on the Apple TV side.
|
|
302
|
-
* Contains the specific send error and handler return status for diagnostics.
|
|
303
|
-
*/
|
|
304
|
-
declare class SendCommandError extends CommandError {
|
|
305
|
-
/** The send error reported by the Apple TV. */
|
|
306
|
-
readonly sendError: Proto.SendError_Enum;
|
|
307
|
-
/** The handler return status reported by the Apple TV. */
|
|
308
|
-
readonly handlerReturnStatus: Proto.HandlerReturnStatus_Enum;
|
|
309
|
-
/**
|
|
310
|
-
* Creates a new SendCommandError.
|
|
311
|
-
*
|
|
312
|
-
* @param sendError - The send error code from the Apple TV.
|
|
313
|
-
* @param handlerReturnStatus - The handler return status from the Apple TV.
|
|
314
|
-
*/
|
|
315
|
-
constructor(sendError: Proto.SendError_Enum, handlerReturnStatus: Proto.HandlerReturnStatus_Enum);
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Remote control for an AirPlay device.
|
|
319
|
-
* Provides HID-based navigation and media keys (USB usage pages: Generic Desktop 0x01
|
|
320
|
-
* and Consumer 0x0c), SendCommand-based media controls, keyboard/text input,
|
|
321
|
-
* and touch/gesture simulation.
|
|
322
|
-
*/
|
|
323
|
-
declare class export_default$1 {
|
|
324
|
-
#private;
|
|
325
|
-
/**
|
|
326
|
-
* Creates a new Remote controller.
|
|
327
|
-
*
|
|
328
|
-
* @param device - The AirPlay device to control.
|
|
329
|
-
*/
|
|
330
|
-
constructor(device: export_default);
|
|
331
|
-
/** Sends an Up navigation key press (Generic Desktop, usage 0x8C). */
|
|
332
|
-
up(): Promise<void>;
|
|
333
|
-
/** Sends a Down navigation key press (Generic Desktop, usage 0x8D). */
|
|
334
|
-
down(): Promise<void>;
|
|
335
|
-
/** Sends a Left navigation key press (Generic Desktop, usage 0x8B). */
|
|
336
|
-
left(): Promise<void>;
|
|
337
|
-
/** Sends a Right navigation key press (Generic Desktop, usage 0x8A). */
|
|
338
|
-
right(): Promise<void>;
|
|
339
|
-
/** Sends a Menu key press (Generic Desktop, usage 0x86). */
|
|
340
|
-
menu(): Promise<void>;
|
|
341
|
-
/** Sends a Select/Enter key press (Generic Desktop, usage 0x89). */
|
|
342
|
-
select(): Promise<void>;
|
|
343
|
-
/** Sends a Home button press (Consumer, usage 0x40). */
|
|
344
|
-
home(): Promise<void>;
|
|
345
|
-
/** Sends a Suspend/Sleep key press to put the device to sleep (Generic Desktop, usage 0x82). */
|
|
346
|
-
suspend(): Promise<void>;
|
|
347
|
-
/** Sends a Wake key press to wake the device (Generic Desktop, usage 0x83). */
|
|
348
|
-
wake(): Promise<void>;
|
|
349
|
-
/** Sends a Play key press (Consumer, usage 0xB0). */
|
|
350
|
-
play(): Promise<void>;
|
|
351
|
-
/** Sends a Pause key press (Consumer, usage 0xB1). */
|
|
352
|
-
pause(): Promise<void>;
|
|
353
|
-
/** Toggles play/pause based on the current playback state. */
|
|
354
|
-
playPause(): Promise<void>;
|
|
355
|
-
/** Sends a Stop key press (Consumer, usage 0xB7). */
|
|
356
|
-
stop(): Promise<void>;
|
|
357
|
-
/** Sends a Next Track key press (Consumer, usage 0xB5). */
|
|
358
|
-
next(): Promise<void>;
|
|
359
|
-
/** Sends a Previous Track key press (Consumer, usage 0xB6). */
|
|
360
|
-
previous(): Promise<void>;
|
|
361
|
-
/** Sends a Volume Up key press (Consumer, usage 0xE9). */
|
|
362
|
-
volumeUp(): Promise<void>;
|
|
363
|
-
/** Sends a Volume Down key press (Consumer, usage 0xEA). */
|
|
364
|
-
volumeDown(): Promise<void>;
|
|
365
|
-
/** Sends a Mute key press (Consumer, usage 0xE2). */
|
|
366
|
-
mute(): Promise<void>;
|
|
367
|
-
/** Sends a Top Menu key press (Consumer, usage 0x60). */
|
|
368
|
-
topMenu(): Promise<void>;
|
|
369
|
-
/** Sends a Channel Up key press (Consumer, usage 0x9C). */
|
|
370
|
-
channelUp(): Promise<void>;
|
|
371
|
-
/** Sends a Channel Down key press (Consumer, usage 0x9D). */
|
|
372
|
-
channelDown(): Promise<void>;
|
|
373
|
-
/** Sends a Play command via the MRP SendCommand protocol. */
|
|
374
|
-
commandPlay(): Promise<void>;
|
|
375
|
-
/** Sends a Pause command via the MRP SendCommand protocol. */
|
|
376
|
-
commandPause(): Promise<void>;
|
|
377
|
-
/** Sends a TogglePlayPause command via the MRP SendCommand protocol. */
|
|
378
|
-
commandTogglePlayPause(): Promise<void>;
|
|
379
|
-
/** Sends a Stop command via the MRP SendCommand protocol. */
|
|
380
|
-
commandStop(): Promise<void>;
|
|
381
|
-
/** Sends a NextTrack command via the MRP SendCommand protocol. */
|
|
382
|
-
commandNextTrack(): Promise<void>;
|
|
383
|
-
/** Sends a PreviousTrack command via the MRP SendCommand protocol. */
|
|
384
|
-
commandPreviousTrack(): Promise<void>;
|
|
385
|
-
/**
|
|
386
|
-
* Sends a SkipForward command with a configurable interval.
|
|
387
|
-
*
|
|
388
|
-
* @param interval - Seconds to skip forward (defaults to 15).
|
|
389
|
-
*/
|
|
390
|
-
commandSkipForward(interval?: number): Promise<void>;
|
|
391
|
-
/**
|
|
392
|
-
* Sends a SkipBackward command with a configurable interval.
|
|
393
|
-
*
|
|
394
|
-
* @param interval - Seconds to skip backward (defaults to 15).
|
|
395
|
-
*/
|
|
396
|
-
commandSkipBackward(interval?: number): Promise<void>;
|
|
397
|
-
/**
|
|
398
|
-
* Seeks to an absolute playback position.
|
|
399
|
-
*
|
|
400
|
-
* @param position - The target position in seconds.
|
|
401
|
-
*/
|
|
402
|
-
commandSeekToPosition(position: number): Promise<void>;
|
|
403
|
-
/**
|
|
404
|
-
* Sets the shuffle mode.
|
|
405
|
-
*
|
|
406
|
-
* @param mode - The desired shuffle mode.
|
|
407
|
-
*/
|
|
408
|
-
commandSetShuffleMode(mode: Proto.ShuffleMode_Enum): Promise<void>;
|
|
409
|
-
/**
|
|
410
|
-
* Sets the repeat mode.
|
|
411
|
-
*
|
|
412
|
-
* @param mode - The desired repeat mode.
|
|
413
|
-
*/
|
|
414
|
-
commandSetRepeatMode(mode: Proto.RepeatMode_Enum): Promise<void>;
|
|
415
|
-
/**
|
|
416
|
-
* Changes the playback rate (speed).
|
|
375
|
+
* Merges updated content item data into the existing playback queue.
|
|
376
|
+
* Updates metadata, artwork, lyrics, and info fields for the matching item.
|
|
417
377
|
*
|
|
418
|
-
* @param
|
|
378
|
+
* @param item - The content item with updated fields.
|
|
419
379
|
*/
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
380
|
+
updateContentItem(item: Proto.ContentItem): void;
|
|
381
|
+
}
|
|
382
|
+
//#endregion
|
|
383
|
+
//#region src/airplay/client.d.ts
|
|
384
|
+
/**
|
|
385
|
+
* Represents a now-playing app (client) on the Apple TV.
|
|
386
|
+
* Each client is identified by its bundle identifier and can contain multiple players.
|
|
387
|
+
* Proxies now-playing getters to the active player, merging player-specific and
|
|
388
|
+
* default supported commands.
|
|
389
|
+
*/
|
|
390
|
+
declare class Client {
|
|
391
|
+
#private;
|
|
392
|
+
/** Bundle identifier of the app (e.g. "com.apple.TVMusic"). */
|
|
393
|
+
get bundleIdentifier(): string;
|
|
394
|
+
/** Human-readable display name of the app. */
|
|
395
|
+
get displayName(): string;
|
|
396
|
+
/** Map of all known players for this client, keyed by player identifier. */
|
|
397
|
+
get players(): Map<string, Player>;
|
|
398
|
+
/** The currently active player, or null if none is active. Falls back to the default player. */
|
|
399
|
+
get activePlayer(): Player | null;
|
|
400
|
+
/** Now-playing info from the active player, or null. */
|
|
401
|
+
get nowPlayingInfo(): Proto.NowPlayingInfo | null;
|
|
402
|
+
/** Playback queue from the active player, or null. */
|
|
403
|
+
get playbackQueue(): Proto.PlaybackQueue | null;
|
|
404
|
+
/** Playback state from the active player, or Unknown. */
|
|
405
|
+
get playbackState(): Proto.PlaybackState_Enum;
|
|
406
|
+
/** Timestamp of the last playback state update from the active player. */
|
|
407
|
+
get playbackStateTimestamp(): number;
|
|
445
408
|
/**
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
* @param text - The text to set.
|
|
409
|
+
* Merged list of supported commands from the active player and client defaults.
|
|
410
|
+
* Player commands take precedence; default commands are appended if not already present.
|
|
449
411
|
*/
|
|
450
|
-
|
|
412
|
+
get supportedCommands(): Proto.CommandInfo[];
|
|
413
|
+
/** Current track title from the active player. */
|
|
414
|
+
get title(): string;
|
|
415
|
+
/** Current track artist from the active player. */
|
|
416
|
+
get artist(): string;
|
|
417
|
+
/** Current track album from the active player. */
|
|
418
|
+
get album(): string;
|
|
419
|
+
/** Genre of the current content from the active player. */
|
|
420
|
+
get genre(): string;
|
|
421
|
+
/** Series name for TV show content from the active player. */
|
|
422
|
+
get seriesName(): string;
|
|
423
|
+
/** Season number for TV show content from the active player. */
|
|
424
|
+
get seasonNumber(): number;
|
|
425
|
+
/** Episode number for TV show content from the active player. */
|
|
426
|
+
get episodeNumber(): number;
|
|
427
|
+
/** Media type of the current content from the active player. */
|
|
428
|
+
get mediaType(): Proto.ContentItemMetadata_MediaType;
|
|
429
|
+
/** Content identifier of the current item from the active player. */
|
|
430
|
+
get contentIdentifier(): string;
|
|
431
|
+
/** Duration of the current track in seconds from the active player. */
|
|
432
|
+
get duration(): number;
|
|
433
|
+
/** Playback rate from the active player (1.0 = normal, 0 = paused). */
|
|
434
|
+
get playbackRate(): number;
|
|
435
|
+
/** Whether the active player is currently playing. */
|
|
436
|
+
get isPlaying(): boolean;
|
|
437
|
+
/** Current shuffle mode from the active player. */
|
|
438
|
+
get shuffleMode(): Proto.ShuffleMode_Enum;
|
|
439
|
+
/** Current repeat mode from the active player. */
|
|
440
|
+
get repeatMode(): Proto.RepeatMode_Enum;
|
|
441
|
+
/** Extrapolated elapsed time in seconds from the active player. */
|
|
442
|
+
get elapsedTime(): number;
|
|
443
|
+
/** Artwork identifier for change detection from the active player. */
|
|
444
|
+
get artworkId(): string | null;
|
|
451
445
|
/**
|
|
452
|
-
*
|
|
446
|
+
* Resolves the best available artwork URL from the active player.
|
|
453
447
|
*
|
|
454
|
-
* @param
|
|
448
|
+
* @param width - Desired artwork width in pixels.
|
|
449
|
+
* @param height - Desired artwork height in pixels (-1 for automatic).
|
|
450
|
+
* @returns The artwork URL, or null if unavailable.
|
|
455
451
|
*/
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
|
|
459
|
-
/**
|
|
460
|
-
|
|
452
|
+
artworkUrl(width?: number, height?: number): string | null;
|
|
453
|
+
/** Current content item from the active player's playback queue. */
|
|
454
|
+
get currentItem(): Proto.ContentItem | null;
|
|
455
|
+
/** Metadata of the current content item from the active player. */
|
|
456
|
+
get currentItemMetadata(): Proto.ContentItemMetadata | null;
|
|
457
|
+
/** Raw artwork data (image bytes) from the active player. */
|
|
458
|
+
get currentItemArtwork(): Uint8Array | null;
|
|
459
|
+
/** Artwork URL at default dimensions from the active player. */
|
|
460
|
+
get currentItemArtworkUrl(): string | null;
|
|
461
|
+
/** Lyrics for the current content item from the active player. */
|
|
462
|
+
get currentItemLyrics(): Proto.LyricsItem | null;
|
|
461
463
|
/**
|
|
462
|
-
*
|
|
464
|
+
* Creates a new Client instance.
|
|
463
465
|
*
|
|
464
|
-
* @param
|
|
465
|
-
* @param
|
|
466
|
-
* @param finger - Finger index for multi-touch (defaults to 1).
|
|
466
|
+
* @param bundleIdentifier - Bundle identifier of the app.
|
|
467
|
+
* @param displayName - Human-readable app name.
|
|
467
468
|
*/
|
|
468
|
-
|
|
469
|
+
constructor(bundleIdentifier: string, displayName: string);
|
|
469
470
|
/**
|
|
470
|
-
*
|
|
471
|
+
* Gets an existing player or creates a new one if it does not exist.
|
|
471
472
|
*
|
|
472
|
-
* @param
|
|
473
|
+
* @param identifier - Unique player identifier.
|
|
474
|
+
* @param displayName - Human-readable player name (defaults to identifier).
|
|
475
|
+
* @returns The existing or newly created Player.
|
|
473
476
|
*/
|
|
474
|
-
|
|
477
|
+
getOrCreatePlayer(identifier: string, displayName?: string): Player;
|
|
475
478
|
/**
|
|
476
|
-
*
|
|
479
|
+
* Sets the active player by identifier.
|
|
477
480
|
*
|
|
478
|
-
* @param
|
|
481
|
+
* @param identifier - Identifier of the player to activate.
|
|
479
482
|
*/
|
|
480
|
-
|
|
483
|
+
setActivePlayer(identifier: string): void;
|
|
481
484
|
/**
|
|
482
|
-
*
|
|
485
|
+
* Removes a player from this client. If the removed player was active,
|
|
486
|
+
* the active player is reset to null (falling back to the default player).
|
|
483
487
|
*
|
|
484
|
-
* @param
|
|
488
|
+
* @param identifier - Identifier of the player to remove.
|
|
485
489
|
*/
|
|
486
|
-
|
|
490
|
+
removePlayer(identifier: string): void;
|
|
487
491
|
/**
|
|
488
|
-
*
|
|
492
|
+
* Sets the default supported commands for this client. These are used as
|
|
493
|
+
* fallback when the active player has no commands of its own.
|
|
489
494
|
*
|
|
490
|
-
* @param
|
|
495
|
+
* @param supportedCommands - The default command list.
|
|
491
496
|
*/
|
|
492
|
-
|
|
497
|
+
setDefaultSupportedCommands(supportedCommands: Proto.CommandInfo[]): void;
|
|
493
498
|
/**
|
|
494
|
-
*
|
|
499
|
+
* Finds a command by type, checking the active player first,
|
|
500
|
+
* then falling back to the default supported commands.
|
|
495
501
|
*
|
|
496
|
-
* @param
|
|
497
|
-
* @
|
|
502
|
+
* @param command - The command to look up.
|
|
503
|
+
* @returns The command info, or null if not found.
|
|
498
504
|
*/
|
|
499
|
-
|
|
505
|
+
findCommand(command: Proto.Command): Proto.CommandInfo | null;
|
|
500
506
|
/**
|
|
501
|
-
*
|
|
507
|
+
* Checks whether a command is supported and enabled, checking both
|
|
508
|
+
* the active player and default commands.
|
|
502
509
|
*
|
|
503
|
-
* @param
|
|
504
|
-
* @
|
|
505
|
-
* @param duration - Hold duration in milliseconds (defaults to 1000).
|
|
510
|
+
* @param command - The command to check.
|
|
511
|
+
* @returns True if the command is supported and enabled.
|
|
506
512
|
*/
|
|
507
|
-
|
|
513
|
+
isCommandSupported(command: Proto.Command): boolean;
|
|
508
514
|
/**
|
|
509
|
-
*
|
|
515
|
+
* Updates the display name for this client.
|
|
510
516
|
*
|
|
511
|
-
* @param
|
|
512
|
-
* @param usage - USB HID usage code.
|
|
517
|
+
* @param displayName - The new display name.
|
|
513
518
|
*/
|
|
514
|
-
|
|
519
|
+
updateDisplayName(displayName: string): void;
|
|
515
520
|
}
|
|
516
521
|
//#endregion
|
|
517
522
|
//#region src/airplay/state.d.ts
|
|
@@ -554,6 +559,8 @@ type EventMap$5 = {
|
|
|
554
559
|
readonly playbackQueueChanged: [client: Client, player: Player];
|
|
555
560
|
readonly playbackStateChanged: [client: Client, player: Player, oldState: Proto.PlaybackState_Enum, newState: Proto.PlaybackState_Enum];
|
|
556
561
|
readonly supportedCommandsChanged: [client: Client, player: Player, commands: Proto.CommandInfo[]];
|
|
562
|
+
readonly clusterChanged: [clusterID: string | null, isLeader: boolean];
|
|
563
|
+
readonly playerClientParticipantsUpdate: [Proto.PlayerClientParticipantsUpdateMessage];
|
|
557
564
|
};
|
|
558
565
|
/**
|
|
559
566
|
* Tracks the complete state of an AirPlay device: clients, players, now-playing,
|
|
@@ -585,6 +592,10 @@ declare class export_default$2 extends EventEmitter<EventMap$5> {
|
|
|
585
592
|
get isClusterAware(): boolean;
|
|
586
593
|
/** Whether this device is the leader of its multi-room cluster. */
|
|
587
594
|
get isClusterLeader(): boolean;
|
|
595
|
+
/** Current playback queue participants (e.g. SharePlay users). */
|
|
596
|
+
get participants(): Proto.PlaybackQueueParticipant[];
|
|
597
|
+
/** Raw JPEG artwork data from the last SET_ARTWORK_MESSAGE, or null. */
|
|
598
|
+
get artworkJpegData(): Uint8Array | null;
|
|
588
599
|
/** Current volume level (0.0 - 1.0). */
|
|
589
600
|
get volume(): number;
|
|
590
601
|
/** Whether volume control is available on this device. */
|
|
@@ -731,6 +742,12 @@ declare class export_default$2 extends EventEmitter<EventMap$5> {
|
|
|
731
742
|
*
|
|
732
743
|
* @param message - The update output device message.
|
|
733
744
|
*/
|
|
745
|
+
/**
|
|
746
|
+
* Handles playback queue participant updates (e.g. SharePlay users).
|
|
747
|
+
*
|
|
748
|
+
* @param message - The participants update message.
|
|
749
|
+
*/
|
|
750
|
+
onPlayerClientParticipantsUpdate(message: Proto.PlayerClientParticipantsUpdateMessage): void;
|
|
734
751
|
onUpdateOutputDevice(message: Proto.UpdateOutputDeviceMessage): void;
|
|
735
752
|
/**
|
|
736
753
|
* Handles volume control availability changes.
|
|
@@ -800,6 +817,68 @@ declare class export_default$3 {
|
|
|
800
817
|
* @throws CommandError when no output device is active or absolute volume is not supported.
|
|
801
818
|
*/
|
|
802
819
|
set(volume: number): Promise<void>;
|
|
820
|
+
/**
|
|
821
|
+
* Mutes the output device.
|
|
822
|
+
*
|
|
823
|
+
* @throws CommandError when no output device is active.
|
|
824
|
+
*/
|
|
825
|
+
mute(): Promise<void>;
|
|
826
|
+
/**
|
|
827
|
+
* Unmutes the output device.
|
|
828
|
+
*
|
|
829
|
+
* @throws CommandError when no output device is active.
|
|
830
|
+
*/
|
|
831
|
+
unmute(): Promise<void>;
|
|
832
|
+
/**
|
|
833
|
+
* Toggles the mute state of the output device.
|
|
834
|
+
*
|
|
835
|
+
* @throws CommandError when no output device is active.
|
|
836
|
+
*/
|
|
837
|
+
toggleMute(): Promise<void>;
|
|
838
|
+
/**
|
|
839
|
+
* Sets the volume for a specific output device in a speaker group.
|
|
840
|
+
* Use this to control individual speakers when multiple devices are grouped.
|
|
841
|
+
*
|
|
842
|
+
* @param outputDeviceUID - The unique identifier of the target output device.
|
|
843
|
+
* @param volume - The desired volume level (clamped to 0.0 - 1.0).
|
|
844
|
+
*/
|
|
845
|
+
setForDevice(outputDeviceUID: string, volume: number): Promise<void>;
|
|
846
|
+
/**
|
|
847
|
+
* Fetches the volume for a specific output device in a speaker group.
|
|
848
|
+
*
|
|
849
|
+
* @param outputDeviceUID - The unique identifier of the target output device.
|
|
850
|
+
* @returns The volume level as a float between 0.0 and 1.0.
|
|
851
|
+
*/
|
|
852
|
+
getForDevice(outputDeviceUID: string): Promise<number>;
|
|
853
|
+
/**
|
|
854
|
+
* Mutes a specific output device in a speaker group.
|
|
855
|
+
*
|
|
856
|
+
* @param outputDeviceUID - The unique identifier of the target output device.
|
|
857
|
+
*/
|
|
858
|
+
muteDevice(outputDeviceUID: string): Promise<void>;
|
|
859
|
+
/**
|
|
860
|
+
* Unmutes a specific output device in a speaker group.
|
|
861
|
+
*
|
|
862
|
+
* @param outputDeviceUID - The unique identifier of the target output device.
|
|
863
|
+
*/
|
|
864
|
+
unmuteDevice(outputDeviceUID: string): Promise<void>;
|
|
865
|
+
/**
|
|
866
|
+
* Adjusts the volume by a relative increment/decrement on a specific output device.
|
|
867
|
+
* This is the method Apple uses internally in Music.app for volume changes.
|
|
868
|
+
*
|
|
869
|
+
* @param adjustment - The volume adjustment to apply (IncrementSmall/Medium/Large, DecrementSmall/Medium/Large).
|
|
870
|
+
* @param outputDeviceUID - Optional UID of the target output device. Defaults to the active device.
|
|
871
|
+
*/
|
|
872
|
+
adjust(adjustment: Proto.AdjustVolumeMessage_Adjustment, outputDeviceUID?: string): Promise<void>;
|
|
873
|
+
/**
|
|
874
|
+
* Smoothly fades the volume to a target level over a given duration.
|
|
875
|
+
* Uses linear interpolation with absolute volume set calls.
|
|
876
|
+
*
|
|
877
|
+
* @param targetVolume - The target volume level (0.0 - 1.0).
|
|
878
|
+
* @param durationMs - The fade duration in milliseconds.
|
|
879
|
+
* @throws CommandError when absolute volume control is not available.
|
|
880
|
+
*/
|
|
881
|
+
fade(targetVolume: number, durationMs: number): Promise<void>;
|
|
803
882
|
}
|
|
804
883
|
//#endregion
|
|
805
884
|
//#region src/airplay/device.d.ts
|
|
@@ -845,6 +924,8 @@ declare class export_default extends EventEmitter<EventMap$4> {
|
|
|
845
924
|
get isConnected(): boolean;
|
|
846
925
|
/** Raw receiver info dictionary from the /info endpoint, or undefined before connect. */
|
|
847
926
|
get receiverInfo(): Record<string, any> | undefined;
|
|
927
|
+
/** The Artwork controller for fetching now-playing artwork from all sources. */
|
|
928
|
+
get artwork(): Artwork;
|
|
848
929
|
/** The Remote controller for HID keys, SendCommand, text input, and touch. */
|
|
849
930
|
get remote(): export_default$1;
|
|
850
931
|
/** The State tracker for now-playing, volume, keyboard, and output device state. */
|
|
@@ -917,6 +998,28 @@ declare class export_default extends EventEmitter<EventMap$4> {
|
|
|
917
998
|
* @param source - The audio source to stream (e.g. MP3, WAV, URL, live).
|
|
918
999
|
*/
|
|
919
1000
|
streamAudio(source: AudioSource): Promise<void>;
|
|
1001
|
+
/**
|
|
1002
|
+
* Sets the audio listening mode on the device (HomePod).
|
|
1003
|
+
*
|
|
1004
|
+
* @param mode - Listening mode string (e.g. 'Default', 'Vivid', 'LateNight').
|
|
1005
|
+
*/
|
|
1006
|
+
setListeningMode(mode: string): Promise<void>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Sets the audio routing mode on the receiver via the control stream.
|
|
1009
|
+
*
|
|
1010
|
+
* @param mode - Audio mode (e.g. 'default', 'moviePlayback', 'spoken').
|
|
1011
|
+
*/
|
|
1012
|
+
setAudioMode(mode: string): Promise<void>;
|
|
1013
|
+
/**
|
|
1014
|
+
* Triggers an audio fade on the device.
|
|
1015
|
+
*
|
|
1016
|
+
* @param fadeType - The fade type (0 = fade out, 1 = fade in).
|
|
1017
|
+
*/
|
|
1018
|
+
audioFade(fadeType: number): Promise<void>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Wakes the device from sleep via the DataStream.
|
|
1021
|
+
*/
|
|
1022
|
+
wake(): Promise<void>;
|
|
920
1023
|
/**
|
|
921
1024
|
* Requests the playback queue from the device.
|
|
922
1025
|
*
|
|
@@ -945,10 +1048,54 @@ declare class export_default extends EventEmitter<EventMap$4> {
|
|
|
945
1048
|
* @param err - The error that occurred.
|
|
946
1049
|
*/
|
|
947
1050
|
onError(err: Error): void;
|
|
1051
|
+
/** Handles now-playing changes to auto-fetch artwork on track changes. */
|
|
1052
|
+
onNowPlayingChanged(_client: any, player: any): void;
|
|
948
1053
|
/** Handles stream timeout events by destroying the control stream. */
|
|
949
1054
|
onTimeout(): void;
|
|
950
1055
|
}
|
|
951
1056
|
//#endregion
|
|
1057
|
+
//#region src/airplay/artwork.d.ts
|
|
1058
|
+
/**
|
|
1059
|
+
* Artwork result from the unified artwork API.
|
|
1060
|
+
* Always contains at least one of `url` or `data`.
|
|
1061
|
+
*/
|
|
1062
|
+
type ArtworkResult = {
|
|
1063
|
+
/** Direct URL to the artwork image (preferred for web/UI rendering). */readonly url: string | null; /** Raw image bytes (available when artwork is embedded or fetched from playback queue). */
|
|
1064
|
+
readonly data: Uint8Array | null; /** MIME type of the artwork (e.g. 'image/jpeg', 'image/png'). */
|
|
1065
|
+
readonly mimeType: string; /** The artwork identifier used for change detection. */
|
|
1066
|
+
readonly identifier: string | null; /** Width of the artwork in pixels (0 if unknown). */
|
|
1067
|
+
readonly width: number; /** Height of the artwork in pixels (0 if unknown). */
|
|
1068
|
+
readonly height: number;
|
|
1069
|
+
};
|
|
1070
|
+
/**
|
|
1071
|
+
* Unified artwork controller for an AirPlay device.
|
|
1072
|
+
*
|
|
1073
|
+
* Provides a single `get()` method that resolves artwork from all available
|
|
1074
|
+
* sources in priority order:
|
|
1075
|
+
* 1. URL from now-playing metadata (artworkURL, remoteArtworks, template)
|
|
1076
|
+
* 2. Inline binary data from the playback queue (artworkData, dataArtworks)
|
|
1077
|
+
* 3. JPEG data from SET_ARTWORK_MESSAGE
|
|
1078
|
+
* 4. Fetches the playback queue if artwork is expected but not yet available
|
|
1079
|
+
*/
|
|
1080
|
+
declare class Artwork {
|
|
1081
|
+
#private;
|
|
1082
|
+
constructor(device: export_default);
|
|
1083
|
+
/**
|
|
1084
|
+
* Gets the current artwork for the active now-playing item.
|
|
1085
|
+
*
|
|
1086
|
+
* Tries all available sources in priority order and returns a unified result.
|
|
1087
|
+
* Results are cached by artwork identifier — subsequent calls for the same
|
|
1088
|
+
* track return the cached result without additional requests.
|
|
1089
|
+
*
|
|
1090
|
+
* @param width - Desired artwork width in pixels (default: 600).
|
|
1091
|
+
* @param height - Desired artwork height in pixels (-1 for proportional).
|
|
1092
|
+
* @returns The artwork result, or null if no artwork is available.
|
|
1093
|
+
*/
|
|
1094
|
+
get(width?: number, height?: number): Promise<ArtworkResult | null>;
|
|
1095
|
+
/** Clears the cached artwork, forcing a fresh fetch on the next `get()` call. */
|
|
1096
|
+
clear(): void;
|
|
1097
|
+
}
|
|
1098
|
+
//#endregion
|
|
952
1099
|
//#region src/companion-link/const.d.ts
|
|
953
1100
|
/** Symbol used to access the underlying Companion Link Protocol instance from a CompanionLinkDevice. */
|
|
954
1101
|
declare const PROTOCOL$1: unique symbol;
|
|
@@ -1501,6 +1648,16 @@ declare abstract class export_default$8 extends EventEmitter<EventMap> {
|
|
|
1501
1648
|
get playbackStateTimestamp(): number;
|
|
1502
1649
|
/** Current volume level (0.0 - 1.0). */
|
|
1503
1650
|
get volume(): number;
|
|
1651
|
+
/** Whether the device is currently muted. */
|
|
1652
|
+
get isMuted(): boolean;
|
|
1653
|
+
/** Cluster ID when part of a speaker group, or null. */
|
|
1654
|
+
get clusterID(): string | null;
|
|
1655
|
+
/** Cluster type identifier (0 = none). */
|
|
1656
|
+
get clusterType(): number;
|
|
1657
|
+
/** Whether this device supports cluster-aware multi-room. */
|
|
1658
|
+
get isClusterAware(): boolean;
|
|
1659
|
+
/** Whether this device is the leader in a speaker cluster. */
|
|
1660
|
+
get isClusterLeader(): boolean;
|
|
1504
1661
|
/**
|
|
1505
1662
|
* Creates a new HomePod base instance.
|
|
1506
1663
|
*
|
|
@@ -1540,6 +1697,14 @@ declare abstract class export_default$8 extends EventEmitter<EventMap> {
|
|
|
1540
1697
|
* @param source - The audio source to stream.
|
|
1541
1698
|
*/
|
|
1542
1699
|
streamAudio(source: AudioSource): Promise<void>;
|
|
1700
|
+
/**
|
|
1701
|
+
* Requests the current playback queue with lyrics from the device.
|
|
1702
|
+
* Lyrics are included by default in the playback queue request.
|
|
1703
|
+
* Real-time lyrics timing events are emitted via the `lyricsEvent` event on state.
|
|
1704
|
+
*
|
|
1705
|
+
* @param length - Maximum number of queue items to retrieve (defaults to 1).
|
|
1706
|
+
*/
|
|
1707
|
+
requestLyrics(length?: number): Promise<void>;
|
|
1543
1708
|
/**
|
|
1544
1709
|
* Gets the CommandInfo for a specific command from the active player.
|
|
1545
1710
|
*
|
|
@@ -1570,4 +1735,22 @@ declare class export_default$6 extends export_default$8 {}
|
|
|
1570
1735
|
*/
|
|
1571
1736
|
declare class export_default$7 extends export_default$8 {}
|
|
1572
1737
|
//#endregion
|
|
1573
|
-
|
|
1738
|
+
//#region src/utils.d.ts
|
|
1739
|
+
/**
|
|
1740
|
+
* Gets the CommandInfo for a specific command from the active now-playing client.
|
|
1741
|
+
*
|
|
1742
|
+
* @param state - The AirPlay state tracker.
|
|
1743
|
+
* @param command - The command to look up.
|
|
1744
|
+
* @returns The command info, or null if no client is active or command not found.
|
|
1745
|
+
*/
|
|
1746
|
+
declare function getCommandInfo(state: export_default$2, command: Proto.Command): Proto.CommandInfo | null;
|
|
1747
|
+
/**
|
|
1748
|
+
* Checks whether a command is supported and enabled by the active now-playing client.
|
|
1749
|
+
*
|
|
1750
|
+
* @param state - The AirPlay state tracker.
|
|
1751
|
+
* @param command - The command to check.
|
|
1752
|
+
* @returns True if supported and enabled, false otherwise.
|
|
1753
|
+
*/
|
|
1754
|
+
declare function isCommandSupported(state: export_default$2, command: Proto.Command): boolean;
|
|
1755
|
+
//#endregion
|
|
1756
|
+
export { PROTOCOL as AIRPLAY, Artwork as AirPlayArtwork, Client as AirPlayClient, export_default as AirPlayDevice, Player as AirPlayPlayer, export_default$1 as AirPlayRemote, export_default$2 as AirPlayState, export_default$3 as AirPlayVolume, export_default$4 as AppleTV, type ArtworkResult, PROTOCOL$1 as COMPANION_LINK, export_default$5 as CompanionLinkDevice, export_default$6 as HomePod, export_default$7 as HomePodMini, type MediaCapabilities, SendCommandError, getCommandInfo, isCommandSupported };
|