@vizbeetv/sdk 7.8.46 → 7.8.53

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.
@@ -0,0 +1,27 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Vizbee TV SDK — Chromecast CAF (v3, cast.framework) type entry point
3
+ // ---------------------------------------------------------------------------
4
+ //
5
+ // Consumer usage:
6
+ // import vizbee, { VideoInfo, PlayerAdapter } from '@vizbee/sdk/chromecast-caf';
7
+ //
8
+ // This is the modern CAF (Cast Application Framework, v3) Chromecast receiver
9
+ // integration. The SDK is initialised via the V2 continuity API:
10
+ // vizbee.continuity.ContinuityContext.getInstance().start(appId)
11
+ // ---------------------------------------------------------------------------
12
+
13
+ import type { VizbeeSDK } from './index.js';
14
+
15
+ export * from './index.js';
16
+
17
+ declare const vizbee: VizbeeSDK;
18
+ export default vizbee;
19
+
20
+ declare global {
21
+ interface Window {
22
+ /** Vizbee TV SDK singleton (Chromecast CAF / v3). */
23
+ VizbeeSDK: VizbeeSDK;
24
+ /** Alias for window.VizbeeSDK — set by the SDK bootstrap. */
25
+ vizbee: VizbeeSDK;
26
+ }
27
+ }
@@ -0,0 +1,299 @@
1
+ // ---------------------------------------------------------------------------
2
+ // Vizbee TV SDK — Chromecast v2 (MediaManager) type entry point [PROPOSED v2]
3
+ // ---------------------------------------------------------------------------
4
+ //
5
+ // v2 changes over v1 (proposed-chromecast-v2.d.ts):
6
+ // • Cross-verified every shape against the SDK runtime bundle
7
+ // (node_modules/@vizbeetv/sdk/chromecast-v2/es6/index.js, 7.8.52) AND our
8
+ // integration (utils/initVizbeeSDK.ts, createVizbeeAppBridge.ts).
9
+ // • Added a TS2430-safe typed `init` overload via declaration merging
10
+ // (no subtype narrowing — see "Typed init" below).
11
+ // • Annotated each shape with VERIFIED (matches both) or DIVERGES (runtime vs
12
+ // npm 7.8.52 internals differ — SDK team to reconcile; see SDK_TYPES_REQUEST.md §D).
13
+ //
14
+ // This is a PROPOSED replacement for @vizbeetv/sdk/types/chromecast-v2.d.ts.
15
+ // It keeps everything the current file ships and adds the chromecast-v2 specific
16
+ // types our integration declares locally today.
17
+ //
18
+ // Consumer usage:
19
+ // import vizbee, { VideoInfo, PlayerAdapter } from '@vizbeetv/sdk/chromecast-v2';
20
+ //
21
+ // Legacy MediaManager (non-CAF) Chromecast integration. The SDK is initialised
22
+ // via the V2 continuity API:
23
+ // vizbee.continuity.ContinuityContext.getInstance().start(appId)
24
+ // ---------------------------------------------------------------------------
25
+
26
+ import type { VideoInfo, VideoStatus, VizbeeSDK } from './index.js';
27
+
28
+ export * from './index.js';
29
+
30
+ // ===========================================================================
31
+ // MediaManager (Cast receiver)
32
+ //
33
+ // VERIFIED: integration assigns mediaManager.onPlay/onPause/onSeek/onStop/onLoad/
34
+ // onResetPlayback (createVizbeeAppBridge.ts, initVizbeeSDK.ts). onSeek receives
35
+ // `event.data.currentTime` (seconds). Typed loosely so the package needs no hard
36
+ // dependency on the Cast receiver typings; consumers pass their concrete
37
+ // `cast.receiver.MediaManager`.
38
+ // ===========================================================================
39
+
40
+ export interface MediaManager {
41
+ onLoad?: ((event: VizbeeMessage) => void) | undefined;
42
+ onPlay?: (() => boolean | void) | undefined;
43
+ onPause?: (() => boolean | void) | undefined;
44
+ onSeek?: ((event: VizbeeMessage) => boolean | void) | undefined;
45
+ onStop?: (() => boolean | void) | undefined;
46
+ onResetPlayback?: ((event: VizbeeMessage) => void) | undefined;
47
+ [key: string]: unknown;
48
+ }
49
+
50
+ // ===========================================================================
51
+ // Platform init config
52
+ //
53
+ // VERIFIED: passed to VizbeeTV.init(platform, config) and as 3rd arg of
54
+ // VizbeeSDK.init(appId, adapters, platformConfig). Integration sets
55
+ // playerScreenContainerId, mediaManager, standalone (element-less: no
56
+ // videoElement, no mediaManagerProcessorType). Runtime confirms
57
+ // `VizbeeTV.init(this.platformType, this.platformConfig)`.
58
+ // ===========================================================================
59
+
60
+ export interface VizbeePlatformConfig {
61
+ /** Element-less mode omits this. */
62
+ videoElement?: HTMLVideoElement | null;
63
+ playerScreenContainerId?: string;
64
+ /** Cast receiver MediaManager — see MediaManager above. */
65
+ mediaManager?: MediaManager;
66
+ standalone?: boolean;
67
+ mediaManagerProcessorType?: 'default' | 'sync' | 'custom';
68
+ captionsType?: 'cea608' | 'cea708';
69
+ }
70
+
71
+ // ===========================================================================
72
+ // V1 bootstrap global
73
+ //
74
+ // VERIFIED: `VizbeeTV` is a distinct global from the VizbeeSDK singleton; runtime
75
+ // calls VizbeeTV.init(platformType, platformConfig). Integration guards on
76
+ // `typeof VizbeeTV === 'undefined'` (startVizbee.ts).
77
+ // ===========================================================================
78
+
79
+ export interface VizbeeTV {
80
+ init(platform: string, config: VizbeePlatformConfig): void;
81
+ }
82
+
83
+ // ===========================================================================
84
+ // Sender → receiver protocol
85
+ //
86
+ // Shapes carried in the Cast load message customData.
87
+ // VERIFIED: isVizbeeMessage.ts gates on customData.vzbSenderOS + vzbVersion;
88
+ // parseVizbeeLoadEvent.ts reads customData.deeplink + customData.guid.
89
+ // ===========================================================================
90
+
91
+ export type VizbeeResumePosition = number | 'WATCH_FROM_START' | 'JOIN_LIVE' | 'RESUME';
92
+
93
+ export interface VizbeeTrack {
94
+ id: string;
95
+ language: string;
96
+ }
97
+
98
+ export interface VizbeeTracks {
99
+ audioTracks: VizbeeTrack[];
100
+ captionTracks: VizbeeTrack[];
101
+ }
102
+
103
+ export type VizbeeCustomData = {
104
+ vzbSenderOS?: string;
105
+ vzbVersion?: string;
106
+ deeplink?: string;
107
+ guid?: string;
108
+ isLive?: boolean;
109
+ resumePosition?: VizbeeResumePosition;
110
+ audioTrack?: VizbeeTrack;
111
+ captionTrack?: VizbeeTrack;
112
+ tracks?: VizbeeTracks;
113
+ /** App-defined extras (e.g. youthProtectionPin, isLitePlayback) — consumers
114
+ * extend via declaration merging. */
115
+ [key: string]: unknown;
116
+ };
117
+
118
+ /**
119
+ * MediaManager load / command envelope handed to adaptMediaInfo / onLoad.
120
+ * VERIFIED: integration reads event.data.media.contentId, .customData, and
121
+ * event.data.currentTime (initVizbeeSDK.ts, parseVizbeeLoadEvent.ts).
122
+ */
123
+ export type VizbeeMessage = {
124
+ data?: {
125
+ currentTime?: number;
126
+ media?: {
127
+ contentId?: string;
128
+ customData?: VizbeeCustomData;
129
+ };
130
+ };
131
+ };
132
+
133
+ /**
134
+ * `onEvent` envelope (sign-in flow). The `custom_data` slot is app-defined
135
+ * (HomeSSO sign-in payload), so kept generic.
136
+ *
137
+ * DIVERGES: integration reads `data.sub_type === 'start_sign_in'` +
138
+ * `data.sinfo.custom_data`. npm 7.8.52 internals instead dispatch via
139
+ * `appAdapter.vizbeeSigninEventHandler` / `vizbeeEventHandler` and the player
140
+ * control handler `Pr.onEvent(e.einfo)` keyed on `e.einfo.type ===
141
+ * "tv.vizbee.homesso.signin"`. The shipped runtime (vizbee_homesso.js) is the
142
+ * source of truth — SDK team to confirm which contract to type. See
143
+ * SDK_TYPES_REQUEST.md §D.1.
144
+ */
145
+ export type VizbeeEventData = {
146
+ data?: {
147
+ sub_type?: string;
148
+ sinfo?: {
149
+ custom_data?: unknown;
150
+ };
151
+ };
152
+ };
153
+
154
+ export type VizbeeOnLoadHandler = (event: VizbeeMessage) => void;
155
+
156
+ // ===========================================================================
157
+ // Video info shapes (chromecast-v2 / V1 startVideo)
158
+ //
159
+ // The shared `VideoInfo` (index.d.ts) is camelCase. The V1 startVideo path and
160
+ // runtime continuity payloads use the lowercase variants below.
161
+ // ===========================================================================
162
+
163
+ /** Raw lowercase videoInfo passed to V1 startVideo(). */
164
+ export interface VizbeeVideoInfo {
165
+ id: string; // unique video GUID
166
+ videourl: string; // stream URL
167
+ islive: boolean; // true for live streams
168
+ title: string; // display title
169
+ subtitle?: string; // secondary line e.g. episode info
170
+ imgurl: string; // thumbnail URL
171
+ contentType: string; // MIME type e.g. 'application/x-mpegURL'
172
+ starttime: number; // start position in ms
173
+ cuepoints: number[]; // ad cue point positions
174
+ customstreaminfo: Record<string, unknown>; // pass-through from sender
175
+ custommetadata: Record<string, unknown>; // pass-through from sender
176
+ drminfo?: { drmtype: string; drmlicenseurl: string; drmcustomdata: string };
177
+ senderInfo?: { st: string; version: string };
178
+ }
179
+
180
+ /**
181
+ * `VideoInfo` extended with the lowercase aliases the runtime emits/accepts.
182
+ * VERIFIED: getVideoInfo() in initVizbeeSDK.ts returns
183
+ * { guid, id, title, subtitle, imgUrl, state, position, duration, islive } —
184
+ * assignable to Partial<VizbeeContinuityVideoInfo>.
185
+ *
186
+ * DIVERGES: npm 7.8.52 consumes getVideoInfo()'s return as VideoStatus
187
+ * (camelCase: currentPosition/state). Reconcile canonical getter shape — see
188
+ * SDK_TYPES_REQUEST.md §D.2.
189
+ */
190
+ export interface VizbeeContinuityVideoInfo extends VideoInfo {
191
+ id?: string;
192
+ state?: string;
193
+ position?: number;
194
+ duration?: number;
195
+ islive?: boolean;
196
+ videourl?: string;
197
+ imgurl?: string;
198
+ isdvrsupported?: boolean;
199
+ }
200
+
201
+ // ===========================================================================
202
+ // Adapters / handlers (chromecast-v2 specific)
203
+ //
204
+ // The shared `AppAdapter` (index.d.ts) only exposes setDeeplinkHandler(). On
205
+ // chromecast-v2 the object passed to VizbeeSDK.init(appId, { appAdapter }) has
206
+ // this richer shape.
207
+ //
208
+ // VERIFIED methods (runtime reads this.appAdapter.<m> + integration provides):
209
+ // adaptMediaInfo — runtime: appAdapter.adaptMediaInfo(t) → t ; integration ✓
210
+ // getVideoInfo — runtime: getStatus():appAdapter.getVideoInfo() ; integration ✓
211
+ // startVideo — runtime: appAdapter.startVideo||noop ; integration omits (optional)
212
+ // DIVERGES: onEvent — see VizbeeEventData note + SDK_TYPES_REQUEST.md §D.1.
213
+ // ===========================================================================
214
+
215
+ export interface VizbeeAppAdapter {
216
+ startVideo?(videoInfo: VizbeeVideoInfo, startTimeMs: number): void;
217
+ stopVideo?(stopReason?: string): boolean | void;
218
+ adaptMediaInfo?(loadEvent: VizbeeMessage): VizbeeMessage;
219
+ getVideoInfo?(): Partial<VizbeeContinuityVideoInfo> | undefined;
220
+ onEvent?(eventType: VizbeeEventData): void;
221
+ }
222
+
223
+ export interface VizbeePlayerControlHandler {
224
+ onLoad?(event: VizbeeMessage): void;
225
+ onPlay?(event: VizbeeMessage): boolean;
226
+ onPause?(event: VizbeeMessage): boolean;
227
+ onSeek?(event: VizbeeMessage): boolean;
228
+ onStop?(event: VizbeeMessage): boolean;
229
+ }
230
+
231
+ /** Adapters bag passed as the 2nd arg of VizbeeSDK.init on chromecast-v2. */
232
+ export interface ChromecastInitAdapters {
233
+ appAdapter?: VizbeeAppAdapter;
234
+ [key: string]: unknown;
235
+ }
236
+
237
+ // ===========================================================================
238
+ // Chromecast v2 — ad status fields
239
+ //
240
+ // The SDK polls the host app's videoInfoGetter() on every tick. For ad tracking
241
+ // the returned object must include these fields alongside VideoStatus.
242
+ // ChromecastStatusPoller reads:
243
+ // status.isPlayingAd → switches the pipeline to the ad channel
244
+ // status.adPosition → current ad playback position (ms)
245
+ // status.adDuration → total ad duration (ms)
246
+ // ===========================================================================
247
+
248
+ /**
249
+ * Extended video status for Chromecast v2 (MediaManager) ad tracking.
250
+ * Return this from your `setVideoInfoGetter` callback while an ad is playing.
251
+ */
252
+ export interface ChromecastVideoStatus extends VideoStatus {
253
+ /** True while an ad is actively playing; false (or omitted) during content. */
254
+ isPlayingAd: boolean;
255
+ /** Current ad playback position in milliseconds. */
256
+ adPosition?: number;
257
+ /** Total ad duration in milliseconds. */
258
+ adDuration?: number;
259
+ }
260
+
261
+ // ===========================================================================
262
+ // Typed init (TS2430-safe)
263
+ //
264
+ // Re-opening the VizbeeSDK interface to ADD a typed `init` overload is
265
+ // declaration merging, NOT subtype narrowing — so it does not trigger TS2430.
266
+ // The base `init(..., Record<string, unknown>, ...)` overload remains, and the
267
+ // typed call below resolves to this stricter one.
268
+ //
269
+ // Preferred long-term fix is to make the base `init` generic in index.d.ts
270
+ // (see SDK_TYPES_REQUEST.md §13); this overload is the no-index-change fallback.
271
+ // ===========================================================================
272
+
273
+ declare module './index.js' {
274
+ interface VizbeeSDK {
275
+ init(
276
+ appId: string,
277
+ adapters: ChromecastInitAdapters,
278
+ platformConfig?: VizbeePlatformConfig,
279
+ vzbOptions?: Record<string, unknown>,
280
+ ): void;
281
+ }
282
+ }
283
+
284
+ declare const vizbee: VizbeeSDK;
285
+ export default vizbee;
286
+
287
+ declare global {
288
+ /** V1 bootstrap object (distinct from the VizbeeSDK singleton). */
289
+ const VizbeeTV: VizbeeTV;
290
+ /** Vizbee TV SDK singleton (Chromecast v2 / MediaManager). */
291
+ const VizbeeSDK: VizbeeSDK;
292
+
293
+ interface Window {
294
+ /** Vizbee TV SDK singleton (Chromecast v2 / MediaManager). */
295
+ VizbeeSDK: VizbeeSDK;
296
+ /** Alias for window.VizbeeSDK — set by the SDK bootstrap. */
297
+ vizbee: VizbeeSDK;
298
+ }
299
+ }