@basmilius/apple-devices 0.9.4 → 0.9.7
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 +2 -0
- package/dist/index.mjs +14 -6
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -21,6 +21,8 @@ declare class Client {
|
|
|
21
21
|
get duration(): number;
|
|
22
22
|
get playbackRate(): number;
|
|
23
23
|
get isPlaying(): boolean;
|
|
24
|
+
get shuffleMode(): Proto.ShuffleMode_Enum;
|
|
25
|
+
get repeatMode(): Proto.RepeatMode_Enum;
|
|
24
26
|
get elapsedTime(): number;
|
|
25
27
|
get currentItem(): Proto.ContentItem | null;
|
|
26
28
|
get currentItemMetadata(): Proto.ContentItemMetadata | null;
|
package/dist/index.mjs
CHANGED
|
@@ -1966,14 +1966,22 @@ var Client = class {
|
|
|
1966
1966
|
get isPlaying() {
|
|
1967
1967
|
return this.#playbackState === Proto.PlaybackState_Enum.Playing;
|
|
1968
1968
|
}
|
|
1969
|
+
get shuffleMode() {
|
|
1970
|
+
return this.#supportedCommands.find((c) => c.command === Proto.Command.ChangeShuffleMode)?.shuffleMode ?? Proto.ShuffleMode_Enum.Unknown;
|
|
1971
|
+
}
|
|
1972
|
+
get repeatMode() {
|
|
1973
|
+
return this.#supportedCommands.find((c) => c.command === Proto.Command.ChangeRepeatMode)?.repeatMode ?? Proto.RepeatMode_Enum.Unknown;
|
|
1974
|
+
}
|
|
1969
1975
|
get elapsedTime() {
|
|
1970
|
-
const npi = this.#nowPlayingInfo;
|
|
1971
1976
|
const meta = this.currentItemMetadata;
|
|
1972
|
-
const
|
|
1973
|
-
const
|
|
1974
|
-
const
|
|
1975
|
-
if (
|
|
1976
|
-
|
|
1977
|
+
const npi = this.#nowPlayingInfo;
|
|
1978
|
+
const elapsedTimestamp = meta?.elapsedTimeTimestamp || 0;
|
|
1979
|
+
const elapsed = meta?.elapsedTime || npi?.elapsedTime || 0;
|
|
1980
|
+
if (!elapsedTimestamp) return elapsed;
|
|
1981
|
+
if ((meta?.playbackRate ?? npi?.playbackRate ?? 0) === 0 || !this.isPlaying) return elapsed;
|
|
1982
|
+
const timestampUnix = elapsedTimestamp + 978307200;
|
|
1983
|
+
const diff = Date.now() / 1e3 - timestampUnix;
|
|
1984
|
+
return Math.max(0, elapsed + diff);
|
|
1977
1985
|
}
|
|
1978
1986
|
get currentItem() {
|
|
1979
1987
|
if (!this.#playbackQueue || this.#playbackQueue.contentItems.length === 0) return null;
|
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.9.
|
|
4
|
+
"version": "0.9.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@basmilius/apple-airplay": "0.9.
|
|
53
|
-
"@basmilius/apple-common": "0.9.
|
|
54
|
-
"@basmilius/apple-companion-link": "0.9.
|
|
55
|
-
"@basmilius/apple-encoding": "0.9.
|
|
52
|
+
"@basmilius/apple-airplay": "0.9.7",
|
|
53
|
+
"@basmilius/apple-common": "0.9.7",
|
|
54
|
+
"@basmilius/apple-companion-link": "0.9.7",
|
|
55
|
+
"@basmilius/apple-encoding": "0.9.7"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/bun": "^1.3.9",
|