@meshstream/p2p-web 1.0.1 → 1.0.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/config.d.ts CHANGED
@@ -91,9 +91,28 @@ export interface LoadSdkConfigOptions {
91
91
  fetcher?: typeof fetch;
92
92
  now?: () => number;
93
93
  timeoutMs?: number;
94
+ onFailure?: (reason: SdkConfigFailureReason) => void;
95
+ /** Internal guard used by the bounded background retry loop. */
96
+ suppressBackgroundRetry?: boolean;
94
97
  }
98
+ export type SdkConfigLoader = (request: SdkConfigRequest, options?: LoadSdkConfigOptions) => Promise<SdkConfigResponse | undefined>;
99
+ export interface PlaybackBootstrapResult {
100
+ config?: SdkConfigResponse;
101
+ /** True when playback continued before the control-plane request settled. */
102
+ timedOut: boolean;
103
+ }
104
+ export type SdkConfigFailureReason = "NETWORK" | "TRANSIENT_HTTP" | "REJECTED";
95
105
  export declare const DEFAULT_BOOTSTRAP_URL = "https://api.meshstream.net/config-api/v1/sdk/bootstrap";
96
106
  export declare const DEFAULT_BOOTSTRAP_TIMEOUT_MS = 8000;
107
+ /**
108
+ * Bootstrap is started immediately, but media playback does not wait for a
109
+ * network round trip. A cached or already-resolved bootstrap can still enable
110
+ * P2P in the current session; a network response is cached for the next one.
111
+ */
112
+ export declare const DEFAULT_BOOTSTRAP_STARTUP_WAIT_MS = 0;
113
+ /** Do not keep an old policy alive indefinitely when bootstrap is down. */
114
+ export declare const STALE_SDK_CONFIG_GRACE_MS: number;
115
+ export declare function loadSdkConfigForPlayback(loader: SdkConfigLoader, request: SdkConfigRequest, options?: LoadSdkConfigOptions, startupWaitMs?: number): Promise<PlaybackBootstrapResult>;
97
116
  export declare function loadSdkConfig(request: SdkConfigRequest, options?: LoadSdkConfigOptions): Promise<SdkConfigResponse | undefined>;
98
117
  export declare function normalizeSdkConfig(config: Partial<SdkConfigResponse>): SdkConfigResponse;
99
118
  export declare function isSdkP2pConfigUsable(config: SdkConfigResponse | undefined): config is SdkConfigResponse;
package/dist/dash.d.ts CHANGED
@@ -80,6 +80,8 @@ export declare class MeshStreamDashPlayer {
80
80
  private mode;
81
81
  private p2pEnabledOverride?;
82
82
  private readonly eventListeners;
83
+ /** Emits zero counters while playback is using CDN after bootstrap failure. */
84
+ private fallbackStatsTimer?;
83
85
  private playbackState;
84
86
  private readonly lifecycle;
85
87
  private startPromise?;
@@ -99,6 +101,8 @@ export declare class MeshStreamDashPlayer {
99
101
  private teardown;
100
102
  private startCdnDash;
101
103
  addEventListener(listener: P2pEventListener): () => void;
104
+ private startFallbackStatsNotifications;
105
+ private stopFallbackStatsNotifications;
102
106
  private startP2pDashJs;
103
107
  private effectiveP2pEnabled;
104
108
  private bindEventListeners;