ogplayer 0.1.2 → 0.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/dist/core/player.d.ts +32 -0
- package/dist/core/types.d.ts +29 -1
- package/dist/core/vertical-feed.d.ts +126 -0
- package/dist/index.d.ts +2 -0
- package/dist/ogplayer.global.js +114 -34
- package/dist/ogplayer.js +114 -34
- package/dist/ui/og-player.d.ts +9 -0
- package/dist/ui/og-vertical-feed.d.ts +77 -0
- package/package.json +2 -2
package/dist/ui/og-player.d.ts
CHANGED
|
@@ -74,6 +74,15 @@ export interface OGUIConfig {
|
|
|
74
74
|
* 5000 renderer, 6000 live, 9000 unknown). Return null/undefined for the
|
|
75
75
|
* SDK default. The error object still reaches onError unchanged. */
|
|
76
76
|
errorMessageProvider?: (error: OGPlayerError) => string | null | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Your own error UI, rendered ON the player surface when a fatal playback
|
|
79
|
+
* error occurs (embedded and fullscreen alike). Return an element; the SDK
|
|
80
|
+
* mounts it exactly when the built-in overlay would show, clears it on
|
|
81
|
+
* retry/new load, and skips the built-in overlay entirely (so
|
|
82
|
+
* errorMessageProvider / showRetryButton / retryButtonLabel don't apply).
|
|
83
|
+
* The retry callback runs player.retry() plus the SDK's housekeeping.
|
|
84
|
+
*/
|
|
85
|
+
renderErrorOverlay?: (error: OGPlayerError, retry: () => void) => HTMLElement;
|
|
77
86
|
}
|
|
78
87
|
export declare const defaultUIConfig: OGUIConfig;
|
|
79
88
|
/** Every control flag off — headless chrome in one call (mobile parity:
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type OGVerticalFeedConfig, type OGVerticalFeedItem } from "../core/vertical-feed.js";
|
|
2
|
+
import type { OGPlayerError } from "../core/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* `<og-vertical-feed>` — a swipeable, full-screen vertical video feed built
|
|
5
|
+
* on the OGPlayer engine; the web counterpart of the Android/iOS
|
|
6
|
+
* `OGVerticalFeedView`, with the same names and semantics. A separate
|
|
7
|
+
* surface from `<og-player>` on purpose: portrait-only, no fullscreen or
|
|
8
|
+
* rotation API, its own minimal chrome.
|
|
9
|
+
*
|
|
10
|
+
* The element owns a pool of at most three engine instances (see
|
|
11
|
+
* `VerticalFeedPlayerPool`); the host supplies `items`, listens to
|
|
12
|
+
* `og-nearend`, and appends — the SDK never fetches feed data.
|
|
13
|
+
*
|
|
14
|
+
* Events (CustomEvent detail in braces):
|
|
15
|
+
* og-activeitemchanged {index, item} · og-nearend {remaining} ·
|
|
16
|
+
* og-itemskipped {index, reason} · og-itemerror {index, error} ·
|
|
17
|
+
* og-analytics {event} · og-itemdoubletapped {index, item} ·
|
|
18
|
+
* og-mutedfallback {}
|
|
19
|
+
*/
|
|
20
|
+
export declare class OGVerticalFeedElement extends HTMLElement {
|
|
21
|
+
private root;
|
|
22
|
+
private pool;
|
|
23
|
+
private itemsValue;
|
|
24
|
+
private cfg;
|
|
25
|
+
private mutedValue;
|
|
26
|
+
private intendedPage;
|
|
27
|
+
private observer;
|
|
28
|
+
private resizeObserver;
|
|
29
|
+
private tickTimer;
|
|
30
|
+
private itemErrors;
|
|
31
|
+
private secondary;
|
|
32
|
+
private secondaryFor;
|
|
33
|
+
private secondaryDetach;
|
|
34
|
+
private singleTapTimer;
|
|
35
|
+
private scrubbing;
|
|
36
|
+
private mounted;
|
|
37
|
+
/** Host hook: replace the default "Sponsored" chip (level-3 slot). */
|
|
38
|
+
sponsoredBadge: ((item: OGVerticalFeedItem) => HTMLElement) | null;
|
|
39
|
+
/** Host hook: replace the whole error surface on a failed page. */
|
|
40
|
+
errorOverlay: ((error: OGPlayerError, retry: () => void) => HTMLElement) | null;
|
|
41
|
+
/** When set, single-tap pause waits ~300 ms for double-tap disambiguation
|
|
42
|
+
* (the SDK attaches no meaning to the double tap — that's the host's). */
|
|
43
|
+
onItemDoubleTapped: ((index: number, item: OGVerticalFeedItem) => void) | null;
|
|
44
|
+
constructor();
|
|
45
|
+
get items(): OGVerticalFeedItem[];
|
|
46
|
+
set items(v: OGVerticalFeedItem[]);
|
|
47
|
+
get config(): OGVerticalFeedConfig;
|
|
48
|
+
set config(c: Partial<OGVerticalFeedConfig>);
|
|
49
|
+
/** Feed-level mute — sticky across items, applied to the audible half. */
|
|
50
|
+
get muted(): boolean;
|
|
51
|
+
set muted(v: boolean);
|
|
52
|
+
/** Index of the item currently on screen. */
|
|
53
|
+
get currentIndex(): number;
|
|
54
|
+
connectedCallback(): void;
|
|
55
|
+
disconnectedCallback(): void;
|
|
56
|
+
private mount;
|
|
57
|
+
private remount;
|
|
58
|
+
private teardown;
|
|
59
|
+
private banded;
|
|
60
|
+
private renderPages;
|
|
61
|
+
private makeRegion;
|
|
62
|
+
/** Re-parent pool `<video>` elements into their pages' video regions. */
|
|
63
|
+
private attachSurfaces;
|
|
64
|
+
private renderActiveChrome;
|
|
65
|
+
private railButton;
|
|
66
|
+
/** State-derived feedback + hairline progress, every 250 ms. */
|
|
67
|
+
private tick;
|
|
68
|
+
private manageSecondary;
|
|
69
|
+
private syncSecondaryAudio;
|
|
70
|
+
private releaseSecondary;
|
|
71
|
+
private settle;
|
|
72
|
+
private scrollToPage;
|
|
73
|
+
private syncWatermark;
|
|
74
|
+
private dispatch;
|
|
75
|
+
private q;
|
|
76
|
+
}
|
|
77
|
+
export declare function defineOGVerticalFeedElement(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ogplayer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "OGPlayer web SDK — one video player API across Android, iOS and the web.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/ogplayer.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"smoke": "node scripts/smoke.mjs"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"hls.js": "^1.
|
|
26
|
+
"hls.js": "^1.7.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"esbuild": "^0.23.0",
|