@basmilius/apple-sdk 0.13.1 → 0.13.2

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/dist/index.d.mts CHANGED
@@ -2204,10 +2204,25 @@ declare class StateController extends EventEmitter<StateEventMap> {
2204
2204
  */
2205
2205
  subscribe(): void;
2206
2206
  /**
2207
- * Removes all event listeners from this controller.
2207
+ * Removes forwarding listeners from the underlying AirPlayState.
2208
+ * Does not remove external listeners registered on this controller.
2208
2209
  * @internal
2209
2210
  */
2210
2211
  unsubscribe(): void;
2212
+ /** @internal */
2213
+ onNowPlayingChanged(client: AirPlayClient | null, player: AirPlayPlayer | null): void;
2214
+ /** @internal */
2215
+ onPlaybackStateChanged(client: AirPlayClient, player: AirPlayPlayer, oldState: Proto$1.PlaybackState_Enum, newState: Proto$1.PlaybackState_Enum): void;
2216
+ /** @internal */
2217
+ onVolumeDidChange(volume: number): void;
2218
+ /** @internal */
2219
+ onVolumeMutedDidChange(muted: boolean): void;
2220
+ /** @internal */
2221
+ onArtworkChanged(client: AirPlayClient, player: AirPlayPlayer): void;
2222
+ /** @internal */
2223
+ onSupportedCommandsChanged(client: AirPlayClient, player: AirPlayPlayer, commands: Proto$1.CommandInfo[]): void;
2224
+ /** @internal */
2225
+ onClusterChanged(clusterId: string | null, isLeader: boolean): void;
2211
2226
  }
2212
2227
  //#endregion
2213
2228
  //#region src/controller/system.d.ts
