@gentomiyano/optimized-web-audio-player 0.2.3 → 0.3.0
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/README.md +237 -216
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js.map +1 -1
- package/dist/config-Bhyo_y05.d.ts +14 -0
- package/dist/consumer/index.d.ts +19 -2
- package/dist/consumer/index.js +113 -1
- package/dist/consumer/index.js.map +1 -1
- package/dist/content-CVe0cm0y.d.ts +60 -0
- package/dist/contracts/index.d.ts +3 -15
- package/dist/index.d.ts +4 -3
- package/dist/index.js.map +1 -1
- package/dist/media-delivery/index.d.ts +1 -1
- package/dist/media-delivery/index.js.map +1 -1
- package/dist/{media-element-vFtmw4mQ.d.ts → media-element-BBgNBpqF.d.ts} +1 -1
- package/dist/{player-CE714iU_.d.ts → player-DRQO7SLs.d.ts} +20 -2
- package/dist/ports/index.d.ts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +42 -9
- package/dist/react/index.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/ui/index.d.ts +18 -2
- package/dist/ui/index.js +757 -5
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/player-tokens.css +572 -572
- package/dist/ui/player-views.css +1337 -691
- package/dist/ui/styles.css +2 -2
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -563,11 +563,14 @@ var BrowserMediaSessionController = class {
|
|
|
563
563
|
}
|
|
564
564
|
return;
|
|
565
565
|
}
|
|
566
|
+
const intrinsicContext = item.contentContext;
|
|
567
|
+
const creatorName = item.creatorName ?? (intrinsicContext?.sourceType === "release-track" ? intrinsicContext.artistName : void 0);
|
|
568
|
+
const collectionTitle = item.collectionTitle ?? (intrinsicContext?.sourceType === "release-track" ? intrinsicContext.releaseTitle : intrinsicContext?.sourceType === "podcast-episode" ? intrinsicContext.programTitle : void 0);
|
|
566
569
|
const identity = [
|
|
567
570
|
item.id,
|
|
568
571
|
item.title,
|
|
569
|
-
|
|
570
|
-
|
|
572
|
+
creatorName ?? "",
|
|
573
|
+
collectionTitle ?? "",
|
|
571
574
|
item.artwork?.url ?? ""
|
|
572
575
|
].join("\0");
|
|
573
576
|
if (identity === this.#metadataIdentity || this.#createMetadata === void 0) {
|
|
@@ -576,8 +579,8 @@ var BrowserMediaSessionController = class {
|
|
|
576
579
|
try {
|
|
577
580
|
session.metadata = this.#createMetadata({
|
|
578
581
|
title: item.title,
|
|
579
|
-
artist:
|
|
580
|
-
album:
|
|
582
|
+
artist: creatorName ?? "",
|
|
583
|
+
album: collectionTitle ?? "",
|
|
581
584
|
artwork: item.artwork === void 0 ? [] : [{ src: item.artwork.url }]
|
|
582
585
|
});
|
|
583
586
|
this.#metadataIdentity = identity;
|
|
@@ -1108,6 +1111,7 @@ var CorePlayerStore = class {
|
|
|
1108
1111
|
#handlingEnded = false;
|
|
1109
1112
|
#destroyed = false;
|
|
1110
1113
|
#lastSavedPodcastPositions = /* @__PURE__ */ new Map();
|
|
1114
|
+
#pendingSeekRetrySec = null;
|
|
1111
1115
|
#progressSaveChain = Promise.resolve();
|
|
1112
1116
|
constructor(options) {
|
|
1113
1117
|
this.#media = options.media;
|
|
@@ -1436,6 +1440,7 @@ var CorePlayerStore = class {
|
|
|
1436
1440
|
return failed(INVALID_QUEUE_ERROR);
|
|
1437
1441
|
}
|
|
1438
1442
|
const config = this.#state.experienceConfig;
|
|
1443
|
+
this.#pendingSeekRetrySec = null;
|
|
1439
1444
|
const replacingCurrent = this.#state.currentItem !== null;
|
|
1440
1445
|
let transitionError = null;
|
|
1441
1446
|
if (replacingCurrent) {
|
|
@@ -1662,13 +1667,24 @@ var CorePlayerStore = class {
|
|
|
1662
1667
|
curve: fadeCurve
|
|
1663
1668
|
});
|
|
1664
1669
|
if (!this.#isCurrentCommand(version)) {
|
|
1665
|
-
return;
|
|
1670
|
+
return OK_RESULT;
|
|
1666
1671
|
}
|
|
1667
1672
|
if (fadeOut.error !== null) {
|
|
1668
1673
|
this.#setState({ error: fadeOut.error });
|
|
1669
1674
|
}
|
|
1670
1675
|
this.#setState({ status: "seeking" });
|
|
1671
|
-
|
|
1676
|
+
try {
|
|
1677
|
+
this.#media.seekTo(target);
|
|
1678
|
+
this.#pendingSeekRetrySec = null;
|
|
1679
|
+
} catch {
|
|
1680
|
+
const error = createPlayerError("seek", true);
|
|
1681
|
+
this.#pendingSeekRetrySec = target;
|
|
1682
|
+
this.#setState({
|
|
1683
|
+
status: this.#media.isPaused() ? "paused" : "playing",
|
|
1684
|
+
error
|
|
1685
|
+
});
|
|
1686
|
+
return failed(error);
|
|
1687
|
+
}
|
|
1672
1688
|
this.#setState({ currentTimeSec: target });
|
|
1673
1689
|
const fadeIn = await runFade(this.#gain, {
|
|
1674
1690
|
target: 1,
|
|
@@ -1676,7 +1692,7 @@ var CorePlayerStore = class {
|
|
|
1676
1692
|
curve: fadeCurve
|
|
1677
1693
|
});
|
|
1678
1694
|
if (!this.#isCurrentCommand(version)) {
|
|
1679
|
-
return;
|
|
1695
|
+
return OK_RESULT;
|
|
1680
1696
|
}
|
|
1681
1697
|
if (fadeIn.error !== null) {
|
|
1682
1698
|
this.#setState({ error: fadeIn.error });
|
|
@@ -1684,6 +1700,7 @@ var CorePlayerStore = class {
|
|
|
1684
1700
|
this.#setState({
|
|
1685
1701
|
status: this.#media.isPaused() ? "paused" : "playing"
|
|
1686
1702
|
});
|
|
1703
|
+
return OK_RESULT;
|
|
1687
1704
|
}
|
|
1688
1705
|
#setVolume(volume) {
|
|
1689
1706
|
if (this.#destroyed) {
|
|
@@ -1794,6 +1811,18 @@ var CorePlayerStore = class {
|
|
|
1794
1811
|
if (this.#state.currentQueueIndex === null || this.#state.error === null || !this.#state.error.recoverable) {
|
|
1795
1812
|
return failed(this.#state.error ?? NO_ITEM_ERROR);
|
|
1796
1813
|
}
|
|
1814
|
+
if (this.#state.error.code === "seek" && this.#pendingSeekRetrySec !== null) {
|
|
1815
|
+
const target = this.#pendingSeekRetrySec;
|
|
1816
|
+
const version2 = this.#beginCommand(this.#desiredPlayback);
|
|
1817
|
+
const config = this.#state.experienceConfig;
|
|
1818
|
+
this.#setState({ error: null });
|
|
1819
|
+
return this.#performSeek(
|
|
1820
|
+
version2,
|
|
1821
|
+
target,
|
|
1822
|
+
config.seekFadeMs,
|
|
1823
|
+
config.fadeCurve
|
|
1824
|
+
);
|
|
1825
|
+
}
|
|
1797
1826
|
const version = this.#beginCommand("playing");
|
|
1798
1827
|
this.#setState({ error: null, needsUserGesture: false });
|
|
1799
1828
|
return this.#selectQueueIndex(
|
|
@@ -1807,6 +1836,7 @@ var CorePlayerStore = class {
|
|
|
1807
1836
|
return;
|
|
1808
1837
|
}
|
|
1809
1838
|
const version = this.#beginCommand("paused");
|
|
1839
|
+
this.#pendingSeekRetrySec = null;
|
|
1810
1840
|
const config = this.#state.experienceConfig;
|
|
1811
1841
|
const halted = await this.#halt(version, {
|
|
1812
1842
|
fadeDurationMs: config.pauseFadeOutMs,
|
|
@@ -2891,6 +2921,9 @@ function TrackMetadata({
|
|
|
2891
2921
|
scrollTitle = false,
|
|
2892
2922
|
status
|
|
2893
2923
|
}) {
|
|
2924
|
+
const intrinsicContext = item?.contentContext;
|
|
2925
|
+
const creatorName = item?.creatorName ?? (intrinsicContext?.sourceType === "release-track" ? intrinsicContext.artistName : void 0);
|
|
2926
|
+
const collectionTitle = item?.collectionTitle ?? (intrinsicContext?.sourceType === "release-track" ? intrinsicContext.releaseTitle : intrinsicContext?.sourceType === "podcast-episode" ? intrinsicContext.programTitle : void 0);
|
|
2894
2927
|
return /* @__PURE__ */ jsxs(
|
|
2895
2928
|
"div",
|
|
2896
2929
|
{
|
|
@@ -2905,8 +2938,8 @@ function TrackMetadata({
|
|
|
2905
2938
|
},
|
|
2906
2939
|
item?.title ?? "No media selected"
|
|
2907
2940
|
),
|
|
2908
|
-
/* @__PURE__ */ jsx("span", { className: "player-creator", children: item === null ? "Select media to begin" :
|
|
2909
|
-
|
|
2941
|
+
/* @__PURE__ */ jsx("span", { className: "player-creator", children: item === null ? "Select media to begin" : creatorName ?? "Artist unavailable" }),
|
|
2942
|
+
collectionTitle === void 0 ? null : /* @__PURE__ */ jsx("span", { className: "player-collection", children: collectionTitle })
|
|
2910
2943
|
]
|
|
2911
2944
|
}
|
|
2912
2945
|
);
|