@vizbeetv/sdk 7.8.52 → 7.8.54
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/chromecast-caf/es5/index.js +1 -1
- package/chromecast-caf/es6/index.js +1 -1
- package/chromecast-v2/es5/index.js +1 -1
- package/chromecast-v2/es6/index.js +1 -1
- package/lg/es5/index.js +1 -1
- package/lg/es6/index.js +1 -1
- package/lg-el/es5/index.js +1 -1
- package/lg-el/es6/index.js +1 -1
- package/package.json +1 -1
- package/samsung/es5/index.js +1 -1
- package/samsung/es6/index.js +1 -1
- package/samsung-el/es5/index.js +1 -1
- package/samsung-el/es6/index.js +1 -1
- package/types/chromecast-v2.d.ts +261 -25
- package/vizio/es5/index.js +1 -1
- package/vizio/es6/index.js +1 -1
- package/vizio-el/es5/index.js +1 -1
- package/vizio-el/es6/index.js +1 -1
- package/xbox/es5/index.js +1 -1
- package/xbox/es6/index.js +1 -1
- package/xbox-el/es5/index.js +1 -1
- package/xbox-el/es6/index.js +1 -1
package/types/chromecast-v2.d.ts
CHANGED
|
@@ -1,45 +1,253 @@
|
|
|
1
1
|
// ---------------------------------------------------------------------------
|
|
2
|
-
// Vizbee TV SDK — Chromecast v2 (MediaManager) type entry point
|
|
2
|
+
// Vizbee TV SDK — Chromecast v2 (MediaManager) type entry point [PROPOSED v2]
|
|
3
3
|
// ---------------------------------------------------------------------------
|
|
4
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
|
+
//
|
|
5
18
|
// Consumer usage:
|
|
6
|
-
// import vizbee, { VideoInfo, PlayerAdapter } from '@
|
|
19
|
+
// import vizbee, { VideoInfo, PlayerAdapter } from '@vizbeetv/sdk/chromecast-v2';
|
|
7
20
|
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
21
|
+
// Legacy MediaManager (non-CAF) Chromecast integration. The SDK is initialised
|
|
22
|
+
// via the V2 continuity API:
|
|
10
23
|
// vizbee.continuity.ContinuityContext.getInstance().start(appId)
|
|
11
24
|
// ---------------------------------------------------------------------------
|
|
12
25
|
|
|
13
|
-
import type { VideoStatus, VizbeeSDK } from './index.js';
|
|
26
|
+
import type { VideoInfo, VideoStatus, VizbeeSDK } from './index.js';
|
|
14
27
|
|
|
15
28
|
export * from './index.js';
|
|
16
29
|
|
|
17
|
-
//
|
|
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
|
+
// ===========================================================================
|
|
18
238
|
// Chromecast v2 — ad status fields
|
|
19
239
|
//
|
|
20
|
-
// The SDK polls the host app's videoInfoGetter() on every tick. For ad
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
// status.isPlayingAd
|
|
24
|
-
// status.adPosition
|
|
25
|
-
// status.adDuration
|
|
26
|
-
//
|
|
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
|
+
// ===========================================================================
|
|
27
247
|
|
|
28
248
|
/**
|
|
29
249
|
* Extended video status for Chromecast v2 (MediaManager) ad tracking.
|
|
30
250
|
* Return this from your `setVideoInfoGetter` callback while an ad is playing.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* const { VideoStatus } = vizbee.continuity.messages;
|
|
34
|
-
* playerAdapter.setVideoInfoGetter((): ChromecastVideoStatus => {
|
|
35
|
-
* const s = new VideoStatus() as ChromecastVideoStatus;
|
|
36
|
-
* s.guid = currentGuid;
|
|
37
|
-
* s.currentPosition = player.getCurrentTime();
|
|
38
|
-
* s.isPlayingAd = adManager.isAdPlaying();
|
|
39
|
-
* s.adPosition = adManager.getAdCurrentTime();
|
|
40
|
-
* s.adDuration = adManager.getAdDuration();
|
|
41
|
-
* return s;
|
|
42
|
-
* });
|
|
43
251
|
*/
|
|
44
252
|
export interface ChromecastVideoStatus extends VideoStatus {
|
|
45
253
|
/** True while an ad is actively playing; false (or omitted) during content. */
|
|
@@ -50,10 +258,38 @@ export interface ChromecastVideoStatus extends VideoStatus {
|
|
|
50
258
|
adDuration?: number;
|
|
51
259
|
}
|
|
52
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
|
+
|
|
53
284
|
declare const vizbee: VizbeeSDK;
|
|
54
285
|
export default vizbee;
|
|
55
286
|
|
|
56
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
|
+
|
|
57
293
|
interface Window {
|
|
58
294
|
/** Vizbee TV SDK singleton (Chromecast v2 / MediaManager). */
|
|
59
295
|
VizbeeSDK: VizbeeSDK;
|