ogplayer 1.1.0 → 1.2.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 CHANGED
@@ -1,9 +1,8 @@
1
1
  # OGPlayer — web SDK
2
2
 
3
- One video player API across **Android, iOS, web and React Native**. This package is the
4
- web implementation: the same model types, listener callbacks, error codes and
5
- UI behavior as the Android SDK (the reference platform), built on web
6
- standards.
3
+ OGPlayer for the browser built on web standards.
4
+
5
+ Release notes: https://ogplayer.tv/docs/reference/changelog/
7
6
 
8
7
  > OGPlayer is a product of Inverse DOO.
9
8
 
@@ -18,9 +17,8 @@ standards.
18
17
  host-page CSS can't break the player (and vice versa).
19
18
  - **Types:** written in TypeScript — full type declarations ship with the
20
19
  package.
21
- - **License:** the same `OGP1.…` offline keys as Android/iOS, verified with
22
- the browser's built-in WebCrypto one license unlocks every
23
- platform. On the web, `apps` patterns bind to the page **hostname**.
20
+ - **License:** signed `OGP1.…` offline keys, verified with the browser's
21
+ built-in WebCrypto. `apps` patterns bind to the page **hostname**.
24
22
 
25
23
  ## Quick start
26
24
 
@@ -46,9 +44,8 @@ standards.
46
44
  <og-player style="width:100%;aspect-ratio:16/9"></og-player>
47
45
  ```
48
46
 
49
- Overlays (watermarks, logos) use the nine named slots, mirroring
50
- Android/iOS `OverlaySlot` including the clearance choreography around the
51
- controls and rating icons:
47
+ Overlays (watermarks, logos) use the nine named `OverlaySlot`s — including the
48
+ clearance choreography around the controls and rating icons:
52
49
 
53
50
  ```html
54
51
  <og-player>
@@ -57,7 +54,7 @@ controls and rating icons:
57
54
  ```
58
55
 
59
56
  Custom action icons (max 8, inline in the top-end control row, hide with the
60
- controls — same contract as Android/iOS):
57
+ controls):
61
58
 
62
59
  ```js
