@basmilius/apple-devices 0.0.101 → 0.0.103

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 +14 -16
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1591,21 +1591,20 @@ class device_default extends EventEmitter2 {
1591
1591
  }
1592
1592
  }
1593
1593
  async#onClose() {
1594
- if (this.#disconnect) {
1595
- return;
1594
+ reporter2.net("#onClose() called on airplay device.");
1595
+ if (!this.#disconnect) {
1596
+ await this.disconnectSafely();
1597
+ this.emit("disconnected", true);
1598
+ } else {
1599
+ this.emit("disconnected", false);
1596
1600
  }
1597
- clearInterval(this.#feedbackInterval);
1598
- this.emit("disconnected", false);
1599
1601
  }
1600
1602
  async#onError(err) {
1601
1603
  reporter2.error("AirPlay error", err);
1602
- await this.disconnectSafely();
1603
- this.emit("disconnected", true);
1604
1604
  }
1605
1605
  async#onTimeout() {
1606
1606
  reporter2.error("AirPlay timeout");
1607
- await this.disconnectSafely();
1608
- this.emit("disconnected", true);
1607
+ await this.#protocol.rtsp.destroy();
1609
1608
  }
1610
1609
  async#setup() {
1611
1610
  const keys = this.#keys;
@@ -1749,21 +1748,20 @@ class device_default2 extends EventEmitter3 {
1749
1748
  }
1750
1749
  }
1751
1750
  async#onClose() {
1752
- if (this.#disconnect) {
1753
- return;
1751
+ reporter3.net("#onClose() called on companion link device.");
1752
+ if (!this.#disconnect) {
1753
+ await this.disconnectSafely();
1754
+ this.emit("disconnected", true);
1755
+ } else {
1756
+ this.emit("disconnected", false);
1754
1757
  }
1755
- clearInterval(this.#heartbeatInterval);
1756
- this.emit("disconnected", false);
1757
1758
  }
1758
1759
  async#onError(err) {
1759
1760
  reporter3.error("Companion Link error", err);
1760
- await this.disconnectSafely();
1761
- this.emit("disconnected", true);
1762
1761
  }
1763
1762
  async#onTimeout() {
1764
1763
  reporter3.error("Companion Link timeout");
1765
- await this.disconnectSafely();
1766
- this.emit("disconnected", true);
1764
+ await this.#protocol.socket.destroy();
1767
1765
  }
1768
1766
  async#setup() {
1769
1767
  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.101",
4
+ "version": "0.0.103",
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.101",
47
- "@basmilius/apple-common": "0.0.101",
48
- "@basmilius/apple-companion-link": "0.0.101",
49
- "@basmilius/apple-encoding": "0.0.101"
46
+ "@basmilius/apple-airplay": "0.0.103",
47
+ "@basmilius/apple-common": "0.0.103",
48
+ "@basmilius/apple-companion-link": "0.0.103",
49
+ "@basmilius/apple-encoding": "0.0.103"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@basmilius/tools": "^2.23.0",