@gentomiyano/optimized-web-audio-player 0.2.1 → 0.2.3

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.
@@ -1,4 +1,4 @@
1
- import { createContext, useRef, useState, useEffect, useSyncExternalStore, useMemo, useContext, useId } from 'react';
1
+ import { createContext, useRef, useState, useEffect, useMemo, useSyncExternalStore, useContext, useId } from 'react';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
 
4
4
  // src/react/player-provider.tsx
@@ -2077,6 +2077,147 @@ function createPlayerStore(options) {
2077
2077
  return new CorePlayerStore(options);
2078
2078
  }
2079
2079
 
2080
+ // src/react/player-runtime-bridge.ts
2081
+ var RUNTIME_PENDING_ERROR = Object.freeze({
2082
+ code: "unknown",
2083
+ recoverable: true,
2084
+ messageKey: "player.error.runtime-pending"
2085
+ });
2086
+ var RUNTIME_PENDING_RESULT = Object.freeze({
2087
+ ok: false,
2088
+ error: RUNTIME_PENDING_ERROR
2089
+ });
2090
+ function notify(listeners) {
2091
+ for (const listener of listeners) {
2092
+ listener();
2093
+ }
2094
+ }
2095
+ function createPlayerRuntimeBridge(experienceConfig) {
2096
+ let pendingState = createInitialPlayerState(experienceConfig);
2097
+ let activeStore = null;
2098
+ let activeCommands = null;
2099
+ let unsubscribeStore = null;
2100
+ let unsubscribeExperience = null;
2101
+ const listeners = /* @__PURE__ */ new Set();
2102
+ const experienceListeners = /* @__PURE__ */ new Set();
2103
+ const pendingResult = () => Promise.resolve(RUNTIME_PENDING_RESULT);
2104
+ const commandsImplementation = {
2105
+ load: (item) => activeCommands?.load(item) ?? pendingResult(),
2106
+ setQueue: (queue, options) => activeCommands?.setQueue(queue, options) ?? pendingResult(),
2107
+ activateContext: (options) => activeCommands?.activateContext(options) ?? pendingResult(),
2108
+ appendToManualHistory: (contextId, item) => {
2109
+ activeCommands?.appendToManualHistory(contextId, item);
2110
+ },
2111
+ play: () => activeCommands?.play() ?? pendingResult(),
2112
+ pause: (options) => activeCommands?.pause(options) ?? Promise.resolve(),
2113
+ stop: (options) => activeCommands?.stop(options) ?? Promise.resolve(),
2114
+ togglePlayback: () => activeCommands?.togglePlayback() ?? pendingResult(),
2115
+ seekTo: (seconds) => {
2116
+ activeCommands?.seekTo(seconds);
2117
+ },
2118
+ seekBy: (deltaSeconds) => {
2119
+ activeCommands?.seekBy(deltaSeconds);
2120
+ },
2121
+ setVolume: (volume) => {
2122
+ activeCommands?.setVolume(volume);
2123
+ },
2124
+ toggleMute: () => {
2125
+ activeCommands?.toggleMute();
2126
+ },
2127
+ setShuffle: (enabled) => {
2128
+ activeCommands?.setShuffle(enabled);
2129
+ },
2130
+ setRepeatMode: (mode) => {
2131
+ activeCommands?.setRepeatMode(mode);
2132
+ },
2133
+ next: () => activeCommands?.next() ?? pendingResult(),
2134
+ previous: () => activeCommands?.previous() ?? pendingResult(),
2135
+ retry: () => activeCommands?.retry() ?? pendingResult(),
2136
+ clear: () => activeCommands?.clear() ?? Promise.resolve()
2137
+ };
2138
+ const commands = Object.freeze(commandsImplementation);
2139
+ const experienceImplementation = {
2140
+ getConfig: () => activeStore?.experience.getConfig() ?? pendingState.experienceConfig,
2141
+ updateConfig: (patch) => {
2142
+ if (activeStore !== null) {
2143
+ activeStore.experience.updateConfig(patch);
2144
+ return;
2145
+ }
2146
+ pendingState = createInitialPlayerState({
2147
+ ...pendingState.experienceConfig,
2148
+ ...patch
2149
+ });
2150
+ notify(listeners);
2151
+ notify(experienceListeners);
2152
+ },
2153
+ resetConfig: () => {
2154
+ if (activeStore !== null) {
2155
+ activeStore.experience.resetConfig();
2156
+ return;
2157
+ }
2158
+ pendingState = createInitialPlayerState(
2159
+ PREVIEW_PLAYER_EXPERIENCE_CONFIG
2160
+ );
2161
+ notify(listeners);
2162
+ notify(experienceListeners);
2163
+ },
2164
+ subscribe: (listener) => {
2165
+ experienceListeners.add(listener);
2166
+ return () => {
2167
+ experienceListeners.delete(listener);
2168
+ };
2169
+ }
2170
+ };
2171
+ const experience = Object.freeze(experienceImplementation);
2172
+ const storeImplementation = {
2173
+ getState: () => activeStore?.getState() ?? pendingState,
2174
+ subscribe: (listener) => {
2175
+ listeners.add(listener);
2176
+ return () => {
2177
+ listeners.delete(listener);
2178
+ };
2179
+ },
2180
+ commands,
2181
+ experience,
2182
+ synchronizeFromMedia: (reason) => activeStore?.synchronizeFromMedia(reason) ?? Promise.resolve(),
2183
+ destroy: () => activeStore?.destroy() ?? Promise.resolve()
2184
+ };
2185
+ const store = Object.freeze(storeImplementation);
2186
+ const detachActiveStore = () => {
2187
+ unsubscribeStore?.();
2188
+ unsubscribeExperience?.();
2189
+ unsubscribeStore = null;
2190
+ unsubscribeExperience = null;
2191
+ activeStore = null;
2192
+ activeCommands = null;
2193
+ };
2194
+ const bridge = {
2195
+ store,
2196
+ attach(nextStore, nextCommands) {
2197
+ detachActiveStore();
2198
+ activeStore = nextStore;
2199
+ activeCommands = nextCommands;
2200
+ unsubscribeStore = nextStore.subscribe(() => {
2201
+ notify(listeners);
2202
+ });
2203
+ unsubscribeExperience = nextStore.experience.subscribe(() => {
2204
+ notify(experienceListeners);
2205
+ });
2206
+ notify(listeners);
2207
+ notify(experienceListeners);
2208
+ return () => {
2209
+ if (activeStore !== nextStore) {
2210
+ return;
2211
+ }
2212
+ detachActiveStore();
2213
+ notify(listeners);
2214
+ notify(experienceListeners);
2215
+ };
2216
+ }
2217
+ };
2218
+ return Object.freeze(bridge);
2219
+ }
2220
+
2080
2221
  // src/react/runtime-commands.ts
