@basmilius/apple-airplay 0.0.84 → 0.0.86

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.
@@ -4,6 +4,7 @@ export declare function protocol(type: Proto.ProtocolMessage_Type, errorCode?: P
4
4
  export declare function clientUpdatesConfig(artworkUpdates?: boolean, nowPlayingUpdates?: boolean, volumeUpdates?: boolean, keyboardUpdates?: boolean, outputDeviceUpdates?: boolean): Proto.ProtocolMessage;
5
5
  export declare function configureConnection(groupId: string): Proto.ProtocolMessage;
6
6
  export declare function deviceInfo(pairingId: Buffer): Proto.ProtocolMessage;
7
+ export declare function getState(): Proto.ProtocolMessage;
7
8
  export declare function getVolume(outputDeviceUID: string): Proto.ProtocolMessage;
8
9
  export declare function playbackQueueRequest(location: number, length: number, includeMetadata?: boolean, includeLanguageOptions?: boolean): Proto.ProtocolMessage;
9
10
  export declare function sendButtonEvent(usagePage: number, usage: number, buttonDown: boolean): Proto.ProtocolMessage;
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ __export(exports_dataStreamMessages, {
21
21
  protocol: () => protocol,
22
22
  playbackQueueRequest: () => playbackQueueRequest,
23
23
  getVolume: () => getVolume,
24
+ getState: () => getState,
24
25
  getExtension: () => getExtension,
25
26
  deviceInfo: () => deviceInfo,
26
27
  configureConnection: () => configureConnection,
@@ -1427,6 +1428,9 @@ function deviceInfo(pairingId) {
1427
1428
  setExtension(protocolMessage, deviceInfoMessage, message);
1428
1429
  return protocolMessage;
1429
1430
  }
1431
+ function getState() {
1432
+ return protocol(3 /* GET_STATE_MESSAGE */);
1433
+ }
1430
1434
  function getVolume(outputDeviceUID) {
1431
1435
  const protocolMessage = protocol(49 /* GET_VOLUME_MESSAGE */);
1432
1436
  const message = create(GetVolumeMessageSchema, {
@@ -2419,7 +2423,7 @@ class AirPlay {
2419
2423
  async feedback() {
2420
2424
  await this.#rtsp.post("/feedback", undefined, undefined, 1900);
2421
2425
  }
2422
- async setupDataStream(sharedSecret) {
2426
+ async setupDataStream(sharedSecret, onBeforeConnect) {
2423
2427
  const seed = randomInt64();
2424
2428
  const request = Plist3.serialize({
2425
2429
  streams: [
@@ -2442,6 +2446,7 @@ class AirPlay {
2442
2446
  reporter4.net(`Connecting to data stream on port ${dataPort}...`);
2443
2447
  this.#dataStream = new AirPlayDataStream(this.#rtsp.address, dataPort);
2444
2448
  await this.#dataStream.setup(sharedSecret, seed);
2449
+ await onBeforeConnect?.();
2445
2450
  await this.#dataStream.connect();
2446
2451
  }
2447
2452
  async setupEventStream(pairingId, sharedSecret) {
@@ -17,7 +17,7 @@ export default class AirPlay {
17
17
  connect(): Promise<void>;
18
18
  disconnect(): Promise<void>;
19
19
  feedback(): Promise<void>;
20
- setupDataStream(sharedSecret: Buffer): Promise<void>;
20
+ setupDataStream(sharedSecret: Buffer, onBeforeConnect?: () => Promise<void>): Promise<void>;
21
21
  setupEventStream(pairingId: Buffer, sharedSecret: Buffer): Promise<void>;
22
22
  setupTimingServer(timing: TimingServer): Promise<void>;
23
23
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@basmilius/apple-airplay",
3
3
  "description": "Implementation of Apple's AirPlay2 in Node.js.",
4
- "version": "0.0.84",
4
+ "version": "0.0.86",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -41,8 +41,8 @@
41
41
  }
42
42
  },
43
43
  "dependencies": {
44
- "@basmilius/apple-common": "0.0.84",
45
- "@basmilius/apple-encoding": "0.0.84",
44
+ "@basmilius/apple-common": "0.0.86",
45
+ "@basmilius/apple-encoding": "0.0.86",
46
46
  "@bufbuild/protobuf": "^2.10.2"
47
47
  },
48
48
  "devDependencies": {