@basmilius/apple-airplay 0.0.93 → 0.0.95

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -12
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1866,7 +1866,7 @@ class AirPlayDataStream extends AirPlayStream {
1866
1866
  }
1867
1867
  }
1868
1868
  } catch (err) {
1869
- reporter.error("Error in data stream onData()", err);
1869
+ reporter.error("Error in data stream #onData()", err);
1870
1870
  this.emit("error", err);
1871
1871
  }
1872
1872
  }
@@ -2142,17 +2142,22 @@ class AirPlayEventStream extends AirPlayStream {
2142
2142
  }
2143
2143
  }
2144
2144
  async#onData(buffer) {
2145
- this.#buffer = Buffer.concat([this.#buffer, buffer]);
2146
- if (this.isEncrypted) {
2147
- this.#buffer = await this.decrypt(this.#buffer);
2148
- }
2149
- while (this.#buffer.byteLength > 0) {
2150
- const result = makeHttpRequest(this.#buffer);
2151
- if (result === null) {
2152
- return;
2145
+ try {
2146
+ this.#buffer = Buffer.concat([this.#buffer, buffer]);
2147
+ if (this.isEncrypted) {
2148
+ this.#buffer = await this.decrypt(this.#buffer);
2153
2149
  }
2154
- this.#buffer = this.#buffer.subarray(result.requestLength);
2155
- await this.#handle(result.method, result.path, result.headers, result.body);
2150
+ while (this.#buffer.byteLength > 0) {
2151
+ const result = makeHttpRequest(this.#buffer);
2152
+ if (result === null) {
2153
+ return;
2154
+ }
2155
+ this.#buffer = this.#buffer.subarray(result.requestLength);
2156
+ await this.#handle(result.method, result.path, result.headers, result.body);
2157
+ }
2158
+ } catch (err) {
2159
+ reporter2.error("Error in event stream #onData()", err);
2160
+ this.emit("error", err);
2156
2161
  }
2157
2162
  }
2158
2163
  }
@@ -2197,7 +2202,7 @@ class AirPlayPairing {
2197
2202
  "X-Apple-HKP": this.#hkp.toString()
2198
2203
  });
2199
2204
  if (response.status !== 200) {
2200
- throw new Error("Cannot start pairing session.");
2205
+ throw new Error(`Cannot start pairing session. ${response.status} ${response.statusText} ${await response.text()}`);
2201
2206
  }
2202
2207
  }
2203
2208
  async#request(_, data) {
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.93",
4
+ "version": "0.0.95",
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.93",
45
- "@basmilius/apple-encoding": "0.0.93",
44
+ "@basmilius/apple-common": "0.0.95",
45
+ "@basmilius/apple-encoding": "0.0.95",
46
46
  "@bufbuild/protobuf": "^2.10.2"
47
47
  },
48
48
  "devDependencies": {