2081
2222
  function activate(gain, options) {
2082
2223
  options.onUserActivation?.();
@@ -2216,7 +2357,10 @@ function PlayerProvider({
2216
2357
  const initialQueueItemIdRef = useRef(initialQueueItemId);
2217
2358
  const initialExperienceConfigRef = useRef(experienceConfig);
2218
2359
  const diagnosticListenerRef = useRef(onDiagnosticEvent);
2219
- const [runtime, setRuntime] = useState(null);
2360
+ const [runtimeBridge] = useState(
2361
+ () => createPlayerRuntimeBridge(experienceConfig)
2362
+ );
2363
+ const [runtimeStatus, setRuntimeStatus] = useState("pending");
2220
2364
  const [audioContextState, setAudioContextState] = useState("uninitialized");
2221
2365
  const [resolvedAudioMode, setResolvedAudioMode] = useState("web-audio");
2222
2366
  const [mediaSessionSupported, setMediaSessionSupported] = useState(false);
@@ -2295,6 +2439,7 @@ function PlayerProvider({
2295
2439
  });
2296
2440
  }
2297
2441
  });
2442
+ const detachRuntime = runtimeBridge.attach(store, commands);
2298
2443
  mediaSessionController = createBrowserMediaSessionController({
2299
2444
  commands,
2300
2445
  getState: () => store.getState(),
@@ -2391,16 +2536,7 @@ function PlayerProvider({
2391
2536
  );
2392
2537
  window.addEventListener("pageshow", handlePageShow);
2393
2538
  window.addEventListener("focus", handleFocus);
2394
- const contextValue2 = {
2395
- store,
2396
- commands,
2397
- experience: store.experience,
2398
- audioContextState: "uninitialized",
2399
- audioMode: nextAudioMode,
2400
- mediaSessionSupported: activeMediaSessionController.supported,
2401
- mediaSessionActionsEnabled: false
2402
- };
2403
- setRuntime(contextValue2);
2539
+ setRuntimeStatus("ready");
2404
2540
  void store.commands.setQueue(initialQueueRef.current, {
2405
2541
  ...initialQueueItemIdRef.current === void 0 ? {} : { startQueueItemId: initialQueueItemIdRef.current },
2406
2542
  autoplay: false
@@ -2419,21 +2555,35 @@ function PlayerProvider({
2419
2555
  }
2420
2556
  unsubscribeMediaSession();
2421
2557
  activeMediaSessionController.destroy();
2422
- setRuntime(
2423
- (current) => current?.store === store ? null : current
2424
- );
2558
+ setRuntimeStatus("pending");
2559
+ detachRuntime();
2425
2560
  void store.destroy();
2426
2561
  };
2427
2562
  }, [
2428
- audioMode
2563
+ audioMode,
2564
+ runtimeBridge
2429
2565
  ]);
2430
- const contextValue = runtime === null ? null : {
2431
- ...runtime,
2432
- audioContextState,
2433
- audioMode: resolvedAudioMode,
2434
- mediaSessionSupported,
2435
- mediaSessionActionsEnabled
2436
- };
2566
+ const contextValue = useMemo(
2567
+ () => ({
2568
+ runtimeStatus,
2569
+ store: runtimeBridge.store,
2570
+ commands: runtimeBridge.store.commands,
2571
+ experience: runtimeBridge.store.experience,
2572
+ audioContextState,
2573
+ audioMode: resolvedAudioMode,
2574
+ mediaSessionSupported,
2575
+ mediaSessionActionsEnabled
2576
+ }),
2577
+ [
2578
+ audioContextState,
2579
+ mediaSessionActionsEnabled,
2580
+ mediaSessionSupported,
2581
+ resolvedAudioMode,
2582
+ runtimeBridge,
2583
+ runtimeStatus
2584
+ ]
2585
+ );
2586
+ const consumerTree = children ?? (runtimeStatus === "pending" ? loadingFallback : null);
2437
2587
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2438
2588
  /* @__PURE__ */ jsx(
2439
2589
  "audio",
@@ -2444,11 +2594,12 @@ function PlayerProvider({
2444
2594
  "data-media-session-actions": mediaSessionActionsEnabled ? "enabled" : "inactive",
2445
2595
  "data-media-session-supported": mediaSessionSupported ? "true" : "false",
2446
2596
  "data-player-audio": "true",
2597
+ "data-player-runtime-status": runtimeStatus,
2447
2598
  preload: "metadata",
2448
2599
  ref: audioRef
2449
2600
  }
2450
2601
  ),
2451
- contextValue === null ? loadingFallback : /* @__PURE__ */ jsx(PlayerRuntimeContext.Provider, { value: contextValue, children })
2602
+ /* @__PURE__ */ jsx(PlayerRuntimeContext.Provider, { value: contextValue, children: consumerTree })
2452
2603
  ] });
2453
2604
  }
