@corewire/airplay 0.0.0 → 1.0.0-beta.1
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/README.md +30 -1
- package/dist/chunk-w6R9maHv.mjs +18 -0
- package/dist/describe-CAEDGJLu.mjs +12457 -0
- package/dist/identifiers-CsXXbYkW.mjs +67 -0
- package/dist/index-BlcOBfSz.d.mts +87 -0
- package/dist/index-YqIv0vCR.d.mts +135 -0
- package/dist/index.d.mts +105 -0
- package/dist/index.mjs +3638 -0
- package/dist/mrp.d.mts +687 -0
- package/dist/mrp.mjs +2112 -0
- package/dist/raop.d.mts +344 -0
- package/dist/raop.mjs +1248 -0
- package/dist/rtsp-BWFaYW5H.mjs +374 -0
- package/dist/rtsp.d.mts +2 -0
- package/dist/rtsp.mjs +3 -0
- package/dist/session-oDF9A9as.d.mts +13915 -0
- package/package.json +76 -18
package/dist/mrp.d.mts
ADDED
|
@@ -0,0 +1,687 @@
|
|
|
1
|
+
import { A as KeyboardState_Enum, B as PlayerPath, C as SendCommandResultMessage, D as PlaybackQueue$1, E as PlaybackQueueParticipant, F as ContentItemMetadata, G as ErrorCode_Enum, H as RepeatMode_Enum, I as ContentItemMetadata_MediaType, J as Extendee, K as ProtocolMessage, L as CommandOptions, M as VolumeCapabilities_Enum, N as ContentItem, O as NowPlayingInfo, P as LyricsItem, R as Command, S as HandlerReturnStatus_Enum, T as PlaybackQueueRequestMessage, U as ShuffleMode_Enum, V as PlaybackState_Enum, W as AdjustVolumeMessage_Adjustment, X as DescExtension, Y as ExtensionValueShape, _ as parseMessages, b as ActionType_Enum, d as DataChannel, g as decodeMessage, h as MrpMessageName, j as TextEditingAttributes, k as LyricsEvent, m as MrpMessageMap, p as MrpMessage, q as ProtocolMessage_Type, t as AirPlaySession, v as index_d_exports, w as SendError_Enum, x as SetConnectionStateMessage_ConnectionState, y as AVOutputDeviceDescriptor, z as CommandInfo } from "./session-oDF9A9as.mjs";
|
|
2
|
+
import { EventEmitter } from "node:events";
|
|
3
|
+
import { CommandError } from "@corewire/core";
|
|
4
|
+
import { Context, DeviceIdentity } from "@corewire/core/transport";
|
|
5
|
+
|
|
6
|
+
//#region src/identity.d.ts
|
|
7
|
+
/** Every identity field, with the defaults filled in. */
|
|
8
|
+
type ResolvedIdentity = Required<DeviceIdentity>;
|
|
9
|
+
declare namespace messages_d_exports {
|
|
10
|
+
export { PlaybackQueueAssetOptions, adjustVolume, audioFade, clientUpdatesConfig, configureConnection, deviceInfo, getExtension, getKeyboardSession, getRemoteTextInputSession, getState, getVolume, getVolumeMuted, modifyOutputContext, notification, playbackQueueRequest, playbackSessionMigrateBegin, playbackSessionMigrateEnd, protocol, registerHIDDevice, remoteTextInput, requestGroupSession, sendButtonEvent, sendCommand, sendCommandWithPlaybackPosition, sendCommandWithPlaybackRate, sendCommandWithRepeatMode, sendCommandWithShuffleMode, sendCommandWithSkipInterval, sendCommandWithSleepTimer, sendHIDEvent, sendPackedVirtualTouchEvent, sendVirtualTouchEvent, setConnectionState, setConversationDetectionEnabled, setDiscoveryMode, setListeningMode, setReadyState, setVolume, setVolumeMuted, textInput, wakeDevice };
|
|
11
|
+
}
|
|
12
|
+
/** A ProtocolMessage without extension, with a random `identifier` that the data channel matches replies on. */
|
|
13
|
+
declare function protocol(type: ProtocolMessage_Type, errorCode?: ErrorCode_Enum): ProtocolMessage;
|
|
14
|
+
/** Subscribes to state changes. Send early in the session to receive now-playing, volume and artwork updates. */
|
|
15
|
+
declare function clientUpdatesConfig(artworkUpdates?: boolean, nowPlayingUpdates?: boolean, volumeUpdates?: boolean, keyboardUpdates?: boolean, outputDeviceUpdates?: boolean, systemEndpointUpdates?: boolean, subscribedPlayerPaths?: PlayerPath[]): [ProtocolMessage, DescExtension];
|
|
16
|
+
/** CONFIGURE_CONNECTION, which sets the group ID of this connection. */
|
|
17
|
+
declare function configureConnection(groupId: string): [ProtocolMessage, DescExtension];
|
|
18
|
+
/**
|
|
19
|
+
* DEVICE_INFO, the first message of a session, which introduces this controller to the receiver.
|
|
20
|
+
*
|
|
21
|
+
* @param pairingId - The pairing identifier from pair-verify.
|
|
22
|
+
*/
|
|
23
|
+
declare function deviceInfo(pairingId: Buffer, identity: ResolvedIdentity): [ProtocolMessage, DescExtension];
|
|
24
|
+
/**
|
|
25
|
+
* MODIFY_OUTPUT_CONTEXT_REQUEST, which changes the devices of a multiroom group.
|
|
26
|
+
*
|
|
27
|
+
* @param settingDevices - Replaces the whole output context.
|
|
28
|
+
*/
|
|
29
|
+
declare function modifyOutputContext(addingDevices?: string[], removingDevices?: string[], settingDevices?: string[]): [ProtocolMessage, DescExtension];
|
|
30
|
+
/** GET_STATE, which asks for the current playback state. */
|
|
31
|
+
declare function getState(): [ProtocolMessage, DescExtension];
|
|
32
|
+
/** GET_VOLUME, which asks for the volume of an output device. */
|
|
33
|
+
declare function getVolume(outputDeviceUID: string): [ProtocolMessage, DescExtension];
|
|
34
|
+
/** GET_VOLUME_MUTED, which asks whether an output device is muted. */
|
|
35
|
+
declare function getVolumeMuted(outputDeviceUID: string): [ProtocolMessage, DescExtension];
|
|
36
|
+
/** NOTIFICATION, which sends a named notification to the receiver. */
|
|
37
|
+
declare function notification(notification: string): [ProtocolMessage, DescExtension];
|
|
38
|
+
type PlaybackQueueAssetOptions = Pick<PlaybackQueueRequestMessage, "contentItemIdentifiers" | "playerPath" | "includeAvailableArtworkFormats" | "requestedAnimatedArtworkPreviewFrameFormats" | "requestedAnimatedArtworkAssetURLFormats">;
|
|
39
|
+
/**
|
|
40
|
+
* PLAYBACK_QUEUE_REQUEST, which asks for queue metadata and assets. Animated artwork formats
|
|
41
|
+
* have to be requested explicitly.
|
|
42
|
+
*
|
|
43
|
+
* @param location - Index of the first item.
|
|
44
|
+
* @param artworkWidth - In pixels.
|
|
45
|
+
* @param artworkHeight - In pixels; -1 keeps the aspect ratio.
|
|
46
|
+
*/
|
|
47
|
+
declare function playbackQueueRequest(location: number, length: number, artworkWidth?: number, artworkHeight?: number, options?: Partial<PlaybackQueueAssetOptions>): [ProtocolMessage, DescExtension];
|
|
48
|
+
/** GET_KEYBOARD_SESSION, which asks whether a text field is active; the answer is a KEYBOARD message. */
|
|
49
|
+
declare function getKeyboardSession(): [ProtocolMessage, DescExtension];
|
|
50
|
+
/** Requests an RTI session; the receiver supplies a RemoteTextInputMessage. */
|
|
51
|
+
declare function getRemoteTextInputSession(): [ProtocolMessage, DescExtension];
|
|
52
|
+
/**
|
|
53
|
+
* REMOTE_TEXT_INPUT, which carries one RTI text operation.
|
|
54
|
+
*
|
|
55
|
+
* @param data - The archived RTI operation.
|
|
56
|
+
* @param version - The version of the RTI session it edits.
|
|
57
|
+
*/
|
|
58
|
+
declare function remoteTextInput(data: Uint8Array, version?: bigint): [ProtocolMessage, DescExtension];
|
|
59
|
+
/**
|
|
60
|
+
* TEXT_INPUT, which sends text to the active keyboard session.
|
|
61
|
+
*
|
|
62
|
+
* @param actionType - For example done, search or send.
|
|
63
|
+
*/
|
|
64
|
+
declare function textInput(text: string, actionType: ActionType_Enum): [ProtocolMessage, DescExtension];
|
|
65
|
+
/**
|
|
66
|
+
* SEND_BUTTON_EVENT, a USB HID button press or release.
|
|
67
|
+
*
|
|
68
|
+
* @param usagePage - For example 0x01 for Generic Desktop, 0x0c for Consumer.
|
|
69
|
+
* @param buttonDown - `true` for key down, `false` for key up.
|
|
70
|
+
*/
|
|
71
|
+
declare function sendButtonEvent(usagePage: number, usage: number, buttonDown: boolean): [ProtocolMessage, DescExtension];
|
|
72
|
+
/** @param skipInterval - Seconds. */
|
|
73
|
+
declare function sendCommandWithSkipInterval(command: Command, skipInterval: number): [ProtocolMessage, DescExtension];
|
|
74
|
+
/** @param playbackPosition - Seconds from the start. */
|
|
75
|
+
declare function sendCommandWithPlaybackPosition(command: Command, playbackPosition: number): [ProtocolMessage, DescExtension];
|
|
76
|
+
/** @param playbackRate - 1 is normal speed, 2 is double speed. */
|
|
77
|
+
declare function sendCommandWithPlaybackRate(command: Command, playbackRate: number): [ProtocolMessage, DescExtension];
|
|
78
|
+
declare function sendCommandWithShuffleMode(command: Command, shuffleMode: ShuffleMode_Enum): [ProtocolMessage, DescExtension];
|
|
79
|
+
declare function sendCommandWithRepeatMode(command: Command, repeatMode: RepeatMode_Enum): [ProtocolMessage, DescExtension];
|
|
80
|
+
/** SEND_COMMAND, a playback command such as play, pause or next track. */
|
|
81
|
+
declare function sendCommand(command: Command, options?: CommandOptions): [ProtocolMessage, DescExtension];
|
|
82
|
+
/**
|
|
83
|
+
* A Pause command that carries a sleep timer.
|
|
84
|
+
*
|
|
85
|
+
* @param seconds - Timer duration; 0 cancels a running timer.
|
|
86
|
+
* @param stopMode - 0 stops playback, 1 pauses, 2 waits for the end of the track, 3 for the end of the queue.
|
|
87
|
+
*/
|
|
88
|
+
declare function sendCommandWithSleepTimer(seconds: number, stopMode?: number): [ProtocolMessage, DescExtension];
|
|
89
|
+
/**
|
|
90
|
+
* REGISTER_HID_DEVICE, which claims a virtual touch device. The Apple TV answers with a
|
|
91
|
+
* REGISTER_HID_DEVICE_RESULT that holds the device identifier {@link sendVirtualTouchEvent} has
|
|
92
|
+
* to carry; an unclaimed identifier makes it drop the session.
|
|
93
|
+
*
|
|
94
|
+
* @param absolute - Whether coordinates are absolute positions instead of relative movement.
|
|
95
|
+
* @param integratedDisplay - Whether the surface sits on top of a display, as on a phone.
|
|
96
|
+
*/
|
|
97
|
+
declare function registerHIDDevice(screenWidth?: number, screenHeight?: number, absolute?: boolean, integratedDisplay?: boolean): [ProtocolMessage, DescExtension];
|
|
98
|
+
/**
|
|
99
|
+
* SEND_PACKED_VIRTUAL_TOUCH_EVENT, the packed form of a touch event: the five values as 16-bit
|
|
100
|
+
* little endian integers in one byte array, in the order x, y, phase, device identifier, finger.
|
|
101
|
+
*
|
|
102
|
+
* @param phase - 1 began, 2 moved, 3 stationary, 4 ended, 5 cancelled.
|
|
103
|
+
* @param deviceId - The identifier {@link registerHIDDevice} handed out.
|
|
104
|
+
* @param finger - Finger index for multi-touch.
|
|
105
|
+
*/
|
|
106
|
+
declare function sendPackedVirtualTouchEvent(x: number, y: number, phase: number, deviceId: number, finger: number): [ProtocolMessage, DescExtension];
|
|
107
|
+
/**
|
|
108
|
+
* SEND_VIRTUAL_TOUCH_EVENT, a touch on the virtual touchpad of {@link registerHIDDevice}.
|
|
109
|
+
*
|
|
110
|
+
* @param phase - 1 began, 2 moved, 3 stationary, 4 ended, 5 cancelled.
|
|
111
|
+
* @param finger - Finger index for multi-touch.
|
|
112
|
+
* @param deviceId - The identifier {@link registerHIDDevice} handed out.
|
|
113
|
+
*/
|
|
114
|
+
declare function sendVirtualTouchEvent(x: number, y: number, phase: number, finger: number, deviceId?: number): [ProtocolMessage, DescExtension];
|
|
115
|
+
/**
|
|
116
|
+
* SEND_HID_EVENT, a raw USB HID event report for a navigation or media key.
|
|
117
|
+
*
|
|
118
|
+
* @param usePage - For example 0x01 for Generic Desktop, 0x0c for Consumer.
|
|
119
|
+
* @param down - `true` for key down, `false` for key up.
|
|
120
|
+
*/
|
|
121
|
+
declare function sendHIDEvent(usePage: number, usage: number, down: boolean): [ProtocolMessage, DescExtension];
|
|
122
|
+
/** SET_CONNECTION_STATE, which tells the receiver our connection state. */
|
|
123
|
+
declare function setConnectionState(state?: SetConnectionStateMessage_ConnectionState): [ProtocolMessage, DescExtension];
|
|
124
|
+
/** SET_READY_STATE, which tells the receiver this controller is ready. */
|
|
125
|
+
declare function setReadyState(): [ProtocolMessage, DescExtension];
|
|
126
|
+
/**
|
|
127
|
+
* SET_VOLUME, which sets the volume of an output device.
|
|
128
|
+
*
|
|
129
|
+
* @param volume - 0 to 1.
|
|
130
|
+
*/
|
|
131
|
+
declare function setVolume(outputDeviceUID: string, volume: number): [ProtocolMessage, DescExtension];
|
|
132
|
+
/** SET_VOLUME_MUTED, which mutes or unmutes an output device. */
|
|
133
|
+
declare function setVolumeMuted(outputDeviceUID: string, isMuted: boolean): [ProtocolMessage, DescExtension];
|
|
134
|
+
/** SET_CONVERSATION_DETECTION_ENABLED, which turns conversation detection of a HomePod on or off: it ducks the volume while people talk. */
|
|
135
|
+
declare function setConversationDetectionEnabled(enabled: boolean, outputDeviceUID: string): [ProtocolMessage, DescExtension];
|
|
136
|
+
/**
|
|
137
|
+
* ADJUST_VOLUME (extension field 97), a relative volume step that needs no current volume.
|
|
138
|
+
*
|
|
139
|
+
* @param adjustment - For example IncrementSmall or DecrementSmall.
|
|
140
|
+
*/
|
|
141
|
+
declare function adjustVolume(adjustment: AdjustVolumeMessage_Adjustment, outputDeviceUID: string): [ProtocolMessage, DescExtension];
|
|
142
|
+
/**
|
|
143
|
+
* AUDIO_FADE, which asks the receiver to fade its audio.
|
|
144
|
+
*
|
|
145
|
+
* @param fadeType - 0 fades out, 1 fades in.
|
|
146
|
+
* @param playerPath - Targets one player instead of the active one.
|
|
147
|
+
*/
|
|
148
|
+
declare function audioFade(fadeType: number, playerPath?: PlayerPath): [ProtocolMessage, DescExtension];
|
|
149
|
+
/**
|
|
150
|
+
* SET_LISTENING_MODE, which sets the listening mode of a HomePod.
|
|
151
|
+
*
|
|
152
|
+
* @param listeningMode - For example `Default`, `Vivid` or `LateNight`.
|
|
153
|
+
*/
|
|
154
|
+
declare function setListeningMode(listeningMode: string, outputDeviceUID: string): [ProtocolMessage, DescExtension];
|
|
155
|
+
/** SET_DISCOVERY_MODE, which turns device discovery on or off. */
|
|
156
|
+
declare function setDiscoveryMode(mode: number): [ProtocolMessage, DescExtension];
|
|
157
|
+
/** REQUEST_GROUP_SESSION, which starts a SharePlay group session. */
|
|
158
|
+
declare function requestGroupSession(): [ProtocolMessage, DescExtension];
|
|
159
|
+
/** PLAYBACK_SESSION_MIGRATE_BEGIN, which starts moving playback to another device. */
|
|
160
|
+
declare function playbackSessionMigrateBegin(playerPath?: PlayerPath): [ProtocolMessage, DescExtension];
|
|
161
|
+
/** PLAYBACK_SESSION_MIGRATE_END, which completes moving playback to another device. */
|
|
162
|
+
declare function playbackSessionMigrateEnd(playerPath?: PlayerPath): [ProtocolMessage, DescExtension];
|
|
163
|
+
/** WAKE_DEVICE, which wakes a sleeping Apple TV or HomePod. */
|
|
164
|
+
declare function wakeDevice(): [ProtocolMessage, DescExtension];
|
|
165
|
+
/** Reads a protobuf extension of a ProtocolMessage, typed by its descriptor. */
|
|
166
|
+
declare function getExtension<Desc extends DescExtension>(message: Extendee<Desc>, extension: Desc): ExtensionValueShape<Desc>;
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/mrp/player.d.ts
|
|
169
|
+
/** The player the receiver reports when no specific player is active. */
|
|
170
|
+
declare const DEFAULT_PLAYER_ID = "MediaRemote-DefaultPlayer";
|
|
171
|
+
/**
|
|
172
|
+
* One player of a now-playing app; an app can have several, such as picture-in-picture. Tracks
|
|
173
|
+
* the now-playing metadata and playback state, and extrapolates the elapsed time from the Cocoa
|
|
174
|
+
* timestamp and the playback rate.
|
|
175
|
+
*/
|
|
176
|
+
declare class Player {
|
|
177
|
+
#private;
|
|
178
|
+
/** The player identifier, such as a player path. */
|
|
179
|
+
get identifier(): string;
|
|
180
|
+
get displayName(): string;
|
|
181
|
+
/** Whether this is `MediaRemote-DefaultPlayer`, the player of an app without a specific one. */
|
|
182
|
+
get isDefaultPlayer(): boolean;
|
|
183
|
+
get nowPlayingInfo(): NowPlayingInfo | null;
|
|
184
|
+
get playbackQueue(): PlaybackQueue$1 | null;
|
|
185
|
+
get playbackState(): PlaybackState_Enum;
|
|
186
|
+
/** The timestamp of the last playback state update; an older update is ignored. */
|
|
187
|
+
get playbackStateTimestamp(): number;
|
|
188
|
+
get supportedCommands(): CommandInfo[];
|
|
189
|
+
get title(): string;
|
|
190
|
+
get artist(): string;
|
|
191
|
+
get album(): string;
|
|
192
|
+
get genre(): string;
|
|
193
|
+
get seriesName(): string;
|
|
194
|
+
/** The season number, or 0 when unknown. */
|
|
195
|
+
get seasonNumber(): number;
|
|
196
|
+
/** The episode number, or 0 when unknown. */
|
|
197
|
+
get episodeNumber(): number;
|
|
198
|
+
/** The episode title. Only the Apple TV app sends it, in its archived now-playing info. */
|
|
199
|
+
get episodeTitle(): string;
|
|
200
|
+
/** The localized content rating, such as `12+`. */
|
|
201
|
+
get contentRating(): string;
|
|
202
|
+
get mediaType(): ContentItemMetadata_MediaType;
|
|
203
|
+
/** The content identifier of the current item, such as a store ID. */
|
|
204
|
+
get contentIdentifier(): string;
|
|
205
|
+
/** The duration of the current item in seconds. */
|
|
206
|
+
get duration(): number;
|
|
207
|
+
/** The playback rate, where 1 is normal speed, 0 is paused and 2 is double speed. */
|
|
208
|
+
get playbackRate(): number;
|
|
209
|
+
get isPlaying(): boolean;
|
|
210
|
+
/** The shuffle mode, read from the info of the ChangeShuffleMode command. */
|
|
211
|
+
get shuffleMode(): ShuffleMode_Enum;
|
|
212
|
+
/** The repeat mode, read from the info of the ChangeRepeatMode command. */
|
|
213
|
+
get repeatMode(): RepeatMode_Enum;
|
|
214
|
+
/**
|
|
215
|
+
* The elapsed time in seconds, extrapolated from the newer timestamp of the now-playing info
|
|
216
|
+
* and the content item. Metadata after a track change can report rate 0 during playback, so the
|
|
217
|
+
* player's rate fills in. A paused player can still report rate 1, so its position stays put.
|
|
218
|
+
*/
|
|
219
|
+
get elapsedTime(): number;
|
|
220
|
+
/** The item at the queue location, or the first item when the location is out of range. */
|
|
221
|
+
get currentItem(): ContentItem | null;
|
|
222
|
+
get currentItemMetadata(): ContentItemMetadata | null;
|
|
223
|
+
/** An identifier that changes with the artwork, or null when the metadata shows no sign of artwork. */
|
|
224
|
+
get artworkId(): string | null;
|
|
225
|
+
/**
|
|
226
|
+
* The artwork URL of the current item, from the metadata `artworkURL`, the remote artworks or
|
|
227
|
+
* the artwork identifier as a URL template, in that order.
|
|
228
|
+
*
|
|
229
|
+
* @param width - In pixels; only a template uses it.
|
|
230
|
+
* @param height - In pixels; -1 keeps the aspect ratio.
|
|
231
|
+
*/
|
|
232
|
+
artworkUrl(width?: number, height?: number): string | null;
|
|
233
|
+
/** The image bytes embedded in the current item, or null. */
|
|
234
|
+
get currentItemArtwork(): Uint8Array | null;
|
|
235
|
+
/** The artwork URL at 600 pixels wide, or null. */
|
|
236
|
+
get currentItemArtworkUrl(): string | null;
|
|
237
|
+
get currentItemLyrics(): LyricsItem | null;
|
|
238
|
+
constructor(identifier: string, displayName: string);
|
|
239
|
+
findCommand(command: Command): CommandInfo | null;
|
|
240
|
+
/** Whether the command is in the list and not disabled. */
|
|
241
|
+
isCommandSupported(command: Command): boolean;
|
|
242
|
+
setNowPlayingInfo(nowPlayingInfo: NowPlayingInfo): void;
|
|
243
|
+
setPlaybackQueue(playbackQueue: PlaybackQueue$1): void;
|
|
244
|
+
/** Ignores an update with a timestamp older than the current one, so stale state never wins. */
|
|
245
|
+
setPlaybackState(playbackState: PlaybackState_Enum, playbackStateTimestamp: number): void;
|
|
246
|
+
setSupportedCommands(supportedCommands: CommandInfo[]): void;
|
|
247
|
+
/** Merges the fields an update carries into the queue item with the same identifier. */
|
|
248
|
+
updateContentItem(item: ContentItem): void;
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/mrp/client.d.ts
|
|
252
|
+
/**
|
|
253
|
+
* A now-playing app on the receiver, keyed by bundle identifier, with one or more players. The
|
|
254
|
+
* now-playing getters read from the active player.
|
|
255
|
+
*/
|
|
256
|
+
declare class Client {
|
|
257
|
+
#private;
|
|
258
|
+
/** The bundle identifier of the app, such as `com.apple.TVMusic`. */
|
|
259
|
+
get bundleIdentifier(): string;
|
|
260
|
+
get displayName(): string;
|
|
261
|
+
/** The players of this app, keyed by player identifier. */
|
|
262
|
+
get players(): Map<string, Player>;
|
|
263
|
+
/** The player set active, or the default player when none is set; null when that player does not exist. */
|
|
264
|
+
get activePlayer(): Player | null;
|
|
265
|
+
get nowPlayingInfo(): NowPlayingInfo | null;
|
|
266
|
+
get playbackQueue(): PlaybackQueue$1 | null;
|
|
267
|
+
get playbackState(): PlaybackState_Enum;
|
|
268
|
+
/** The timestamp of the last playback state update, or -1 without an active player. */
|
|
269
|
+
get playbackStateTimestamp(): number;
|
|
270
|
+
/** The commands of the active player, followed by the client defaults it does not list. */
|
|
271
|
+
get supportedCommands(): CommandInfo[];
|
|
272
|
+
get title(): string;
|
|
273
|
+
get artist(): string;
|
|
274
|
+
get album(): string;
|
|
275
|
+
get genre(): string;
|
|
276
|
+
get seriesName(): string;
|
|
277
|
+
get seasonNumber(): number;
|
|
278
|
+
get episodeNumber(): number;
|
|
279
|
+
get episodeTitle(): string;
|
|
280
|
+
get contentRating(): string;
|
|
281
|
+
get mediaType(): ContentItemMetadata_MediaType;
|
|
282
|
+
get contentIdentifier(): string;
|
|
283
|
+
/** The duration of the current item in seconds. */
|
|
284
|
+
get duration(): number;
|
|
285
|
+
/** The playback rate, where 1 is normal speed and 0 is paused. */
|
|
286
|
+
get playbackRate(): number;
|
|
287
|
+
get isPlaying(): boolean;
|
|
288
|
+
get shuffleMode(): ShuffleMode_Enum;
|
|
289
|
+
get repeatMode(): RepeatMode_Enum;
|
|
290
|
+
/** The elapsed time in seconds, extrapolated to now. */
|
|
291
|
+
get elapsedTime(): number;
|
|
292
|
+
/** An identifier that changes with the artwork, or null without artwork. */
|
|
293
|
+
get artworkId(): string | null;
|
|
294
|
+
/**
|
|
295
|
+
* The artwork URL of the current item; see {@link Player.artworkUrl}.
|
|
296
|
+
*
|
|
297
|
+
* @param width - In pixels.
|
|
298
|
+
* @param height - In pixels; -1 keeps the aspect ratio.
|
|
299
|
+
*/
|
|
300
|
+
artworkUrl(width?: number, height?: number): string | null;
|
|
301
|
+
get currentItem(): ContentItem | null;
|
|
302
|
+
get currentItemMetadata(): ContentItemMetadata | null;
|
|
303
|
+
/** The image bytes embedded in the current item, or null. */
|
|
304
|
+
get currentItemArtwork(): Uint8Array | null;
|
|
305
|
+
/** The artwork URL at 600 pixels wide, or null. */
|
|
306
|
+
get currentItemArtworkUrl(): string | null;
|
|
307
|
+
get currentItemLyrics(): LyricsItem | null;
|
|
308
|
+
constructor(bundleIdentifier: string, displayName: string);
|
|
309
|
+
/**
|
|
310
|
+
* Returns the player with this identifier, created when it does not exist yet.
|
|
311
|
+
*
|
|
312
|
+
* @param displayName - The name of a new player; the identifier when omitted.
|
|
313
|
+
*/
|
|
314
|
+
getOrCreatePlayer(identifier: string, displayName?: string): Player;
|
|
315
|
+
setActivePlayer(identifier: string): void;
|
|
316
|
+
/** Removes a player; removing the active one makes the default player active. */
|
|
317
|
+
removePlayer(identifier: string): void;
|
|
318
|
+
/** Sets the commands that complete the list of the active player. */
|
|
319
|
+
setDefaultSupportedCommands(supportedCommands: CommandInfo[]): void;
|
|
320
|
+
/** Finds a command in the list of the active player first, then in the defaults. */
|
|
321
|
+
findCommand(command: Command): CommandInfo | null;
|
|
322
|
+
/** Whether {@link findCommand} finds the command and it is not disabled. */
|
|
323
|
+
isCommandSupported(command: Command): boolean;
|
|
324
|
+
updateDisplayName(displayName: string): void;
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/mrp/state.d.ts
|
|
328
|
+
/**
|
|
329
|
+
* What the state derives from the messages, announced once the new values are in place. The
|
|
330
|
+
* messages themselves are the events of the data channel; the state does not repeat them.
|
|
331
|
+
*/
|
|
332
|
+
type MediaRemoteStateEventMap = {
|
|
333
|
+
readonly activePlayerChanged: [client: Client | null, player: Player | null];
|
|
334
|
+
readonly artworkChanged: [client: Client, player: Player];
|
|
335
|
+
readonly clients: [Record<string, Client>];
|
|
336
|
+
readonly clusterChanged: [clusterID: string | null, isLeader: boolean];
|
|
337
|
+
readonly keyboardChanged: [state: KeyboardState_Enum, attributes: TextEditingAttributes | null];
|
|
338
|
+
readonly lyricsEvent: [event: LyricsEvent, playerPath: PlayerPath | undefined];
|
|
339
|
+
readonly nowPlayingChanged: [client: Client | null, player: Player | null];
|
|
340
|
+
readonly outputDevicesChanged: [devices: AVOutputDeviceDescriptor[]];
|
|
341
|
+
readonly participantsChanged: [participants: PlaybackQueueParticipant[]];
|
|
342
|
+
readonly playbackQueueChanged: [client: Client, player: Player];
|
|
343
|
+
readonly playbackStateChanged: [client: Client, player: Player, oldState: PlaybackState_Enum, newState: PlaybackState_Enum];
|
|
344
|
+
readonly supportedCommandsChanged: [client: Client, player: Player, commands: CommandInfo[]];
|
|
345
|
+
readonly volumeChanged: [volume: number];
|
|
346
|
+
readonly volumeControlChanged: [available: boolean, capabilities: VolumeCapabilities_Enum];
|
|
347
|
+
readonly volumeMutedChanged: [muted: boolean];
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* The MRP state of a receiver as a model: clients and their players, what plays now, volume,
|
|
351
|
+
* keyboard, output devices and cluster. It derives everything from the messages it is given with
|
|
352
|
+
* {@link apply} and does no I/O, so recorded traffic feeds it as well as a live data channel.
|
|
353
|
+
*/
|
|
354
|
+
declare class MediaRemoteState extends EventEmitter<MediaRemoteStateEventMap> {
|
|
355
|
+
#private;
|
|
356
|
+
/** The now-playing apps, keyed by bundle identifier. */
|
|
357
|
+
get clients(): Record<string, Client>;
|
|
358
|
+
/** Whether a text input session is open on the receiver. */
|
|
359
|
+
get isKeyboardActive(): boolean;
|
|
360
|
+
get keyboardAttributes(): TextEditingAttributes | null;
|
|
361
|
+
get keyboardState(): KeyboardState_Enum;
|
|
362
|
+
/** The app that plays now, or null when the receiver named none. */
|
|
363
|
+
get nowPlayingClient(): Client | null;
|
|
364
|
+
/** The device that volume commands address; the cluster ID for a clustered HomePod pair. */
|
|
365
|
+
get outputDeviceUID(): string | null;
|
|
366
|
+
/** The devices in the current AirPlay group. */
|
|
367
|
+
get outputDevices(): AVOutputDeviceDescriptor[];
|
|
368
|
+
/** The identifier of the multiroom cluster, or null outside one. */
|
|
369
|
+
get clusterID(): string | null;
|
|
370
|
+
/** The cluster type code, 0 outside a cluster. */
|
|
371
|
+
get clusterType(): number;
|
|
372
|
+
get isClusterAware(): boolean;
|
|
373
|
+
get isClusterLeader(): boolean;
|
|
374
|
+
/** The playback queue participants, such as SharePlay users. */
|
|
375
|
+
get participants(): PlaybackQueueParticipant[];
|
|
376
|
+
/** The JPEG bytes of the last SET_ARTWORK, or null before one arrived. */
|
|
377
|
+
get artworkJpegData(): Uint8Array | null;
|
|
378
|
+
/** The volume, from 0 to 1. */
|
|
379
|
+
get volume(): number;
|
|
380
|
+
get volumeAvailable(): boolean;
|
|
381
|
+
get volumeCapabilities(): VolumeCapabilities_Enum;
|
|
382
|
+
get volumeMuted(): boolean;
|
|
383
|
+
constructor();
|
|
384
|
+
/**
|
|
385
|
+
* Applies one decoded message. Messages the state does not track are ignored.
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* const decoded = decodeMessage(protocolMessage);
|
|
389
|
+
* decoded && state.apply(...decoded);
|
|
390
|
+
*/
|
|
391
|
+
apply(...[name, message]: MrpMessage): void;
|
|
392
|
+
/**
|
|
393
|
+
* Resets every value to its initial one. A state that outlives a session is cleared when the
|
|
394
|
+
* next one connects, not when the last one ends.
|
|
395
|
+
*/
|
|
396
|
+
clear(): void;
|
|
397
|
+
}
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/mrp/playbackQueue.d.ts
|
|
400
|
+
/**
|
|
401
|
+
* Requests for the playback queue. The receiver answers with a SET_STATE carrying the queue, so
|
|
402
|
+
* the result lands in the state; these only wait for the reply.
|
|
403
|
+
*/
|
|
404
|
+
declare class PlaybackQueue {
|
|
405
|
+
#private;
|
|
406
|
+
constructor(channel: DataChannel, state: MediaRemoteState);
|
|
407
|
+
/** Requests the first `length` items of the queue. */
|
|
408
|
+
request(length: number, artworkWidth?: number, artworkHeight?: number): Promise<void>;
|
|
409
|
+
/**
|
|
410
|
+
* Requests extra assets of the current item, such as artwork formats or lyrics, and returns
|
|
411
|
+
* the item once they arrived.
|
|
412
|
+
*
|
|
413
|
+
* @returns Null without a current item, or when the track changed while waiting.
|
|
414
|
+
* @throws {Error} When the receiver answers with an error code.
|
|
415
|
+
*/
|
|
416
|
+
requestAssets(options?: Partial<PlaybackQueueAssetOptions>, width?: number, height?: number): Promise<ContentItem | null>;
|
|
417
|
+
}
|
|
418
|
+
//#endregion
|
|
419
|
+
//#region src/mrp/artwork.d.ts
|
|
420
|
+
type AnimatedArtworkResult = {
|
|
421
|
+
readonly format: string;
|
|
422
|
+
readonly url: string | null;
|
|
423
|
+
readonly source?: "device" | "apple-music";
|
|
424
|
+
};
|
|
425
|
+
/** Artwork of the current item, as a URL or as image bytes; at least one of the two is set. */
|
|
426
|
+
type ArtworkResult = {
|
|
427
|
+
readonly url: string | null;
|
|
428
|
+
readonly data: Uint8Array | null; /** For example `image/jpeg` or `image/png`. */
|
|
429
|
+
readonly mimeType: string; /** The artwork identifier of the item, for change detection. */
|
|
430
|
+
readonly identifier: string | null; /** In pixels; 0 when unknown. */
|
|
431
|
+
readonly width: number; /** In pixels; 0 when unknown. */
|
|
432
|
+
readonly height: number;
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* The artwork of what plays now, from the sources MRP offers, in this order: a URL from the item
|
|
436
|
+
* metadata, image bytes inside the queue, the JPEG of the last SET_ARTWORK, and finally a queue
|
|
437
|
+
* request when the metadata promises artwork that has not arrived. A result is cached per
|
|
438
|
+
* artwork identifier.
|
|
439
|
+
*/
|
|
440
|
+
declare class Artwork {
|
|
441
|
+
#private;
|
|
442
|
+
constructor(state: MediaRemoteState, queue: PlaybackQueue);
|
|
443
|
+
/**
|
|
444
|
+
* Returns the artwork of the current item.
|
|
445
|
+
*
|
|
446
|
+
* @param width - In pixels.
|
|
447
|
+
* @param height - In pixels; -1 keeps the aspect ratio.
|
|
448
|
+
* @returns Null when there is no artwork.
|
|
449
|
+
*/
|
|
450
|
+
get(width?: number, height?: number): Promise<ArtworkResult | null>;
|
|
451
|
+
/** Asks for the available animated formats first, then for the asset URLs of those formats. */
|
|
452
|
+
getAnimated(width?: number, height?: number): Promise<AnimatedArtworkResult[]>;
|
|
453
|
+
/** Forgets the cached result, so the next {@link get} looks again. */
|
|
454
|
+
clear(): void;
|
|
455
|
+
}
|
|
456
|
+
//#endregion
|
|
457
|
+
//#region src/mrp/commands.d.ts
|
|
458
|
+
/** The receiver refused a SendCommand. */
|
|
459
|
+
declare class SendCommandError extends CommandError {
|
|
460
|
+
readonly sendError: SendError_Enum;
|
|
461
|
+
readonly handlerReturnStatus: HandlerReturnStatus_Enum;
|
|
462
|
+
constructor(sendError: SendError_Enum, handlerReturnStatus: HandlerReturnStatus_Enum);
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Playback commands to the now-playing app, each a SEND_COMMAND exchange. A result with a send
|
|
466
|
+
* error throws {@link SendCommandError}; a reply without a result counts as success.
|
|
467
|
+
*/
|
|
468
|
+
declare class Commands {
|
|
469
|
+
#private;
|
|
470
|
+
constructor(channel: DataChannel);
|
|
471
|
+
/** @throws {SendCommandError} When the receiver reports a send error. */
|
|
472
|
+
send(command: Command, options?: CommandOptions): Promise<SendCommandResultMessage | undefined>;
|
|
473
|
+
play(): Promise<void>;
|
|
474
|
+
pause(): Promise<void>;
|
|
475
|
+
togglePlayPause(): Promise<void>;
|
|
476
|
+
stop(): Promise<void>;
|
|
477
|
+
nextTrack(): Promise<void>;
|
|
478
|
+
previousTrack(): Promise<void>;
|
|
479
|
+
/** @param interval - Seconds. */
|
|
480
|
+
skipForward(interval?: number): Promise<void>;
|
|
481
|
+
/** @param interval - Seconds. */
|
|
482
|
+
skipBackward(interval?: number): Promise<void>;
|
|
483
|
+
/** @param position - Seconds from the start. */
|
|
484
|
+
seekToPosition(position: number): Promise<void>;
|
|
485
|
+
setShuffleMode(mode: ShuffleMode_Enum): Promise<void>;
|
|
486
|
+
setRepeatMode(mode: RepeatMode_Enum): Promise<void>;
|
|
487
|
+
/** @param rate - 1 is normal speed. */
|
|
488
|
+
changePlaybackRate(rate: number): Promise<void>;
|
|
489
|
+
advanceShuffleMode(): Promise<void>;
|
|
490
|
+
advanceRepeatMode(): Promise<void>;
|
|
491
|
+
beginFastForward(): Promise<void>;
|
|
492
|
+
endFastForward(): Promise<void>;
|
|
493
|
+
beginRewind(): Promise<void>;
|
|
494
|
+
endRewind(): Promise<void>;
|
|
495
|
+
nextChapter(): Promise<void>;
|
|
496
|
+
previousChapter(): Promise<void>;
|
|
497
|
+
likeTrack(): Promise<void>;
|
|
498
|
+
dislikeTrack(): Promise<void>;
|
|
499
|
+
bookmarkTrack(): Promise<void>;
|
|
500
|
+
addNowPlayingItemToLibrary(): Promise<void>;
|
|
501
|
+
/**
|
|
502
|
+
* Sets a sleep timer. It goes out as an option on a Pause command.
|
|
503
|
+
*
|
|
504
|
+
* @param seconds - Timer duration; 0 cancels a running timer.
|
|
505
|
+
* @param stopMode - 0 stops playback, 1 pauses, 2 waits for the end of the track, 3 for the end of the queue.
|
|
506
|
+
*/
|
|
507
|
+
setSleepTimer(seconds: number, stopMode?: number): Promise<void>;
|
|
508
|
+
}
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/mrp/hid.d.ts
|
|
511
|
+
/**
|
|
512
|
+
* Keys as USB HID events: Generic Desktop (0x01) for navigation, Consumer (0x0c) for media.
|
|
513
|
+
*
|
|
514
|
+
* Every event goes out with `send()`: the receiver never replies to a HID event, so waiting for one
|
|
515
|
+
* would time out on key-down and key-up would never be sent. Touch is not here: tvOS drops the
|
|
516
|
+
* session on a virtual touch event over MRP.
|
|
517
|
+
*/
|
|
518
|
+
declare class Hid {
|
|
519
|
+
#private;
|
|
520
|
+
constructor(channel: DataChannel, state: MediaRemoteState);
|
|
521
|
+
up(): Promise<void>;
|
|
522
|
+
down(): Promise<void>;
|
|
523
|
+
left(): Promise<void>;
|
|
524
|
+
right(): Promise<void>;
|
|
525
|
+
menu(): Promise<void>;
|
|
526
|
+
select(): Promise<void>;
|
|
527
|
+
home(): Promise<void>;
|
|
528
|
+
suspend(): Promise<void>;
|
|
529
|
+
wake(): Promise<void>;
|
|
530
|
+
play(): Promise<void>;
|
|
531
|
+
pause(): Promise<void>;
|
|
532
|
+
/** Pause when the now-playing client plays, play otherwise. */
|
|
533
|
+
playPause(): Promise<void>;
|
|
534
|
+
stop(): Promise<void>;
|
|
535
|
+
next(): Promise<void>;
|
|
536
|
+
previous(): Promise<void>;
|
|
537
|
+
volumeUp(): Promise<void>;
|
|
538
|
+
volumeDown(): Promise<void>;
|
|
539
|
+
mute(): Promise<void>;
|
|
540
|
+
topMenu(): Promise<void>;
|
|
541
|
+
channelUp(): Promise<void>;
|
|
542
|
+
channelDown(): Promise<void>;
|
|
543
|
+
/** Two presses 150 ms apart. */
|
|
544
|
+
doublePress(usePage: number, usage: number): Promise<void>;
|
|
545
|
+
/**
|
|
546
|
+
* Holds a key down.
|
|
547
|
+
*
|
|
548
|
+
* @param duration - Hold time in milliseconds.
|
|
549
|
+
*/
|
|
550
|
+
longPress(usePage: number, usage: number, duration?: number): Promise<void>;
|
|
551
|
+
/** Key-down, 25 ms, key-up. */
|
|
552
|
+
press(usePage: number, usage: number): Promise<void>;
|
|
553
|
+
}
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/mrp/keyboard.d.ts
|
|
556
|
+
/**
|
|
557
|
+
* Text input over MRP. Every operation asks the receiver for its current RTI text session first,
|
|
558
|
+
* then sends the edit for that session. Operations run one at a time, in call order.
|
|
559
|
+
*/
|
|
560
|
+
declare class Keyboard {
|
|
561
|
+
#private;
|
|
562
|
+
constructor(channel: DataChannel);
|
|
563
|
+
/** Replaces the text in the focused field. */
|
|
564
|
+
set(text: string): Promise<void>;
|
|
565
|
+
append(text: string): Promise<void>;
|
|
566
|
+
clear(): Promise<void>;
|
|
567
|
+
/** Asks for the keyboard session; the answer arrives as a KEYBOARD message on the state. */
|
|
568
|
+
getSession(): Promise<void>;
|
|
569
|
+
}
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/mrp/outputDevices.d.ts
|
|
572
|
+
/** The output context of the receiver: which devices play along, and per-device audio settings. */
|
|
573
|
+
declare class OutputDevices {
|
|
574
|
+
#private;
|
|
575
|
+
constructor(channel: DataChannel, state: MediaRemoteState);
|
|
576
|
+
/** Adds devices to the output context. */
|
|
577
|
+
add(deviceUIDs: string[]): Promise<void>;
|
|
578
|
+
/** Removes devices from the output context. */
|
|
579
|
+
remove(deviceUIDs: string[]): Promise<void>;
|
|
580
|
+
/** Replaces the output context with these devices. */
|
|
581
|
+
set(deviceUIDs: string[]): Promise<void>;
|
|
582
|
+
/**
|
|
583
|
+
* Turns conversation detection of the active output device on or off (HomePod).
|
|
584
|
+
*
|
|
585
|
+
* @throws {Error} When no output device is active.
|
|
586
|
+
*/
|
|
587
|
+
setConversationDetectionEnabled(enabled: boolean): Promise<void>;
|
|
588
|
+
/** Sets the listening mode of the active output device (HomePod), e.g. `Default`, `Vivid`, `LateNight`. Does nothing without one. */
|
|
589
|
+
setListeningMode(mode: string): Promise<void>;
|
|
590
|
+
}
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/mrp/volume.d.ts
|
|
593
|
+
/**
|
|
594
|
+
* Volume of the receiver on a 0 to 1 scale. Absolute volume goes to the output device the state
|
|
595
|
+
* names; a receiver that only supports relative volume gets the HID volume keys instead.
|
|
596
|
+
*/
|
|
597
|
+
declare class Volume {
|
|
598
|
+
#private;
|
|
599
|
+
constructor(channel: DataChannel, context: Context, state: MediaRemoteState, hid: Hid);
|
|
600
|
+
/** @throws {CommandError} When the receiver has no volume control. */
|
|
601
|
+
down(): Promise<void>;
|
|
602
|
+
/** @throws {CommandError} When the receiver has no volume control. */
|
|
603
|
+
up(): Promise<void>;
|
|
604
|
+
/** @throws {CommandError} When no output device is active or the receiver answers otherwise. */
|
|
605
|
+
get(): Promise<number>;
|
|
606
|
+
/**
|
|
607
|
+
* Sets an absolute volume, clamped to 0 to 1.
|
|
608
|
+
*
|
|
609
|
+
* @throws {CommandError} When no output device is active or absolute volume is not available.
|
|
610
|
+
*/
|
|
611
|
+
set(volume: number): Promise<void>;
|
|
612
|
+
/** @throws {CommandError} When no output device is active. */
|
|
613
|
+
mute(): Promise<void>;
|
|
614
|
+
/** @throws {CommandError} When no output device is active. */
|
|
615
|
+
unmute(): Promise<void>;
|
|
616
|
+
/** @throws {CommandError} When no output device is active. */
|
|
617
|
+
toggleMute(): Promise<void>;
|
|
618
|
+
/** Sets the volume of one output device in a group, clamped to 0 to 1. */
|
|
619
|
+
setForDevice(outputDeviceUID: string, volume: number): Promise<void>;
|
|
620
|
+
/** @throws {CommandError} When the receiver answers otherwise. */
|
|
621
|
+
getForDevice(outputDeviceUID: string): Promise<number>;
|
|
622
|
+
muteDevice(outputDeviceUID: string): Promise<void>;
|
|
623
|
+
unmuteDevice(outputDeviceUID: string): Promise<void>;
|
|
624
|
+
/**
|
|
625
|
+
* Steps the volume of an output device up or down by a small, medium or large amount.
|
|
626
|
+
*
|
|
627
|
+
* @param outputDeviceUID - The active output device when omitted.
|
|
628
|
+
* @throws {CommandError} When no output device is given or active.
|
|
629
|
+
*/
|
|
630
|
+
adjust(adjustment: AdjustVolumeMessage_Adjustment, outputDeviceUID?: string): Promise<void>;
|
|
631
|
+
/** Asks the receiver to fade its audio: 0 fades out, 1 fades in. */
|
|
632
|
+
audioFade(fadeType: number): Promise<void>;
|
|
633
|
+
/**
|
|
634
|
+
* Fades to a volume in steps of {@link FADE_STEP_INTERVAL} ms; the last step sets the target exactly.
|
|
635
|
+
*
|
|
636
|
+
* @param durationMs - Duration of the fade in milliseconds.
|
|
637
|
+
* @throws {CommandError} When no output device is active or absolute volume is not available.
|
|
638
|
+
*/
|
|
639
|
+
fade(targetVolume: number, durationMs: number): Promise<void>;
|
|
640
|
+
}
|
|
641
|
+
//#endregion
|
|
642
|
+
//#region src/mrp/mediaRemote.d.ts
|
|
643
|
+
type MediaRemoteOptions = {
|
|
644
|
+
/**
|
|
645
|
+
* The state to feed; a new one when omitted. Pass one to keep its listeners across sessions.
|
|
646
|
+
* It is fed as it is: clear it yourself when a new session should start empty.
|
|
647
|
+
*/
|
|
648
|
+
readonly state?: MediaRemoteState;
|
|
649
|
+
};
|
|
650
|
+
/**
|
|
651
|
+
* Remote control of a receiver over MRP, on the data channel of an AirPlay session. It owns the
|
|
652
|
+
* state the messages feed and the parts that send: keys, commands, volume, text input, output
|
|
653
|
+
* devices, the playback queue and artwork. It lives as long as its session.
|
|
654
|
+
*/
|
|
655
|
+
declare class MediaRemote {
|
|
656
|
+
#private;
|
|
657
|
+
/** The MRP data channel this remote sends on. */
|
|
658
|
+
get channel(): DataChannel;
|
|
659
|
+
readonly artwork: Artwork;
|
|
660
|
+
readonly commands: Commands;
|
|
661
|
+
readonly hid: Hid;
|
|
662
|
+
readonly keyboard: Keyboard;
|
|
663
|
+
readonly outputDevices: OutputDevices;
|
|
664
|
+
readonly playbackQueue: PlaybackQueue;
|
|
665
|
+
readonly state: MediaRemoteState;
|
|
666
|
+
readonly volume: Volume;
|
|
667
|
+
/**
|
|
668
|
+
* Opens remote control on the session and runs the MRP startup: DEVICE_INFO as an exchange,
|
|
669
|
+
* then the connection state, the update subscription and GET_STATE, each sent without waiting.
|
|
670
|
+
* The state listens from before the data channel connects, so it misses nothing the receiver
|
|
671
|
+
* sends right away. A failed startup ends the session.
|
|
672
|
+
*
|
|
673
|
+
* @throws {SetupError} When a SETUP fails.
|
|
674
|
+
* @throws {TimeoutError} When DEVICE_INFO gets no reply.
|
|
675
|
+
* @throws {ConnectionClosedError} When the session ends during setup.
|
|
676
|
+
*/
|
|
677
|
+
static open(session: AirPlaySession, options?: MediaRemoteOptions): Promise<MediaRemote>;
|
|
678
|
+
/** Use {@link open}. */
|
|
679
|
+
constructor(session: AirPlaySession, channel: DataChannel, state: MediaRemoteState);
|
|
680
|
+
/** Wakes the receiver from sleep with a WAKE_DEVICE message. */
|
|
681
|
+
wake(): Promise<void>;
|
|
682
|
+
}
|
|
683
|
+
//#endregion
|
|
684
|
+
//#region src/mrp/describe.d.ts
|
|
685
|
+
declare function describeProtocolMessage(message: ProtocolMessage): Record<string, unknown>;
|
|
686
|
+
//#endregion
|
|
687
|
+
export { type AnimatedArtworkResult, Artwork, type ArtworkResult, Client, Commands, DEFAULT_PLAYER_ID, Hid, Keyboard, MediaRemote, type MediaRemoteOptions, MediaRemoteState, type MediaRemoteStateEventMap, messages_d_exports as Messages, type MrpMessage, type MrpMessageMap, type MrpMessageName, OutputDevices, PlaybackQueue, Player, index_d_exports as Proto, SendCommandError, Volume, decodeMessage, describeProtocolMessage, parseMessages };
|