63
60
  el.config = {
@@ -90,24 +87,3 @@ el.config = {
90
87
  Evergreen Chrome / Edge / Firefox / Safari 16+ (desktop & mobile). Every API
91
88
  used (MSE, custom elements, shadow DOM, WebCrypto, Fullscreen) has been
92
89
  baseline for years; no polyfills.
93
-
94
- ## Feature parity vs Android (reference)
95
-
96
- | Feature | Android | iOS | Web |
97
- |---|---|---|---|
98
- | Transport / state / listeners | ✅ | ✅ | ✅ same names |
99
- | Analytics events | ✅ | ✅ | ✅ same shapes |
100
- | Error taxonomy | ✅ | ✅ | ✅ same codes |
101
- | HLS + ABR qualities | ✅ | ✅ | ✅ (hls.js/native) |
102
- | DASH | ✅ | — | ⏳ later (dash.js/Shaka) |
103
- | Live & DVR | ✅ | ✅ | ✅ |
104
- | Embedded + sideloaded subtitles | ✅ | ✅ | ✅ (native cue rendering) |
105
- | Audio tracks | ✅ | ✅ | ✅ |
106
- | Offline license (shared keypair) | ✅ | ✅ | ✅ WebCrypto |
107
- | Controls chrome (tokens) | ✅ | ✅ | ✅ same tokens/icons |
108
- | Title / NICAM ratings / watermark slots | ✅ | ✅ | ✅ incl. reflow choreography |
109
- | Custom action icons (≤8) | ✅ | ✅ | ✅ |
110
- | Ads (IMA / FreeWheel) | ✅ | ✅ | ⏳ SPI defined, provider later |
111
- | DRM | Widevine/PlayReady | FairPlay | ⏳ EME later |
112
- | Casting | Chromecast module | AirPlay | ⏳ Remote Playback API later |
113
- | Trick-play thumbnails | ✅ | ✅ | ⏳ |
@@ -1,4 +1,4 @@
1
- import { type ErrorCategory, type OGPlayerError } from "./types.js";
1
+ import { type ErrorCategory, type OGPlayerError, type RecoveryReason } from "./types.js";
2
2
  export declare function makeError(code: number, category: ErrorCategory, message: string, retryable: boolean, httpStatusCode?: number, cause?: unknown): OGPlayerError;
3
3
  /** Map the native `<video>` element MediaError. */
4
4
  export declare function fromMediaError(err: MediaError | null): OGPlayerError;
@@ -12,3 +12,9 @@ export declare function fromHlsError(data: {
12
12
  };
13
13
  error?: Error;
14
14
  }): OGPlayerError;
15
+ /** Classify a NON-fatal hls.js error (one hls.js is recovering from itself)
16
+ * for `PlaybackRecovered.reason`. */
17
+ export declare function recoveryReasonFor(data: {
18
+ type: string;
19
+ details: string;
20
+ }): RecoveryReason;
@@ -168,6 +168,10 @@ export interface AnalyticsEventBase {
168
168
  sessionId?: string;
169
169
  assetUrl?: string;
170
170
  }
171
+ /** Why a `PlaybackRecovered` happened. Web values are the hls.js self-healing
172
+ * classes; the Android values (`DRM_RENEWAL_AFTERSHOCK`, `CODEC_RESTART`,
173
+ * `LIVE_WINDOW_RESET`) are listed so shared mappers can switch over one type. */
174
+ export type RecoveryReason = "NETWORK_RETRY" | "BUFFER_STALL" | "DRM_RETRY" | "MEDIA_RETRY" | "DRM_RENEWAL_AFTERSHOCK" | "CODEC_RESTART" | "LIVE_WINDOW_RESET";
171
175
  export type AnalyticsEvent = AnalyticsEventBase & ({
172
176
  type: "Play";
173
177
  } | {
@@ -243,6 +247,18 @@ export type AnalyticsEvent = AnalyticsEventBase & ({
243
247
  orientation: DeviceOrientation;
244
248
  } | {
245
249
  type: "DrmKeysLoaded";
250
+ }
251
+ /** The player healed a fault on its own — no `Error` was surfaced and
252
+ * `onError` did not fire, but the viewer may have seen a short rebuffer.
253
+ * Count these for QoE; they are recoveries, not failures. On web this is
254
+ * hls.js's own retry/stall handling (`detail` carries the hls.js error
255
+ * detail for diagnosis); Android reports its silent re-prepares here
256
+ * under its own reasons. */
257
+ | {
258
+ type: "PlaybackRecovered";
259
+ reason: RecoveryReason;
260
+ positionMs: number;
261
+ detail?: string;
246
262
  } | {
247
263
  type: "Complete";
248
264
  } | {
@@ -271,11 +287,15 @@ export declare const ErrorCodes: {
271
287
  readonly NETWORK_CONNECTION_FAILED: 2000;
272
288
  readonly NETWORK_TIMEOUT: 2001;
273
289
  readonly NETWORK_HTTP_STATUS: 2002;
290
+ /** HTTP failures are BASE + status: 2404, 2503 … (4xx not retryable, 5xx retryable). */
291
+ readonly NETWORK_HTTP_STATUS_BASE: 2000;
274
292
  readonly SOURCE_MALFORMED: 3000;
275
293
  readonly SOURCE_UNSUPPORTED: 3001;
276
294
  readonly SOURCE_NOT_FOUND: 3002;
277
295
  readonly DRM_LICENSE_FAILED: 4000;
278
296
  readonly DRM_LICENSE_HTTP_STATUS: 4001;
297
+ /** License-server HTTP failures are BASE + status: 4403, 4500 … */
298
+ readonly DRM_LICENSE_HTTP_STATUS_BASE: 4000;
279
299
  readonly DRM_TOKEN_FETCH_FAILED: 4002;
280
300
  readonly DRM_PROVISIONING_FAILED: 4003;
281
301
  readonly DRM_SESSION_EXPIRED: 4004;