2454
2605
  function MiniPlayerHost({
@@ -2511,6 +2662,7 @@ function usePlayer() {
2511
2662
  () => context.store.getState()
2512
2663
  );
2513
2664
  return {
2665
+ runtimeStatus: context.runtimeStatus,
2514
2666
  state,
2515
2667
  commands: context.commands,
2516
2668
  experience: context.experience,
@@ -2799,100 +2951,6 @@ function IconButton({
2799
2951
  }
2800
2952
  );
2801
2953
  }
2802
- function SeekBar({
2803
- canSeek,
2804
- className,
2805
- commitMode,
2806
- currentTimeSec,
2807
- durationSec,
2808
- label = "Seek",
2809
- onSeek,
2810
- status
2811
- }) {
2812
- const duration = durationSec !== null && Number.isFinite(durationSec) && durationSec > 0 ? durationSec : 0;
2813
- const disabled = !canSeek || duration === 0 || status === "loading";
2814
- const safeCurrentTime = clamp(currentTimeSec, 0, duration);
2815
- const [previewTime, setPreviewTime] = useState(safeCurrentTime);
2816
- const previewProgress = duration === 0 ? 0 : clamp(previewTime / duration, 0, 1) * 100;
2817
- const isAdjusting = useRef(false);
2818
- const lastCommitted = useRef(null);
2819
- useEffect(() => {
2820
- if (!isAdjusting.current) {
2821
- setPreviewTime(safeCurrentTime);
2822
- }
2823
- }, [safeCurrentTime]);
2824
- function updatePreview(value) {
2825
- const nextValue = clamp(value, 0, duration);
2826
- isAdjusting.current = true;
2827
- setPreviewTime(nextValue);
2828
- if (commitMode === "live") {
2829
- onSeek(nextValue);
2830
- lastCommitted.current = nextValue;
2831
- }
2832
- }
2833
- function commitPreview(value = previewTime) {
2834
- const nextValue = clamp(value, 0, duration);
2835
- if (disabled || !isAdjusting.current || commitMode === "live" && lastCommitted.current === nextValue) {
2836
- isAdjusting.current = false;
2837
- return;
2838
- }
2839
- onSeek(nextValue);
2840
- lastCommitted.current = nextValue;
2841
- isAdjusting.current = false;
2842
- }
2843
- function cancelPreview() {
2844
- isAdjusting.current = false;
2845
- lastCommitted.current = null;
2846
- setPreviewTime(safeCurrentTime);
2847
- }
2848
- return /* @__PURE__ */ jsxs(
2849
- "label",
2850
- {
2851
- className: ["player-seek", className].filter(Boolean).join(" "),
2852
- "data-disabled": disabled ? "true" : "false",
2853
- children: [
2854
- /* @__PURE__ */ jsx("span", { className: "player-visually-hidden", children: label }),
2855
- /* @__PURE__ */ jsx(
2856
- "span",
2857
- {
2858
- "aria-hidden": "true",
2859
- className: "player-seek__progress",
2860
- style: { width: `${String(disabled ? 0 : previewProgress)}%` }
2861
- }
2862
- ),
2863
- /* @__PURE__ */ jsx(
2864
- "input",
2865
- {
2866
- "aria-label": label,
2867
- "aria-valuetext": formatTimeAria(previewTime),
2868
- disabled,
2869
- max: duration || 1,
2870
- min: 0,
2871
- onBlur: (event) => {
2872
- commitPreview(Number(event.currentTarget.value));
2873
- },
2874
- onChange: (event) => {
2875
- updatePreview(Number(event.currentTarget.value));
2876
- },
2877
- onKeyUp: (event) => {
2878
- commitPreview(Number(event.currentTarget.value));
2879
- },
2880
- onPointerDown: () => {
2881
- isAdjusting.current = true;
2882
- },
2883
- onPointerCancel: cancelPreview,
2884
- onPointerUp: (event) => {
2885
- commitPreview(Number(event.currentTarget.value));
2886
- },
2887
- step: 0.1,
2888
- type: "range",
2889
- value: disabled ? 0 : previewTime
2890
- }
2891
- )
2892
- ]
2893
- }
2894
- );
2895
- }
2896
2954
  var FALLBACK_PEAKS = [
2897
2955
  0.16,
2898
2956
  0.24,
@@ -2989,6 +3047,182 @@ function Waveform({
2989
3047
  }
2990
3048
  );
2991
3049
  }
3050
+ function CompactPlayerLayout({
3051
+ appearance,
3052
+ className,
3053
+ contextId,
3054
+ contextMode,
3055
+ currentTimeSec,
3056
+ durationSec,
3057
+ errorNotice,
3058
+ isActive,
3059
+ isPlaying,
3060
+ item,
3061
+ label,
3062
+ primaryControl,
3063
+ queueItemId,
3064
+ runtimeStatus,
3065
+ seekControl,
3066
+ status,
3067
+ trailingControl,
3068
+ waveformOpacity,
3069
+ waveformPlayedStateEnabled
3070
+ }) {
3071
+ const progress = durationSec === null || durationSec <= 0 ? 0 : currentTimeSec / durationSec;
3072
+ return /* @__PURE__ */ jsxs(
3073
+ PlayerSurface,
3074
+ {
3075
+ appearance,
3076
+ className: ["player-compact", className].filter(Boolean).join(" "),
3077
+ label,
3078
+ children: [
3079
+ /* @__PURE__ */ jsxs(
3080
+ "div",
3081
+ {
3082
+ className: "player-compact__main",
3083
+ ...isActive === void 0 ? {} : { "data-active": isActive ? "true" : "false" },
3084
+ "data-has-status": status === void 0 ? "false" : "true",
3085
+ "data-has-trailing-control": trailingControl === void 0 ? "false" : "true",
3086
+ "data-playback-context-id": contextId,
3087
+ "data-playback-context-mode": contextMode,
3088
+ "data-player-runtime-status": runtimeStatus,
3089
+ "data-queue-item-id": queueItemId,
3090
+ children: [
3091
+ primaryControl,
3092
+ /* @__PURE__ */ jsx(Artwork, { className: "player-compact__artwork", item }),
3093
+ /* @__PURE__ */ jsx(TrackMetadata, { item, scrollTitle: isPlaying }),
3094
+ /* @__PURE__ */ jsxs("div", { className: "player-compact__signal", children: [
3095
+ status,
3096
+ /* @__PURE__ */ jsxs(
3097
+ "div",
3098
+ {
3099
+ className: "player-compact__scrubber",
3100
+ "data-seek-enabled": seekControl === void 0 ? "false" : "true",
3101
+ children: [
3102
+ /* @__PURE__ */ jsx(
3103
+ Waveform,
3104
+ {
3105
+ opacity: waveformOpacity,
3106
+ playedStateEnabled: waveformPlayedStateEnabled,
3107
+ progress,
3108
+ waveform: item?.waveform
3109
+ }
3110
+ ),
3111
+ seekControl
3112
+ ]
3113
+ }
3114
+ ),
3115
+ /* @__PURE__ */ jsx(
3116
+ TimeReadout,
3117
+ {
3118
+ currentTimeSec,
3119
+ durationSec
3120
+ }
3121
+ )
3122
+ ] }),
3123
+ trailingControl
3124
+ ]
3125
+ }
3126
+ ),
3127
+ errorNotice
3128
+ ]
3129
+ }
3130
+ );
3131
+ }
3132
+ function SeekBar({
3133
+ canSeek,
3134
+ className,
3135
+ commitMode,
3136
+ currentTimeSec,
3137
+ durationSec,
3138
+ label = "Seek",
3139
+ onSeek,
3140
+ status
3141
+ }) {
3142
+ const duration = durationSec !== null && Number.isFinite(durationSec) && durationSec > 0 ? durationSec : 0;
3143
+ const disabled = !canSeek || duration === 0 || status === "loading";
3144
+ const safeCurrentTime = clamp(currentTimeSec, 0, duration);
3145
+ const [previewTime, setPreviewTime] = useState(safeCurrentTime);
3146
+ const previewProgress = duration === 0 ? 0 : clamp(previewTime / duration, 0, 1) * 100;
3147
+ const isAdjusting = useRef(false);
3148
+ const lastCommitted = useRef(null);
3149
+ useEffect(() => {
3150
+ if (!isAdjusting.current) {
3151
+ setPreviewTime(safeCurrentTime);
3152
+ }
3153
+ }, [safeCurrentTime]);
3154
+ function updatePreview(value) {
3155
+ const nextValue = clamp(value, 0, duration);
3156
+ isAdjusting.current = true;
3157
+ setPreviewTime(nextValue);
3158
+ if (commitMode === "live") {
3159
+ onSeek(nextValue);
3160
+ lastCommitted.current = nextValue;
3161
+ }
3162
+ }
3163
+ function commitPreview(value = previewTime) {
3164
+ const nextValue = clamp(value, 0, duration);
3165
+ if (disabled || !isAdjusting.current || commitMode === "live" && lastCommitted.current === nextValue) {
3166
+ isAdjusting.current = false;
3167
+ return;
3168
+ }
3169
+ onSeek(nextValue);
3170
+ lastCommitted.current = nextValue;
3171
+ isAdjusting.current = false;
3172
+ }
3173
+ function cancelPreview() {
3174
+ isAdjusting.current = false;
3175
+ lastCommitted.current = null;
3176
+ setPreviewTime(safeCurrentTime);
3177
+ }
3178
+ return /* @__PURE__ */ jsxs(
3179
+ "label",
3180
+ {
3181
+ className: ["player-seek", className].filter(Boolean).join(" "),
3182
+ "data-disabled": disabled ? "true" : "false",
3183
+ children: [
3184
+ /* @__PURE__ */ jsx("span", { className: "player-visually-hidden", children: label }),
3185
+ /* @__PURE__ */ jsx(
3186
+ "span",
3187
+ {
3188
+ "aria-hidden": "true",
3189
+ className: "player-seek__progress",
3190
+ style: { width: `${String(disabled ? 0 : previewProgress)}%` }
3191
+ }
3192
+ ),
3193
+ /* @__PURE__ */ jsx(
3194
+ "input",
3195
+ {
3196
+ "aria-label": label,
3197
+ "aria-valuetext": formatTimeAria(previewTime),
3198
+ disabled,
3199
+ max: duration || 1,
3200
+ min: 0,
3201
+ onBlur: (event) => {
3202
+ commitPreview(Number(event.currentTarget.value));
3203
+ },
3204
+ onChange: (event) => {
3205
+ updatePreview(Number(event.currentTarget.value));
3206
+ },
3207
+ onKeyUp: (event) => {
3208
+ commitPreview(Number(event.currentTarget.value));
3209
+ },
3210
+ onPointerDown: () => {
3211
+ isAdjusting.current = true;
3212
+ },
3213
+ onPointerCancel: cancelPreview,
3214
+ onPointerUp: (event) => {
3215
+ commitPreview(Number(event.currentTarget.value));
3216
+ },
3217
+ step: 0.1,
3218
+ type: "range",
3219
+ value: disabled ? 0 : previewTime
3220
+ }
3221
+ )
3222
+ ]
3223
+ }
3224
+ );
3225
+ }
2992
3226
  function BoundCompactPlayerView({
2993
3227
  appearance,
2994
3228
  className,
@@ -2996,78 +3230,51 @@ function BoundCompactPlayerView({
2996
3230
  contextId,
2997
3231
  contextMode,
2998
3232
  options,
3233
+ runtimeStatus,
2999
3234
  state
3000
3235
  }) {
3001
- const progress = state.durationSec === null || state.durationSec <= 0 ? 0 : state.currentTimeSec / state.durationSec;
3002
3236
  return /* @__PURE__ */ jsx(
3003
- PlayerSurface,
3237
+ CompactPlayerLayout,
3004
3238
  {
3005
3239
  appearance,
3006
- className: ["player-bound-compact", className].filter(Boolean).join(" "),
3240
+ ...className === void 0 ? {} : { className },
3241
+ ...contextId === void 0 ? {} : { contextId },
3242
+ ...contextMode === void 0 ? {} : { contextMode },
3243
+ currentTimeSec: state.currentTimeSec,
3244
+ durationSec: state.durationSec,
3245
+ isActive: state.isActive,
3246
+ isPlaying: state.isPlaying,
3247
+ item: state.item,
3007
3248
  label: `Inline player: ${state.item.title}`,
3008
- children: /* @__PURE__ */ jsxs(
3009
- "div",
3249
+ primaryControl: /* @__PURE__ */ jsx(
3250
+ IconButton,
3251
+ {
3252
+ className: "player-play-button",
3253
+ label: state.isPlaying ? "Pause" : "Play",
3254
+ onClick: () => {
3255
+ void commands.togglePlayback();
3256
+ },
3257
+ children: state.isPlaying ? /* @__PURE__ */ jsx(PauseIcon, { size: 22 }) : /* @__PURE__ */ jsx(PlayIcon, { size: 22 })
3258
+ }
3259
+ ),
3260
+ queueItemId: state.queueItemId,
3261
+ ...runtimeStatus === void 0 ? {} : { runtimeStatus },
3262
+ seekControl: /* @__PURE__ */ jsx(
3263
+ SeekBar,
3010
3264
  {
3011
- className: "player-bound-compact__main",
3012
- "data-active": state.isActive ? "true" : "false",
3013
- "data-playback-context-id": contextId,
3014
- "data-playback-context-mode": contextMode,
3015
- "data-queue-item-id": state.queueItemId,
3016
- children: [
3017
- /* @__PURE__ */ jsx(
3018
- IconButton,
3019
- {
3020
- className: "player-play-button",
3021
- label: state.isPlaying ? "Pause" : "Play",
3022
- onClick: () => {
3023
- void commands.togglePlayback();
3024
- },
3025
- children: state.isPlaying ? /* @__PURE__ */ jsx(PauseIcon, { size: 22 }) : /* @__PURE__ */ jsx(PlayIcon, { size: 22 })
3026
- }
3027
- ),
3028
- /* @__PURE__ */ jsx(
3029
- Artwork,
3030
- {
3031
- className: "player-bound-compact__artwork",
3032
- item: state.item
3033
- }
3034
- ),
3035
- /* @__PURE__ */ jsx(TrackMetadata, { item: state.item, scrollTitle: state.isPlaying }),
3036
- /* @__PURE__ */ jsxs("div", { className: "player-bound-compact__signal", children: [
3037
- /* @__PURE__ */ jsx(
3038
- Waveform,
3039
- {
3040
- opacity: options.waveformOpacity,
3041
- playedStateEnabled: options.waveformPlayedStateEnabled,
3042
- progress,
3043
- waveform: state.item.waveform
3044
- }
3045
- ),
3046
- /* @__PURE__ */ jsx(
3047
- TimeReadout,
3048
- {
3049
- currentTimeSec: state.currentTimeSec,
3050
- durationSec: state.durationSec
3051
- }
3052
- )
3053
- ] }),
3054
- /* @__PURE__ */ jsx(
3055
- SeekBar,
3056
- {
3057
- canSeek: state.canSeek,
3058
- commitMode: options.seekCommitMode,
3059
- currentTimeSec: state.currentTimeSec,
3060
- durationSec: state.durationSec,
3061
- label: `Seek in ${state.item.title}`,
3062
- onSeek: (seconds) => {
3063
- commands.seekTo(seconds);
3064
- },
3065
- status: state.status
3066
- }
3067
- )
3068
- ]
3265
+ canSeek: state.canSeek,
3266
+ commitMode: options.seekCommitMode,
3267
+ currentTimeSec: state.currentTimeSec,
3268
+ durationSec: state.durationSec,
3269
+ label: `Seek in ${state.item.title}`,
3270
+ onSeek: (seconds) => {
3271
+ commands.seekTo(seconds);
3272
+ },
3273
+ status: state.status
3069
3274
  }
3070
- )
3275
+ ),
3276
+ waveformOpacity: options.waveformOpacity,
3277
+ waveformPlayedStateEnabled: options.waveformPlayedStateEnabled
3071
3278
  }
3072
3279
  );
3073
3280
  }
@@ -3087,6 +3294,7 @@ function BoundCompactPlayer({
3087
3294
  commands: bound.commands,
3088
3295
  contextId: context.id,
3089
3296
  contextMode: context.mode,
3297
+ runtimeStatus: player.runtimeStatus,
3090
3298
  options: {
3091
3299
  seekCommitMode: player.state.experienceConfig.seekCommitMode,
3092
3300
  waveformOpacity: player.state.experienceConfig.waveformOpacity,