package/dist/index.mjs CHANGED
@@ -515,6 +515,13 @@ var StateController = class extends EventEmitter {
515
515
  constructor(airplay) {
516
516
  super();
517
517
  this.#airplay = airplay;
518
+ this.onNowPlayingChanged = this.onNowPlayingChanged.bind(this);
519
+ this.onPlaybackStateChanged = this.onPlaybackStateChanged.bind(this);
520
+ this.onVolumeDidChange = this.onVolumeDidChange.bind(this);
521
+ this.onVolumeMutedDidChange = this.onVolumeMutedDidChange.bind(this);
522
+ this.onArtworkChanged = this.onArtworkChanged.bind(this);
523
+ this.onSupportedCommandsChanged = this.onSupportedCommandsChanged.bind(this);
524
+ this.onClusterChanged = this.onClusterChanged.bind(this);
518
525
  }
519
526
  get #state() {
520
527
  return this.#airplay.state;
@@ -606,39 +613,61 @@ var StateController = class extends EventEmitter {
606
613
  */
607
614
  subscribe() {
608
615
  const state = this.#state;
609
- state.on("nowPlayingChanged", (client, player) => {
610
- this.emit("nowPlayingChanged", client, player);
611
- const app = client ? {
612
- bundleIdentifier: client.bundleIdentifier,
613
- displayName: client.displayName
614
- } : null;
615
- this.emit("activeAppChanged", app?.bundleIdentifier ?? null, app?.displayName ?? null);
616
- });
617
- state.on("playbackStateChanged", (client, player, oldState, newState) => {
618
- this.emit("playbackStateChanged", client, player, oldState, newState);
619
- });
620
- state.on("volumeDidChange", (volume) => {
621
- this.emit("volumeChanged", volume);
622
- });
623
- state.on("volumeMutedDidChange", (muted) => {
624
- this.emit("volumeMutedChanged", muted);
625
- });
626
- state.on("artworkChanged", (client, player) => {
627
- this.emit("artworkChanged", client, player);
628
- });
629
- state.on("supportedCommandsChanged", (client, player, commands) => {
630
- this.emit("supportedCommandsChanged", client, player, commands);
631
- });
632
- state.on("clusterChanged", (clusterId, isLeader) => {
633
- this.emit("clusterChanged", clusterId, isLeader);
634
- });
616
+ state.on("nowPlayingChanged", this.onNowPlayingChanged);
617
+ state.on("playbackStateChanged", this.onPlaybackStateChanged);
618
+ state.on("volumeDidChange", this.onVolumeDidChange);
619
+ state.on("volumeMutedDidChange", this.onVolumeMutedDidChange);
620
+ state.on("artworkChanged", this.onArtworkChanged);
621
+ state.on("supportedCommandsChanged", this.onSupportedCommandsChanged);
622
+ state.on("clusterChanged", this.onClusterChanged);
635
623
  }
636
624
  /**
637
- * Removes all event listeners from this controller.
625
+ * Removes forwarding listeners from the underlying AirPlayState.
626
+ * Does not remove external listeners registered on this controller.
638
627
  * @internal
639
628
  */
640
629
  unsubscribe() {
641
- this.removeAllListeners();
630
+ const state = this.#state;
631
+ state.off("nowPlayingChanged", this.onNowPlayingChanged);
632
+ state.off("playbackStateChanged", this.onPlaybackStateChanged);
633
+ state.off("volumeDidChange", this.onVolumeDidChange);
634
+ state.off("volumeMutedDidChange", this.onVolumeMutedDidChange);
635
+ state.off("artworkChanged", this.onArtworkChanged);
636
+ state.off("supportedCommandsChanged", this.onSupportedCommandsChanged);
637
+ state.off("clusterChanged", this.onClusterChanged);
638
+ }
639
+ /** @internal */
640
+ onNowPlayingChanged(client, player) {
641
+ this.emit("nowPlayingChanged", client, player);
642
+ const app = client ? {
643
+ bundleIdentifier: client.bundleIdentifier,
644
+ displayName: client.displayName
645
+ } : null;
646
+ this.emit("activeAppChanged", app?.bundleIdentifier ?? null, app?.displayName ?? null);
647
+ }
648
+ /** @internal */
649
+ onPlaybackStateChanged(client, player, oldState, newState) {
650
+ this.emit("playbackStateChanged", client, player, oldState, newState);
651
+ }
652
+ /** @internal */
653
+ onVolumeDidChange(volume) {
654
+ this.emit("volumeChanged", volume);
655
+ }
656
+ /** @internal */
657
+ onVolumeMutedDidChange(muted) {
658
+ this.emit("volumeMutedChanged", muted);
659
+ }
660
+ /** @internal */
661
+ onArtworkChanged(client, player) {
662
+ this.emit("artworkChanged", client, player);
663
+ }
664
+ /** @internal */
665
+ onSupportedCommandsChanged(client, player, commands) {
666
+ this.emit("supportedCommandsChanged", client, player, commands);
667
+ }
668
+ /** @internal */
669
+ onClusterChanged(clusterId, isLeader) {
670
+ this.emit("clusterChanged", clusterId, isLeader);
642
671
  }
643
672
  };
644
673
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@basmilius/apple-sdk",
3
3
  "description": "High-level SDK for controlling Apple devices (Apple TV, HomePod) via AirPlay and Companion Link.",
4
- "version": "0.13.1",
4
+ "version": "0.13.2",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -45,11 +45,11 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@basmilius/apple-airplay": "0.13.1",
49
- "@basmilius/apple-common": "0.13.1",
50
- "@basmilius/apple-companion-link": "0.13.1",
51
- "@basmilius/apple-encoding": "0.13.1",
52
- "@basmilius/apple-raop": "0.13.1"
48
+ "@basmilius/apple-airplay": "0.13.2",
49
+ "@basmilius/apple-common": "0.13.2",
50
+ "@basmilius/apple-companion-link": "0.13.2",
51
+ "@basmilius/apple-encoding": "0.13.2",
52
+ "@basmilius/apple-raop": "0.13.2"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/bun": "^1.3.11",