@basmilius/apple-devices 0.0.102 → 0.0.104

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 +19 -12
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1192,6 +1192,9 @@ class Client {
1192
1192
  this.#playbackQueue = playbackQueue;
1193
1193
  }
1194
1194
  setPlaybackState(playbackState, playbackStateTimestamp) {
1195
+ if (playbackStateTimestamp < this.#playbackStateTimestamp) {
1196
+ return;
1197
+ }
1195
1198
  this.#playbackState = playbackState;
1196
1199
  this.#playbackStateTimestamp = playbackStateTimestamp;
1197
1200
  }
@@ -1591,18 +1594,20 @@ class device_default extends EventEmitter2 {
1591
1594
  }
1592
1595
  }
1593
1596
  async#onClose() {
1594
- await this.disconnectSafely();
1595
- this.emit("disconnected", false);
1597
+ reporter2.net("#onClose() called on airplay device.");
1598
+ if (!this.#disconnect) {
1599
+ await this.disconnectSafely();
1600
+ this.emit("disconnected", true);
1601
+ } else {
1602
+ this.emit("disconnected", false);
1603
+ }
1596
1604
  }
1597
1605
  async#onError(err) {
1598
1606
  reporter2.error("AirPlay error", err);
1599
- await this.disconnectSafely();
1600
- this.emit("disconnected", true);
1601
1607
  }
1602
1608
  async#onTimeout() {
1603
1609
  reporter2.error("AirPlay timeout");
1604
- await this.disconnectSafely();
1605
- this.emit("disconnected", true);
1610
+ await this.#protocol.rtsp.destroy();
1606
1611
  }
1607
1612
  async#setup() {
1608
1613
  const keys = this.#keys;
@@ -1746,18 +1751,20 @@ class device_default2 extends EventEmitter3 {
1746
1751
  }
1747
1752
  }
1748
1753
  async#onClose() {
1749
- await this.disconnectSafely();
1750
- this.emit("disconnected", false);
1754
+ reporter3.net("#onClose() called on companion link device.");
1755
+ if (!this.#disconnect) {
1756
+ await this.disconnectSafely();
1757
+ this.emit("disconnected", true);
1758
+ } else {
1759
+ this.emit("disconnected", false);
1760
+ }
1751
1761
  }
1752
1762
  async#onError(err) {
1753
1763
  reporter3.error("Companion Link error", err);
1754
- await this.disconnectSafely();
1755
- this.emit("disconnected", true);
1756
1764
  }
1757
1765
  async#onTimeout() {
1758
1766
  reporter3.error("Companion Link timeout");
1759
- await this.disconnectSafely();
1760
- this.emit("disconnected", true);
1767
+ await this.#protocol.socket.destroy();
1761
1768
  }
1762
1769
  async#setup() {
1763
1770
  const keys = this.#keys;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@basmilius/apple-devices",
3
3
  "description": "Exposes various Apple devices to connect with either AirPlay or Companion Link.",
4
- "version": "0.0.102",
4
+ "version": "0.0.104",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -43,10 +43,10 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@basmilius/apple-airplay": "0.0.102",
47
- "@basmilius/apple-common": "0.0.102",
48
- "@basmilius/apple-companion-link": "0.0.102",
49
- "@basmilius/apple-encoding": "0.0.102"
46
+ "@basmilius/apple-airplay": "0.0.104",
47
+ "@basmilius/apple-common": "0.0.104",
48
+ "@basmilius/apple-companion-link": "0.0.104",
49
+ "@basmilius/apple-encoding": "0.0.104"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@basmilius/tools": "^2.23.0",