@meshstream/p2p-web 1.0.1 → 1.0.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.
package/dist/player.d.ts CHANGED
@@ -9,9 +9,9 @@ import { type MeshStreamServiceWorkerP2pDiagnostics } from "./service-worker-p2p
9
9
  import { type MeshStreamQoeSnapshot } from "./qoe.js";
10
10
  export type MeshStreamPlaybackMode = "p2p-hls" | "sw-hls-p2p" | "sw-hls-cdn" | "cdn-hls" | "native-hls-cdn" | "sw-direct-p2p" | "sw-direct-cdn" | "cdn-direct" | "unsupported";
11
11
  export type MeshStreamTransportPreference = "auto" | "mse" | "service-worker" | "cdn";
12
- export type MeshStreamP2pFallbackReason = "CAPABILITY_UNSUPPORTED" | "P2P_DISABLED" | "SDK_CONFIG_UNAVAILABLE" | "KEY_P2P_DISABLED" | "QUOTA_EXHAUSTED" | "QUOTA_DISABLED" | "TRACKER_UNAVAILABLE" | "P2P_INITIALIZATION_FAILED";
12
+ export type MeshStreamP2pFallbackReason = "CAPABILITY_UNSUPPORTED" | "P2P_DISABLED" | "SDK_CONFIG_PENDING" | "SDK_CONFIG_UNAVAILABLE" | "KEY_P2P_DISABLED" | "QUOTA_EXHAUSTED" | "QUOTA_DISABLED" | "TRACKER_UNAVAILABLE" | "P2P_INITIALIZATION_FAILED";
13
13
  export declare function toP2pUnavailableReason(fallbackReason: MeshStreamP2pFallbackReason | undefined): P2pUnavailableReason | undefined;
14
- export declare function sdkConfigFallbackReason(config: SdkConfigResponse | undefined): MeshStreamP2pFallbackReason;
14
+ export declare function sdkConfigFallbackReason(config: SdkConfigResponse | undefined, pending?: boolean): MeshStreamP2pFallbackReason;
15
15
  export interface MeshStreamServiceWorkerTransportOptions extends Omit<MeshStreamServiceWorkerRegistrationOptions, "registration"> {
16
16
  autoRegister?: boolean;
17
17
  p2pTimeoutMs?: number;
@@ -88,6 +88,7 @@ export interface HlsLike {
88
88
  loadSource(url: string): void;
89
89
  attachMedia(video: HTMLMediaElement): void;
90
90
  on(event: string, listener: (...args: unknown[]) => void): void;
91
+ off?(event: string, listener: (...args: unknown[]) => void): void;
91
92
  destroy(): void;
92
93
  }
93
94
  export declare class MeshStreamHlsPlayer {
@@ -120,6 +121,14 @@ export declare class MeshStreamHlsPlayer {
120
121
  private mode;
121
122
  private p2pEnabledOverride?;
122
123
  private readonly eventListeners;
124
+ /** Emits zero/CDN counters when bootstrap or P2P setup falls back to CDN. */
125
+ private fallbackStatsTimer?;
126
+ /** Counts CDN fragment traffic when bootstrap is still pending. */
127
+ private readonly cdnStats;
128
+ private cdnStatsHls?;
129
+ private readonly cdnFragLoadingHandler;
130
+ private readonly cdnFragLoadedHandler;
131
+ private readonly cdnFragLoadErrorHandler;
123
132
  private playbackState;
124
133
  private readonly lifecycle;
125
134
  private startPromise?;
@@ -140,6 +149,8 @@ export declare class MeshStreamHlsPlayer {
140
149
  private bindEventListeners;
141
150
  private bindServiceWorkerEventListeners;
142
151
  private completeFallbackStart;
152
+ private startFallbackStatsNotifications;
153
+ private stopFallbackStatsNotifications;
143
154
  private removeEventListener;
144
155
  private setPlaybackState;
145
156
  private resolveQoePlaybackState;
@@ -153,6 +164,8 @@ export declare class MeshStreamHlsPlayer {
153
164
  private createServiceWorkerP2pEngine;
154
165
  private resolveServiceWorkerSwarmId;
155
166
  private startCdnFallback;
167
+ private bindCdnStats;
168
+ private unbindCdnStats;
156
169
  private attachHls;
157
170
  private autoplay;
158
171
  private canPlayNativeHls;
package/dist/report.d.ts CHANGED
@@ -132,6 +132,8 @@ export interface P2pReportPayload {
132
132
  export declare const DEFAULT_REPORT_INTERVAL_MS = 30000;
133
133
  export declare const MIN_REPORT_INTERVAL_MS = 20000;
134
134
  export declare function normalizeReportIntervalMs(value: number | undefined): number;
135
+ /** Delay the first periodic report so a synchronized fleet does not burst. */
136
+ export declare function initialReportDelayMs(intervalMs: number): number;
135
137
  export interface PostP2pReportOptions {
136
138
  fetcher?: typeof fetch;
137
139
  authorizationHeader?: string;
@@ -135,6 +135,8 @@ export declare class MeshStreamRxPlayer {
135
135
  private mode;
136
136
  private p2pEnabledOverride?;
137
137
  private readonly eventListeners;
138
+ /** Emits zero/CDN counters when RxPlayer runs without a P2P client. */
139
+ private fallbackStatsTimer?;
138
140
  private playbackState;
139
141
  private readonly lifecycle;
140
142
  private startPromise?;
@@ -157,6 +159,8 @@ export declare class MeshStreamRxPlayer {
157
159
  private createOriginSegmentLoader;
158
160
  private completeFallbackStart;
159
161
  private bindEventListeners;
162
+ private startFallbackStatsNotifications;
163
+ private stopFallbackStatsNotifications;
160
164
  private removeEventListener;
161
165
  private setPlaybackState;
162
166
  private resolveQoePlaybackState;
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** SDK release identifier attached to all Web usage reports. */
2
- export declare const MESHSTREAM_WEB_SDK_VERSION = "1.0.1";
2
+ export declare const MESHSTREAM_WEB_SDK_VERSION = "1.0.3";
3
3
  /** Returns the version of the Web MeshStream SDK loaded by this page. */
4
4
  export declare function getSdkVersion(): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshstream/p2p-web",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Mesh-Stream/meshstream-p2p-web-sdk"