@glomex/integration-web-component 1.1544.1 → 1.1547.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/index.d.ts CHANGED
@@ -1,2805 +1,52 @@
1
-
2
- import type { SerializedError } from '@reduxjs/toolkit';
3
-
4
- export declare interface Ad {
5
- sessionId: string;
6
- id: string;
7
- adFormat: AdFormat | `${AdFormat}`;
8
- duration?: number;
9
- positionIndex: number;
10
- breakIndex: number;
11
- breakName: AdBreakName | `${AdBreakName}`;
12
- mimetype: string;
13
- totalAds: number;
14
- adUrl?: string;
15
- nonLinearWidth?: number;
16
- nonLinearHeight?: number;
17
- title?: string;
18
- advertiserName?: string;
19
- width?: number;
20
- height?: number;
21
- adSystem?: string;
22
- universalAdIds?: {
23
- id: string;
24
- registry: string;
25
- }[];
26
- creativeId?: string;
27
- skippable: boolean;
28
- clickThroughUrl?: string;
29
- }
30
-
31
- /** Name of ad break - when the ad appears, `OVERLAY` is deprecated */
32
- export declare enum AdBreakName {
33
- PREROLL = "preroll",
34
- MIDROLL = "midroll",
35
- POSTROLL = "postroll"
36
- }
37
-
38
- /**
39
- * A broad error shape accepted by AD_ERROR events.
40
- * Any `Error` with a `name` and `code` satisfies this contract,
41
- * so domain-specific errors can flow through without normalisation
42
- * while preserving their origin.
43
- */
44
- export declare interface AdError extends Error {
45
- name: string;
46
- message: string;
47
- code: string;
48
- }
49
-
50
- /** Format of the ad - how it is presented */
51
- export declare enum AdFormat {
52
- LINEAR = "linear",
53
- OVERLAY = "overlay",
54
- CUTIN = "cutin",
55
- PAUSE = "pause"
56
- }
57
-
58
- declare const ALLOWED_UI_ACTIONS: readonly ["play", "pause", "openEpg", "startAgeSetup", "forgotPin", "upgradeToHigherTier"];
59
-
60
- /**
61
- * An additional API script definition that should be executed for this media-item.
62
- *
63
- * @example
64
- * ```
65
- * {
66
- * name: 'some-name',
67
- * scriptUrl: 'https://content-owner.com/tracking/script.js',
68
- * conditions: [
69
- * { startMethods: ['click-to-play'], muted: false, requiredVendors: ['967'], probability: 1 },
70
- * { startMethods: ['autoplay-scroll'], muted: undefined, requiredVendors: undefined, probability: 1 } // undefined = no filtering
71
- * ]
72
- * }
73
- * ```
74
- */
75
- declare interface ApiScript {
76
- /** Name of the API script that should be exposed to tracking */
77
- name: string;
78
- /** URL of the API script that should be executed. Must implement {@link ConnectIntegration}. */
79
- url: string;
80
- /**
81
- * Conditions under which the API script should be executed. Undefined means always.
82
- */
83
- conditions?: {
84
- startMethods?: StartMethod[];
85
- muted?: boolean | undefined;
86
- requiredVendors?: string[];
87
- probability: number;
88
- }[];
89
- }
90
-
91
- /**
92
- * Represents an audio track.
93
- */
94
- export declare interface AudioTrack extends MediaTrack {
95
- /** The type of audio track. */
96
- kind: 'main' | string;
97
- }
98
-
99
- /**
100
- * A collection of audio tracks with selection support.
101
- * A selected track is available when track info is exposed; otherwise null.
102
- *
103
- * **Note:** Audio tracks are available after the {@link IntegrationElement.ready | integration.ready} promise resolves.
104
- *
105
- * The list is iterable and can be converted to an array:
106
- * @example
107
- * ```ts
108
- * for (const track of integration.audioTracks) { console.log(track); }
109
- * const tracks = Array.from(integration.audioTracks);
110
- * ```
111
- */
112
- export declare interface AudioTrackList extends MediaTrackList<AudioTrack> {
113
- /** The currently selected audio track, or `null` if unavailable. */
114
- readonly selected: AudioTrack | null;
115
- /**
116
- * Selects an audio track.
117
- * @param trackOrId - The track or track ID to select.
118
- */
119
- select(trackOrId: AudioTrack | string): void;
120
- }
121
-
122
- declare class BaseMediaError<T extends string = string> extends Error {
123
- code: T;
124
- name: string;
125
- constructor(message: string, code: T);
126
- }
127
-
128
- export declare interface Channel {
129
- /** Human-readable channel title shown in the player UI */
130
- name?: string;
131
- /** Stable machine-facing code used for lookups or analytics */
132
- code?: string;
133
- /** Provider-specific identifier when it differs from `code` */
134
- id?: string;
135
- /** Canonical playback or landing URL clients should open */
136
- url?: string;
137
- /** Square channel-logo URL (ideally 96x96) used wherever icons appear */
138
- logo?: string;
139
- }
140
-
141
- export declare enum ComponentName {
142
- INTEGRATION = "glomex-integration",
143
- TURBO_INTEGRATION = "turbo-integration",
144
- EXTERNAL_MEDIA_ITEM = "external-media-item",
145
- GLOMEX_MEDIA_ITEM = "glomex-media-item",
146
- JOYN_MEDIA_ITEM = "joyn-media-item"
147
- }
148
-
149
- /**
150
- * Describes the contract that an external API tracking script must implement so that it can be
151
- * imported and executed by the integration. The API script must be hosted on the remote server
152
- * with CORS enabled.
153
- *
154
- * @example
155
- * ```ts
156
- * import { IntegrationEvent } from '@glomex/integration';
157
- * export const connectIntegration: ConnectIntegration = (
158
- * integration,
159
- * // userId will be undefined when no consent is given
160
- * { userCountryCode, userId, integrationEnvironment }
161
- * ) => {
162
- * integration.addEventListener(IntegrationEvent.CONTENT_PLAY, () => {
163
- * console.log('play', integration.content);
164
- * });
165
- * };
166
- * ```
167
- *
168
- * @example
169
- * ```js
170
- * export const connectIntegration = (
171
- * integration,
172
- * // userId will be undefined when no consent is given
173
- * { userCountryCode, userId, integrationEnvironment }
174
- * ) => {
175
- * const { IntegrationEvent } = integration.constructor;
176
- * integration.addEventListener(IntegrationEvent.CONTENT_PLAY, () => {
177
- * console.log('play', integration.content);
178
- * });
179
- * };
180
- * ```
181
- */
182
- export declare type ConnectIntegration = (integration: IntegrationElement, context: {
183
- userCountryCode?: string;
184
- userId?: string;
185
- integrationEnvironment?: string;
186
- }, options?: {
187
- warnCallback?: (error: Error) => void;
188
- }) => (() => void) | undefined;
189
-
190
- export declare interface Consent {
191
- gdprApplies: boolean;
192
- consentString?: string;
193
- cmpId?: number;
194
- policyVersion?: number;
195
- vendorListVersion?: number;
196
- vendorConsents?: Record<string, boolean>;
197
- vendorLegitimateInterests?: Record<string, boolean>;
198
- purposeConsents?: Record<string, boolean>;
199
- purposeLegitimateInterests?: Record<string, boolean>;
200
- ready: boolean;
201
- addtlConsent?: string;
202
- }
203
-
204
- export declare enum ContentStopReason {
205
- CLEAR_PLAYLIST = "clearPlaylist",
206
- SELECT_PLAYLIST_ITEM = "selectPlaylistItem",
207
- ENDED = "ended",
208
- CONTENT_ERROR = "contentError",
209
- API_STOP = "apiStop",
210
- LIVESTREAM_STOP = "livestreamStop",
211
- LIVESTREAM_NOT_STARTED = "livestreamNotStarted",
212
- PAGE_HIDE = "pageHide",
213
- BEFORE_UNLOAD = "beforeUnload"
214
- }
215
-
216
- export declare interface CustomMarker extends Omit<Marker, 'name'> {
217
- /** {@inheritDoc Marker.name} */
218
- name: string;
219
- }
220
-
221
- /**
222
- * Identifier names for device IDs that can be passed via {@link SharedContextData.deviceId}.
223
- */
224
- export declare enum DeviceIdName {
225
- /** Android Advertising ID (Google) */
226
- AAID = "aaid",
227
- /** Amazon Fire OS Advertising ID */
228
- AFAI = "afai",
229
- /** Android App Set ID — scope: app */
230
- ASIA = "asia",
231
- /** Android App Set ID — scope: developer */
232
- ASID = "asid",
233
- /** Tizen Identifier for Advertising (Samsung) */
234
- TIFA = "tifa",
235
- /** VIDAA Advertising ID (Hisense) */
236
- VAID = "vaid",
237
- /** Apple Identifier for Advertisers */
238
- IDFA = "idfa",
239
- /** Apple Identifier for Vendors */
240
- IDFV = "idfv",
241
- /** LG Unique Device ID */
242
- LGUDID = "lgudid",
243
- /** Microsoft Advertising ID */
244
- MSAI = "msai",
245
- /** Huawei Open Advertising ID */
246
- OAID = "oaid",
247
- /** PlayStation Advertising ID */
248
- PSNAI = "psnai",
249
- /** Roku Identifier for Advertising */
250
- RIDA = "rida",
251
- /** Vizio Advertising ID */
252
- VIDA = "vida",
253
- /** TitanOS Advertising ID (Walmart) */
254
- WAID = "waid"
255
- }
256
-
257
- /**
258
- * Standard EME key system identifiers for the DRM systems supported by the player.
259
- *
260
- * Set by the content service after DRM-support detection and source
261
- * selection so that the video element only needs to know *which* DRM
262
- * system is in use — without license URIs, tokens or certificates.
263
- */
264
- export declare enum DrmSystem {
265
- FAIRPLAY = "com.apple.fps",
266
- WIDEVINE = "com.widevine.alpha",
267
- PLAYREADY = "com.microsoft.playready"
268
- }
269
-
270
- declare interface Experiment {
271
- name: string;
272
- enabled: boolean;
273
- participantPercentage: number;
274
- variants: Record<string, ExperimentVariant>;
275
- conditions: Record<string, unknown>;
276
- }
277
-
278
- declare interface ExperimentVariant {
279
- weight: number;
280
- contentOverride: Record<string, unknown>;
281
- }
282
-
283
- export declare interface ExtendedVideoPlaybackQuality extends VideoPlaybackQuality {
284
- bitrate: number;
285
- liveLatency: number;
286
- throughput: number;
287
- bytes: number;
288
- bandwidth: number;
289
- width: number;
290
- height: number;
291
- }
292
-
293
- /** @ignore */
294
- export declare const EXTERNAL_PLAYER_NAME = "turbo-player";
295
-
296
- /**
297
- * A media item web component that allows to define external media items via inline JSON.
298
- * It can be placed inside the integration element as a child.
299
- * For more complex use cases, see {@link MediaItemElement}.
300
- *
301
- * @tagname external-media-item
302
- *
303
- * @slot - Slot for inline JSON of type `application/external-media-item+json`
304
- *
305
- * @example single media item with inline JSON
306
- *
307
- * This only works when no `playlist-id` is assigned to `glomex-integration`
308
- *
309
- * ```html
310
- * <glomex-integration
311
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
312
- * >
313
- * <external-media-item>
314
- * <script type="application/external-media-item+json">
315
- * {
316
- * "id": "SOME_ID",
317
- * "sources": [
318
- * {
319
- * "src": "SOME_VIDEO_URL",
320
- * "mimetype": "video/mp4"
321
- * }
322
- * ],
323
- * "duration": 120,
324
- * "poster": "POSTER_URL",
325
- * "title": "VIDEO_TITLE"
326
- * }
327
- * </script>
328
- * </external-media-item>
329
- * </glomex-integration>
330
- * ```
331
- *
332
- * @example multiple media items with inline JSON array
333
- *
334
- * You can also pass an array of {@link MediaItem} objects to define a playlist.
335
- *
336
- * ```html
337
- * <glomex-integration
338
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
339
- * >
340
- * <external-media-item>
341
- * <script type="application/external-media-item+json">
342
- * [
343
- * {
344
- * "id": "VIDEO_1",
345
- * "sources": [{ "src": "VIDEO_1_URL", "mimetype": "video/mp4" }],
346
- * "duration": 120,
347
- * "poster": "POSTER_1_URL",
348
- * "title": "First Video"
349
- * },
350
- * {
351
- * "id": "VIDEO_2",
352
- * "sources": [{ "src": "VIDEO_2_URL", "mimetype": "video/mp4" }],
353
- * "duration": 180,
354
- * "poster": "POSTER_2_URL",
355
- * "title": "Second Video"
356
- * }
357
- * ]
358
- * </script>
359
- * </external-media-item>
360
- * </glomex-integration>
361
- * ```
362
- */
363
- export declare class ExternalMediaItemElement extends MediaItemElement {
364
- }
365
-
366
- /**
367
- * An optional context object that can be used to pass additional application, device and user information to the integration. Updates must be performed immutably: always provide a new object to the {@link IntegrationElement#extraContext} property when modifying any property or nested field.
368
- */
369
- export declare interface ExtraContext {
370
- /**
371
- * The presentational context of the integration. Do not define it when it is not part of those contexts.
372
- */
373
- presentationalContext?: 'curated-list' | 'discovery-page';
374
- /**
375
- * The version of the app. When it is a website, fill in the deployed version of the website.
376
- */
377
- appVersion?: string;
378
- /**
379
- * The name of the app. When it is a website, fill in the name of the project.
380
- */
381
- appName?: string;
382
- /**
383
- * User ids of the user. User ids are only used when the user has given consent for the assigned vendor.
384
- */
385
- userIds?: {
386
- id: string;
387
- name: UserIdName | `${UserIdName}`;
388
- ext?: Record<string, unknown>;
389
- }[];
390
- /**
391
- * The bundle id of the app. Only required for iOS apps.
392
- */
393
- appBundleId?: string;
394
- /**
395
- * The store id of the app. Only required for apps. Depending on the app store, the id is formatted differently.
396
- * {@link https://iabtechlab.com/wp-content/uploads/2020/08/IAB-Tech-Lab-OTT-store-assigned-App-Identification-Guidelines-2020.pdf IAB Tech Lab App Identification Guidelines}
397
- */
398
- appStoreId?: string;
399
- /**
400
- * The store URL of the app. Only required for apps.
401
- * {@link https://iabtechlab.com/wp-content/uploads/2020/08/IAB-Tech-Lab-OTT-store-assigned-App-Identification-Guidelines-2020.pdf IAB Tech Lab App Identification Guidelines}
402
- */
403
- appStoreUrl?: string;
404
- b2bContext?: string;
405
- deviceId?: {
406
- id: string;
407
- name: DeviceIdName | `${DeviceIdName}`;
408
- };
409
- }
410
-
411
- /** Returns the custom element name for the given tenant. */
412
- export declare function getIntegrationComponentName(tenant?: string): string;
413
-
414
- /** Returns the CSS URL for a given integration, tenant and environment. */
415
- export declare function getIntegrationCssUrl(integrationId: string, tenant?: string, env?: TenantEnvironment): string;
416
-
417
- /**
418
- * Returns the {@link SharedContext} singleton from the loaded integration.
419
- *
420
- * Waits for the integration custom element to be defined, then
421
- * reads the singleton from its static property — guaranteeing the same
422
- * instance that the running player uses.
423
- *
424
- * @example
425
- * ```ts
426
- * import { getSharedContext } from '@glomex/integration-web-component';
427
- *
428
- * const sharedContext = await getSharedContext();
429
- * sharedContext.set({
430
- * appVersion: '2.3.0',
431
- * providers: {
432
- * 'my-provider': async () => ({ token: await myAuth.getFreshToken() }),
433
- * }
434
- * });
435
- * ```
436
- */
437
- export declare function getSharedContext(tenant?: string): Promise<SharedContext>;
438
-
439
- /**
440
- * Web component that allows to override title and poster of a given glomex content id. It can be placed
441
- * inside the integration element. For integrating external media items, see {@link ExternalMediaItemElement}.
442
- *
443
- * @tagname glomex-media-item
444
- *
445
- * @attribute id - The glomex media ID or playlist ID to load.
446
- * @attribute {stage|prod} environment - The environment to use for the provider request.
447
- * @attribute poster - URL to override the poster image of the media item.
448
- * @attribute title - Override the title of the media item.
449
- *
450
- * @example with 2 glomex-media-items
451
- *
452
- * This only works when no `playlist-id` is assigned to `glomex-integration`
453
- *
454
- * ```html
455
- * <glomex-integration
456
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
457
- * >
458
- * <glomex-media-item
459
- * id="REPLACE_WITH_MEDIA_OR_PLAYLIST_ID"
460
- * ></glomex-media-item>
461
- * <glomex-media-item
462
- * id="ANOTHER_MEDIA_OR_PLAYLIST_ID"
463
- * ></glomex-media-item>
464
- * </glomex-integration>
465
- * ```
466
- *
467
- * @example glomex-media-item with title and poster override
468
- *
469
- * ```html
470
- * <glomex-integration
471
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
472
- * >
473
- * <glomex-media-item
474
- * id="REPLACE_WITH_MEDIA_OR_PLAYLIST_ID"
475
- * title="REPLACE_WITH_TITLE_OVERRIDE"
476
- * poster="REPLACE_WITH_POSTER_URL_OVERRIDE"
477
- * ></glomex-media-item>
478
- * </glomex-integration>
479
- * ```
480
- *
481
- * @example glomex-media-item targeting the stage environment
482
- *
483
- * ```html
484
- * <glomex-integration
485
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
486
- * >
487
- * <glomex-media-item
488
- * id="REPLACE_WITH_MEDIA_OR_PLAYLIST_ID"
489
- * environment="stage"
490
- * ></glomex-media-item>
491
- * </glomex-integration>
492
- * ```
493
- */
494
- export declare class GlomexMediaItemElement extends MediaItemElement {
495
- /**
496
- * Overridden poster of the media item.
497
- * @attribute poster
498
- */
499
- poster: string;
500
- }
501
-
502
- /**
503
- * Web component to integrate the player.
504
- *
505
- * @see {@link IntegrationElementEventMap} for a full list of event types and their payloads
506
- * @tagname glomex-integration
507
- * @slot - (optional) Slot for custom media items ({@link GlomexMediaItemElement}, {@link JoynMediaItemElement}, {@link ExternalMediaItemElement} or {@link MediaItemElement})
508
- * @slot overlay - (optional) Slot for a custom overlay rendered on top of the player. Use `width: 100%; height: 100%` on the slotted element to cover the full player area.
509
- *
510
- * @example with a playlist-id
511
- *
512
- * ```html
513
- * <glomex-integration
514
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
515
- * playlist-id="REPLACE_WITH_PLAYLIST_ID"
516
- * ></glomex-integration>
517
- * ```
518
- *
519
- * @example with a custom overlay
520
- *
521
- * ```html
522
- * <glomex-integration
523
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
524
- * playlist-id="REPLACE_WITH_PLAYLIST_ID"
525
- * >
526
- * <div slot="overlay" style="width: 100%; height: 100%;">
527
- * Custom overlay content
528
- * </div>
529
- * </glomex-integration>
530
- * ```
531
- *
532
- * You can find more advanced examples in the {@link GlomexMediaItemElement}, {@link JoynMediaItemElement}, {@link ExternalMediaItemElement} or {@link MediaItemElement} documentation.
533
- */
534
- export declare class IntegrationElement extends HTMLElement implements IntegrationProperties {
535
- #private;
536
- static MarkerType: typeof MarkerType;
537
- static KnownMarkerName: typeof KnownMarkerName;
538
- static PlaybackMode: typeof PlaybackMode;
539
- static Mimetype: typeof Mimetype;
540
- static PresentationMode: typeof PresentationMode;
541
- static IntegrationEvent: typeof IntegrationEvent;
542
- static sharedContext: SharedContext;
543
- /**
544
- * {@inheritDoc IntegrationProperties.integrationId}
545
- * @attribute integration-id
546
- */
547
- integrationId?: string;
548
- /**
549
- * {@inheritDoc IntegrationProperties.tenant}
550
- * @attribute tenant
551
- * @ignore
552
- */
553
- tenant?: string;
554
- /**
555
- * {@inheritDoc IntegrationProperties.playlistId}
556
- * @attribute playlist-id
557
- */
558
- playlistId?: string;
559
- /**
560
- * {@inheritDoc IntegrationProperties.index}
561
- * @attribute index
562
- */
563
- index?: number;
564
- /**
565
- * {@inheritDoc IntegrationProperties.hidden}
566
- * @attribute {on|off} hidden
567
- */
568
- hidden: boolean;
569
- /**
570
- * {@inheritDoc IntegrationProperties.topLevelIframe}
571
- * @attribute top-level-iframe
572
- */
573
- topLevelIframe: boolean;
574
- /**
575
- * {@inheritDoc IntegrationProperties.placement}
576
- * @attribute placement
577
- */
578
- placement?: string;
579
- variant?: string;
580
- adPlayer?: string;
581
- /**
582
- * {@inheritDoc IntegrationProperties.crossorigin}
583
- * @attribute crossorigin
584
- */
585
- crossorigin?: IntegrationProperties['crossorigin'];
586
- /**
587
- * {@inheritDoc IntegrationProperties.userLanguage}
588
- * @attribute user-language
589
- */
590
- userLanguage?: string;
591
- extraContext?: ExtraContext;
592
- /**
593
- * {@inheritDoc IntegrationProperties.schain}
594
- * @attribute schain
595
- */
596
- schain?: string;
597
- /**
598
- * Optional callback function invoked when the integration fails to load an advertisement.
599
- * The callback receives an object with a `reason` property that explains why no ad was loaded.
600
- * It must be defined before the element gets attached to the DOM.
601
- */
602
- passback?: (payload: {
603
- reason: string;
604
- }) => void;
605
- /**
606
- * Resolves when the integration API is available (e.g. setting volume, play, pause, etc.).
607
- * Alternatively to `element.addEventListener(IntegrationEvent.READY, () => {...})`
608
- */
609
- ready: Promise<void>;
610
- /**
611
- * Initiates playback of the media content.
612
- * @param options.startMethod - The method used to start playback (defaults to CLICK)
613
- */
614
- play(options?: {
615
- startMethod: Exclude<StartMethod, StartMethod.PRE_CLICK>;
616
- }): Promise<void>;
617
- /**
618
- * Pauses the current media playback.
619
- */
620
- pause(): Promise<void>;
621
- /**
622
- * Snapshots current video frame. Requires {@link crossorigin} to be set to `anonymous`.
623
- */
624
- getCurrentVideoFrame(): Promise<ImageBitmap>;
625
- /**
626
- * Returns the current playback time (in seconds) of the media.
627
- */
628
- get currentTime(): number;
629
- /**
630
- * Returns the current extended playback quality.
631
- */
632
- getVideoPlaybackQuality(): {
633
- droppedVideoFrames: number;
634
- totalVideoFrames: number;
635
- creationTime: number;
636
- corruptedVideoFrames: number;
637
- bitrate: number;
638
- liveLatency: number;
639
- throughput: number;
640
- bytes: number;
641
- bandwidth: number;
642
- width: number;
643
- height: number;
644
- } | undefined;
645
- /**
646
- * Returns the current session ID.
647
- */
648
- get sessionId(): string;
649
- /**
650
- * Returns the current wall clock time (UNIX timestamp in seconds). Useful for livestreams.
651
- */
652
- get wallClockTime(): number;
653
- /**
654
- * Seeks the media to the specified time, updating the current playback time.
655
- *
656
- * To set an initial start time, use {@link MediaItem.resumePosition} on the media item.
657
- *
658
- * @param time - The time (in seconds) to seek to.
659
- */
660
- set currentTime(time: number);
661
- /**
662
- * Retrieves the total duration (in seconds) of the current media content.
663
- */
664
- get duration(): number;
665
- /**
666
- * Retrieves the seekable range of the current media content.
667
- * For VoD content, this typically represents the full duration (0 to duration).
668
- * For live streams, this represents the DVR window that can be seeked to.
669
- * The `start` and `end` properties are `undefined` if the seek range is not yet available.
670
- */
671
- get seekRange(): SeekRange;
672
- /**
673
- * Indicates whether the media playback is currently muted.
674
- */
675
- get muted(): boolean;
676
- /**
677
- * Mutes or unmutes the media playback.
678
- * @param value - A boolean value indicating whether to mute the media playback.
679
- */
680
- set muted(value: boolean);
681
- /**
682
- * Returns the current volume level of the media playback (0-1).
683
- */
684
- get volume(): number;
685
- /**
686
- * Sets the media playback volume to the specified level.
687
- * @param value - The volume level to be set (0-1).
688
- */
689
- set volume(value: number);
690
- /**
691
- * Returns the current playback speed.
692
- */
693
- get playbackRate(): number;
694
- /**
695
- * Sets the playback speed.
696
- * @param value - The playback speed to be set (e.g. 0.5, 1, 1.5, 2).
697
- */
698
- set playbackRate(value: number);
699
- /**
700
- * Returns `true` if the media playback is currently paused; otherwise, returns `false`.
701
- */
702
- get paused(): boolean;
703
- /**
704
- * Indicates whether the media playback has ended.
705
- */
706
- get ended(): boolean;
707
- /**
708
- * Indicates whether the media is currently in a seeking state.
709
- */
710
- get seeking(): boolean;
711
- /**
712
- * Indicates whether the media is currently in a buffering state.
713
- */
714
- get buffering(): boolean;
715
- /**
716
- * Retrieves the current presentation mode of the media player.
717
- * This mode may affect how the media is displayed.
718
- */
719
- get presentationMode(): PresentationMode;
720
- /**
721
- * Returns whether the ad playback is muted. If no ad is currently active, this value is `undefined`.
722
- */
723
- get adMuted(): boolean | undefined;
724
- /**
725
- * Retrieves the volume level for the ad playback. If no ad is currently active, this value is `undefined`.
726
- */
727
- get adVolume(): number | undefined;
728
- /**
729
- * Returns the current playback time (in seconds) for the ad content. If no ad is currently active, this value is `NaN`.
730
- */
731
- get adCurrentTime(): number;
732
- /**
733
- * Retrieves the total duration (in seconds) of the ad content. If no ad is currently active, this value is `NaN`.
734
- */
735
- get adDuration(): number;
736
- /**
737
- * Indicates whether the ad playback is currently paused. If no ad is currently active, this value is `undefined`.
738
- */
739
- get adPaused(): boolean | undefined;
740
- /**
741
- * Retrieves the currently selected content item.
742
- */
743
- get content(): MediaItemResolved | undefined;
744
- /**
745
- * Retrieves the currently selected source.
746
- */
747
- get source(): SourceSelected | undefined;
748
- /**
749
- * Retrieves the current playlist.
750
- */
751
- get playlist(): MediaItemResolved[] | undefined;
752
- /**
753
- * Provides access to the user's consent information.
754
- */
755
- get consent(): Consent | undefined;
756
- /**
757
- * Retrieves information about the detected page.
758
- */
759
- get page(): Page | undefined;
760
- /**
761
- * Retrieves the playback time (in seconds) of the current content.
762
- */
763
- get contentPlaybackTime(): number;
764
- /**
765
- * Retrieves details about the currently selected ad, if any.
766
- */
767
- get currentAd(): Ad | undefined;
768
- /** Version of the integration */
769
- get version(): string;
770
- /**
771
- * Sets the presentation mode of the media player to the specified mode. This mode affects how the integration gets displayed
772
- * (e.g. inline, dock, lightbox, fullscreen).
773
- *
774
- * @param {PresentationMode} mode - The presentation mode to set.
775
- * @param {Object} [options] - Optional configuration.
776
- * @param {boolean} [options.byUser=false] - Indicates if the change was initiated by a user action.
777
- */
778
- setPresentationMode(mode: PresentationMode | `${PresentationMode}`, { byUser }?: {
779
- byUser?: boolean | undefined;
780
- }): Promise<void>;
781
- /**
782
- * Exits the current presentation mode.
783
- *
784
- * @param {Object} [options] - Optional configuration.
785
- * @param {boolean} [options.byUser=false] - Indicates if the change was initiated by a user action.
786
- */
787
- exitCurrentPresentationMode({ byUser }?: {
788
- byUser?: boolean;
789
- }): Promise<void>;
790
- /**
791
- * Returns the audio track list.
792
- * You can use this to listen to audio track changes via `audioTracks.addEventListener('change', ...)`.
793
- *
794
- * **Note:** Audio tracks are available after the {@link ready | integration.ready} promise resolves.
795
- * @example
796
- * ```ts
797
- * await integration.ready;
798
- * for (const track of integration.audioTracks) { console.log(track); }
799
- * const tracks = Array.from(integration.audioTracks);
800
- * ```
801
- *
802
- * Use the `select()` method to change the active audio track:
803
- * @example
804
- * ```ts
805
- * integration.audioTracks?.select(trackId);
806
- * ```
807
- */
808
- get audioTracks(): AudioTrackList | undefined;
809
- /**
810
- * Returns the text track list.
811
- * You can use this to listen to text track changes via `textTracks.addEventListener('change', ...)`.
812
- *
813
- * **Note:** Text tracks are available after the {@link ready | integration.ready} promise resolves.
814
- * @example
815
- * ```ts
816
- * await integration.ready;
817
- * for (const track of integration.textTracks) { console.log(track); }
818
- * const tracks = Array.from(integration.textTracks);
819
- * ```
820
- *
821
- * Use the `select()` method to change the active text track, or pass `undefined` to disable:
822
- * @example
823
- * ```ts
824
- * integration.textTracks?.select(trackId);
825
- * integration.textTracks?.select(undefined); // disable text tracks
826
- * ```
827
- */
828
- get textTracks(): TextTrackList_2 | undefined;
829
- /**
830
- * Returns the video track list.
831
- * You can use this to listen to video track changes via `videoTracks.addEventListener('change', ...)`.
832
- *
833
- * **Note:** Video tracks are available after the {@link ready | integration.ready} promise resolves.
834
- * @example
835
- * ```ts
836
- * await integration.ready;
837
- * for (const track of integration.videoTracks) { console.log(track); }
838
- * const tracks = Array.from(integration.videoTracks);
839
- * ```
840
- *
841
- * Use the `select()` method to change the active video track, or pass `'auto'` for automatic quality selection:
842
- * @example
843
- * ```ts
844
- * integration.videoTracks?.select(trackId);
845
- * integration.videoTracks?.select('auto'); // enable ABR
846
- * ```
847
- */
848
- get videoTracks(): VideoTrackList | undefined;
849
- }
850
-
851
- /**
852
- * Map of events that are dispatched by the {@link IntegrationElement}. The {@link IntegrationElement} provides
853
- * getters to read {@link IntegrationElement#consent consent}, {@link IntegrationElement#content content}, {@link IntegrationElement#page page}, {@link IntegrationElement#currentTime currentTime}, ... state from.
854
- *
855
- * @see {@link IntegrationEvent} for all event types as constants
856
- *
857
- * @example
858
- *
859
- * ```js
860
- * // using strings
861
- * integration.addEventListener('ready', () => {});
862
- * // using constants
863
- * await window.customElements.whenDefined('glomex-integration');
864
- * const { IntegrationEvent } = integration.constructor;
865
- * integration.addEventListener(IntegrationEvent.READY, () => {});
866
- * ```
867
- */
868
- export declare interface IntegrationElementEventMap {
869
- /**
870
- * @inheritdoc IntegrationEvent.READY
871
- * @eventProperty
872
- */
873
- [IntegrationEvent.READY]: CustomEvent<void>;
874
- /**
875
- * @inheritdoc IntegrationEvent.INTEGRATION_ABORT
876
- * @eventProperty
877
- */
878
- [IntegrationEvent.INTEGRATION_ABORT]: CustomEvent<{
879
- error: SerializedError;
880
- }>;
881
- /**
882
- * @inheritdoc IntegrationEvent.INTEGRATION_AD_AVAILABLE
883
- * @eventProperty
884
- */
885
- [IntegrationEvent.INTEGRATION_AD_AVAILABLE]: CustomEvent<void>;
886
- /**
887
- * @inheritdoc IntegrationEvent.INTEGRATION_PASSBACK
888
- * @eventProperty
889
- */
890
- [IntegrationEvent.INTEGRATION_PASSBACK]: CustomEvent<{
891
- reason: string;
892
- }>;
893
- /**
894
- * @inheritdoc IntegrationEvent.USER_UPDATE_CONSENT
895
- * @eventProperty
896
- */
897
- [IntegrationEvent.USER_UPDATE_CONSENT]: CustomEvent<void>;
898
- /**
899
- * @inheritdoc IntegrationEvent.PLAYLIST_UPDATE
900
- * @eventProperty
901
- */
902
- [IntegrationEvent.PLAYLIST_UPDATE]: CustomEvent<void>;
903
- /**
904
- * @inheritdoc IntegrationEvent.PLAYER_SET_PRESENTATION_MODE
905
- * @eventProperty
906
- */
907
- [IntegrationEvent.PLAYER_SET_PRESENTATION_MODE]: CustomEvent<{
908
- mode: PresentationMode;
909
- previousMode: PresentationMode;
910
- }>;
911
- /**
912
- * @inheritdoc IntegrationEvent.CONTENT_SELECT
913
- * @eventProperty
914
- */
915
- [IntegrationEvent.CONTENT_SELECT]: CustomEvent<{
916
- sessionId: string;
917
- source: SourceSelected & {
918
- /**
919
- * Entitlement token for the source, if any.
920
- * @deprecated For Joyn sources, read from `source.metadata.entitlementToken` instead.
921
- */
922
- entitlementToken?: string;
923
- };
924
- }>;
925
- /**
926
- * @inheritdoc IntegrationEvent.CONTENT_START
927
- * @eventProperty
928
- */
929
- [IntegrationEvent.CONTENT_START]: CustomEvent<{
930
- startMethod: StartMethod;
931
- }>;
932
- /**
933
- * @inheritdoc IntegrationEvent.CONTENT_IMPRESSION
934
- * @eventProperty
935
- */
936
- [IntegrationEvent.CONTENT_IMPRESSION]: CustomEvent<void>;
937
- /**
938
- * @inheritdoc IntegrationEvent.CONTENT_BUFFERING_START
939
- * @eventProperty
940
- */
941
- [IntegrationEvent.CONTENT_BUFFERING_START]: CustomEvent<void>;
942
- /**
943
- * @inheritdoc IntegrationEvent.CONTENT_BUFFERING_END
944
- * @eventProperty
945
- */
946
- [IntegrationEvent.CONTENT_BUFFERING_END]: CustomEvent<void>;
947
- /**
948
- * @inheritdoc IntegrationEvent.CONTENT_STOP
949
- * @eventProperty
950
- */
951
- [IntegrationEvent.CONTENT_STOP]: CustomEvent<{
952
- reason: ContentStopReason;
953
- }>;
954
- /**
955
- * @inheritdoc IntegrationEvent.CONTENT_SUSPEND
956
- * @eventProperty
957
- */
958
- [IntegrationEvent.CONTENT_SUSPEND]: CustomEvent<void>;
959
- /**
960
- * @inheritdoc IntegrationEvent.CONTENT_ERROR
961
- * @eventProperty
962
- */
963
- [IntegrationEvent.CONTENT_ERROR]: CustomEvent<{
964
- error: SerializedError;
965
- recoverable: boolean;
966
- }>;
967
- /**
968
- * @inheritdoc IntegrationEvent.CONTENT_MARKER_REACHED
969
- * @eventProperty
970
- */
971
- [IntegrationEvent.CONTENT_MARKER_REACHED]: CustomEvent<{
972
- markerName: string;
973
- markerData: unknown;
974
- }>;
975
- /**
976
- * @inheritdoc IntegrationEvent.CONTENT_TIME_UPDATE
977
- * @eventProperty
978
- */
979
- [IntegrationEvent.CONTENT_TIME_UPDATE]: CustomEvent<void> | HTMLElementEventMap['timeupdate'];
980
- /**
981
- * @inheritdoc IntegrationEvent.CONTENT_SEEKING
982
- * @eventProperty
983
- */
984
- [IntegrationEvent.CONTENT_SEEKING]: CustomEvent<void> | HTMLElementEventMap['seeking'];
985
- /**
986
- * @inheritdoc IntegrationEvent.CONTENT_SEEKED
987
- * @eventProperty
988
- */
989
- [IntegrationEvent.CONTENT_SEEKED]: CustomEvent<void> | HTMLElementEventMap['seeked'];
990
- /**
991
- * @inheritdoc IntegrationEvent.CONTENT_PLAY
992
- * @eventProperty
993
- */
994
- [IntegrationEvent.CONTENT_PLAY]: CustomEvent<void> | HTMLElementEventMap['play'];
995
- /**
996
- * @inheritdoc IntegrationEvent.CONTENT_PAUSE
997
- * @eventProperty
998
- */
999
- [IntegrationEvent.CONTENT_PAUSE]: CustomEvent<void> | HTMLElementEventMap['pause'];
1000
- /**
1001
- * @inheritdoc IntegrationEvent.CONTENT_VOLUME_CHANGE
1002
- * @eventProperty
1003
- */
1004
- [IntegrationEvent.CONTENT_VOLUME_CHANGE]: CustomEvent<void> | HTMLElementEventMap['volumechange'];
1005
- /**
1006
- * @inheritdoc IntegrationEvent.CONTENT_RATECHANGE
1007
- * @eventProperty
1008
- */
1009
- [IntegrationEvent.CONTENT_RATECHANGE]: CustomEvent<void> | HTMLElementEventMap['ratechange'];
1010
- /**
1011
- * @inheritdoc IntegrationEvent.CONTENT_ENDED
1012
- * @eventProperty
1013
- */
1014
- [IntegrationEvent.CONTENT_ENDED]: CustomEvent<void> | HTMLElementEventMap['ended'];
1015
- /**
1016
- * @inheritdoc IntegrationEvent.AD_BREAK_REQUEST
1017
- * @eventProperty
1018
- */
1019
- [IntegrationEvent.AD_BREAK_REQUEST]: CustomEvent<{
1020
- name: string;
1021
- index: number;
1022
- plannedSlotCount: number;
1023
- plannedAdRequestCount: number;
1024
- }>;
1025
- /**
1026
- * @inheritdoc IntegrationEvent.AD_BREAK_REQUEST_ERROR
1027
- * @eventProperty
1028
- */
1029
- [IntegrationEvent.AD_BREAK_REQUEST_ERROR]: CustomEvent<{
1030
- name: string;
1031
- index: number;
1032
- error: Error & {
1033
- code?: string;
1034
- };
1035
- }>;
1036
- /**
1037
- * @inheritdoc IntegrationEvent.AD_LOADED
1038
- * @eventProperty
1039
- */
1040
- [IntegrationEvent.AD_LOADED]: CustomEvent<void>;
1041
- /**
1042
- * @inheritdoc IntegrationEvent.AD_IMPRESSION
1043
- * @eventProperty
1044
- */
1045
- [IntegrationEvent.AD_IMPRESSION]: CustomEvent<void>;
1046
- /**
1047
- * @inheritdoc IntegrationEvent.AD_BUFFERING_START
1048
- * @eventProperty
1049
- */
1050
- [IntegrationEvent.AD_BUFFERING_START]: CustomEvent<void>;
1051
- /**
1052
- * @inheritdoc IntegrationEvent.AD_BUFFERING_END
1053
- * @eventProperty
1054
- */
1055
- [IntegrationEvent.AD_BUFFERING_END]: CustomEvent<void>;
1056
- /**
1057
- * @inheritdoc IntegrationEvent.AD_TIME_UPDATE
1058
- * @eventProperty
1059
- */
1060
- [IntegrationEvent.AD_TIME_UPDATE]: CustomEvent<void>;
1061
- /**
1062
- * @inheritdoc IntegrationEvent.AD_VOLUME_CHANGE
1063
- * @eventProperty
1064
- */
1065
- [IntegrationEvent.AD_VOLUME_CHANGE]: CustomEvent<void>;
1066
- /**
1067
- * @inheritdoc IntegrationEvent.AD_PAUSED
1068
- * @eventProperty
1069
- */
1070
- [IntegrationEvent.AD_PAUSED]: CustomEvent<void>;
1071
- /**
1072
- * @inheritdoc IntegrationEvent.AD_RESUMED
1073
- * @eventProperty
1074
- */
1075
- [IntegrationEvent.AD_RESUMED]: CustomEvent<void>;
1076
- /**
1077
- * @inheritdoc IntegrationEvent.AD_CLICK
1078
- * @eventProperty
1079
- */
1080
- [IntegrationEvent.AD_CLICK]: CustomEvent<void>;
1081
- /**
1082
- * @inheritdoc IntegrationEvent.AD_SKIPPED
1083
- * @eventProperty
1084
- */
1085
- [IntegrationEvent.AD_SKIPPED]: CustomEvent<void>;
1086
- /**
1087
- * @inheritdoc IntegrationEvent.AD_COMPLETE
1088
- * @eventProperty
1089
- */
1090
- [IntegrationEvent.AD_COMPLETE]: CustomEvent<void>;
1091
- /**
1092
- * @inheritdoc IntegrationEvent.AD_ERROR
1093
- * @eventProperty
1094
- */
1095
- [IntegrationEvent.AD_ERROR]: CustomEvent<{
1096
- error: AdError;
1097
- }>;
1098
- /**
1099
- * @inheritdoc IntegrationEvent.UI_INTERACTION
1100
- * @eventProperty
1101
- */
1102
- [IntegrationEvent.UI_INTERACTION]: CustomEvent<{
1103
- action: UiAction;
1104
- }>;
1105
- }
1106
-
1107
- /**
1108
- * Constants for all events dispatched by the {@link IntegrationElement}.
1109
- *
1110
- * @see {@link IntegrationElementEventMap} for a full list of event types and their payloads
1111
- */
1112
- export declare enum IntegrationEvent {
1113
- /**
1114
- * When the integration got initialized.
1115
- * @eventProperty
1116
- */
1117
- READY = "ready",
1118
- /**
1119
- * When the integration got aborted because of a configuration / authorization error.
1120
- * It is not triggered when the content errors.
1121
- * @eventProperty
1122
- */
1123
- INTEGRATION_ABORT = "integrationabort",
1124
- /**
1125
- * When an ad is available.
1126
- * @eventProperty
1127
- */
1128
- INTEGRATION_AD_AVAILABLE = "integrationadavailable",
1129
- /**
1130
- * When a passback is triggered because of no content or no ad. Only available when {@link IntegrationElement#passback} is set.
1131
- * @eventProperty
1132
- */
1133
- INTEGRATION_PASSBACK = "integrationpassback",
1134
- /**
1135
- * When the user's consent got updated.
1136
- * See {@link IntegrationElement#consent} to get the current consent.
1137
- * @eventProperty
1138
- */
1139
- USER_UPDATE_CONSENT = "userupdateconsent",
1140
- /**
1141
- * When the playlist is updated (e.g. new media item got added). See {@link IntegrationElement#playlist} to get the current playlist items.
1142
- * @eventProperty
1143
- */
1144
- PLAYLIST_UPDATE = "playlistupdate",
1145
- /**
1146
- * When the player's presentation mode got changed.
1147
- * @eventProperty
1148
- */
1149
- PLAYER_SET_PRESENTATION_MODE = "playersetpresentationmode",
1150
- /**
1151
- * When content got selected. See {@link IntegrationElement#content} to get the current content.
1152
- * @eventProperty
1153
- */
1154
- CONTENT_SELECT = "contentselect",
1155
- /**
1156
- * When content started initially (e.g. before ad break).
1157
- * @eventProperty
1158
- */
1159
- CONTENT_START = "contentstart",
1160
- /**
1161
- * When the first frame of the content got played back.
1162
- * @eventProperty
1163
- */
1164
- CONTENT_IMPRESSION = "contentimpression",
1165
- /**
1166
- * When content buffering started.
1167
- * @eventProperty
1168
- */
1169
- CONTENT_BUFFERING_START = "contentbufferingstart",
1170
- /**
1171
- * When content buffering ended.
1172
- * @eventProperty
1173
- */
1174
- CONTENT_BUFFERING_END = "contentbufferingend",
1175
- /**
1176
- * When content got stopped (e.g. loading another content or it ended normally). The reason is provided in the payload.
1177
- * It gets triggered after a potential postroll.
1178
- * @eventProperty
1179
- */
1180
- CONTENT_STOP = "contentstop",
1181
- /**
1182
- * When content playback is suspended due to a recoverable error (e.g. network error, PIN required).
1183
- * The session is not over — playback may resume after a reload.
1184
- * @eventProperty
1185
- */
1186
- CONTENT_SUSPEND = "contentsuspend",
1187
- /**
1188
- * When a content error occurs upon loading or playing the content.
1189
- * @eventProperty
1190
- */
1191
- CONTENT_ERROR = "contenterror",
1192
- /**
1193
- * When a marker is reached. See {@link MediaItem#markers} how to define own markers.
1194
- * @eventProperty
1195
- */
1196
- CONTENT_MARKER_REACHED = "contentmarkerreached",
1197
- /**
1198
- * When the content's time updates. This is equal to {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/timeupdate_event HTMLMediaElement.timeupdate}.
1199
- * See {@link IntegrationElement#currentTime} to get the current time.
1200
- * @eventProperty
1201
- */
1202
- CONTENT_TIME_UPDATE = "timeupdate",
1203
- /**
1204
- * When the content is seeking. This is equal to {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seeking_event HTMLMediaElement.seeking}.
1205
- * See {@link IntegrationElement#seeking} to get the current seeking state.
1206
- * @eventProperty
1207
- */
1208
- CONTENT_SEEKING = "seeking",
1209
- /**
1210
- * When the content has seeked. This is equal to {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/seeked_event HTMLMediaElement.seeked}.
1211
- * @eventProperty
1212
- */
1213
- CONTENT_SEEKED = "seeked",
1214
- /**
1215
- * When the content switches from paused to playing. This is equal to {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/play_event HTMLMediaElement.play}.
1216
- * @eventProperty
1217
- */
1218
- CONTENT_PLAY = "play",
1219
- /**
1220
- * When the content switches from playing to paused. This is equal to {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/pause_event HTMLMediaElement.pause}.
1221
- * @eventProperty
1222
- */
1223
- CONTENT_PAUSE = "pause",
1224
- /**
1225
- * When the content's volume changes. This is equal to {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/volumechange_event HTMLMediaElement.volumechange}.
1226
- * See {@link IntegrationElement#volume} to get the current volume.
1227
- * @eventProperty
1228
- */
1229
- CONTENT_VOLUME_CHANGE = "volumechange",
1230
- /**
1231
- * When the content playback rate changes. This is equal to {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/ratechange_event HTMLMediaElement.ratechange}.
1232
- * See {@link IntegrationElement#playbackRate} to get the current playback rate.
1233
- * @eventProperty
1234
- */
1235
- CONTENT_RATECHANGE = "ratechange",
1236
- /**
1237
- * When the content reached its end. This is equal to {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/ended_event HTMLMediaElement.ended}.
1238
- * See {@link IntegrationElement#ended} to check if the content ended.
1239
- * @eventProperty
1240
- */
1241
- CONTENT_ENDED = "ended",
1242
- /**
1243
- * When an ad break gets requested
1244
- * @eventProperty
1245
- */
1246
- AD_BREAK_REQUEST = "adbreakrequest",
1247
- /**
1248
- * When an ad break request fails
1249
- * @eventProperty
1250
- */
1251
- AD_BREAK_REQUEST_ERROR = "adbreakrequesterror",
1252
- /**
1253
- * When an ad is loaded.
1254
- * See {@link IntegrationElement#currentAd} to get the loaded ad.
1255
- * @eventProperty
1256
- */
1257
- AD_LOADED = "adloaded",
1258
- /**
1259
- * When the first frame of the ad got played back.
1260
- * See {@link IntegrationElement#currentAd} to get the current ad.
1261
- * @eventProperty
1262
- */
1263
- AD_IMPRESSION = "adimpression",
1264
- /**
1265
- * When the ad started buffering.
1266
- * @eventProperty
1267
- */
1268
- AD_BUFFERING_START = "adbufferingstart",
1269
- /**
1270
- * When the ad stopped buffering.
1271
- * @eventProperty
1272
- */
1273
- AD_BUFFERING_END = "adbufferingend",
1274
- /**
1275
- * When the ad's time updates.
1276
- * @eventProperty
1277
- */
1278
- AD_TIME_UPDATE = "adtimeupdate",
1279
- /**
1280
- * When the ad's volume changes.
1281
- * See {@link IntegrationElement#adVolume} to get the current volume.
1282
- * @eventProperty
1283
- */
1284
- AD_VOLUME_CHANGE = "advolumechange",
1285
- /**
1286
- * When the ad paused.
1287
- * @eventProperty
1288
- */
1289
- AD_PAUSED = "adpaused",
1290
- /**
1291
- * When the ad resumed.
1292
- * @eventProperty
1293
- */
1294
- AD_RESUMED = "adresumed",
1295
- /**
1296
- * When the ad was clicked.
1297
- * @eventProperty
1298
- */
1299
- AD_CLICK = "adclick",
1300
- /**
1301
- * When the ad was skipped.
1302
- * @eventProperty
1303
- */
1304
- AD_SKIPPED = "adskipped",
1305
- /**
1306
- * When the ad completed.
1307
- * @eventProperty
1308
- */
1309
- AD_COMPLETE = "adcomplete",
1310
- /**
1311
- * When a non-fatal ad error occurs during playback or setup (not triggered when ad loading fails).
1312
- * @eventProperty
1313
- */
1314
- AD_ERROR = "aderror",
1315
- /**
1316
- * When the user interacted with the UI (e.g. play, pause, seek, etc.). The specific action is provided in the payload.
1317
- * @eventProperty
1318
- */
1319
- UI_INTERACTION = "uiinteraction"
1320
- }
1321
-
1322
- /**
1323
- * Properties that can be set on the integration element.
1324
- */
1325
- export declare interface IntegrationProperties {
1326
- /**
1327
- * The identifier for this integration. This value is used to determine the configuration and behavior of the integration.
1328
- */
1329
- integrationId?: string;
1330
- /**
1331
- * The tenant determines which platform endpoints the player connects to.
1332
- * Defaults to `glomex` when not specified.
1333
- * @ignore
1334
- * @example
1335
- * ```html
1336
- * <glomex-integration tenant="joyn" integration-id="..."></glomex-integration>
1337
- * ```
1338
- */
1339
- tenant?: string;
1340
- /**
1341
- * Defines the playlist / content identifier that should be loaded and managed by the integration. It can be a single content id, a playlist id or `auto`.
1342
- * It must be empty when the content is provided via the `media-item` web components inside the integration.
1343
- */
1344
- playlistId?: string;
1345
- /**
1346
- * Determines the index of the media item within the playlist that should be or is currently selected.
1347
- *
1348
- * This property can be used to:
1349
- * - **Switch between media items**: Set this property to navigate to a different item in the playlist (zero-based index).
1350
- * - **Get the current playlist index**: Read this property to determine which media item is currently active in the playlist.
1351
- */
1352
- index?: number;
1353
- /**
1354
- * Hides the integration element when set to `true`.
1355
- */
1356
- hidden?: boolean;
1357
- /**
1358
- * An optional flag that can mark the integration as if it is running in a top-level window context. Useful when the embedded iframe represents an article, which contains this integration.
1359
- */
1360
- topLevelIframe?: boolean;
1361
- /**
1362
- * Allows the publisher to provide an optional placement attribute, which supplies additional contextual information for enhanced analytics tracking.
1363
- * This can be a simple string or a stringified JSON object. If it is a stringified JSON object, its contents are forwarded as `placementDetail`. If the object contains a property key `name`, its value will be tracked for the placement attribute.
1364
- */
1365
- placement?: string;
1366
- env?: 'stage' | 'local';
1367
- variant?: string;
1368
- adPlayer?: string;
1369
- /**
1370
- * The {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/crossorigin crossorigin attribute}
1371
- * is used to define the CORS (Cross-Origin Resource Sharing) policy for the video element.
1372
- * Defaults to `anonymous`. If set to `none` (non-standard value) it won't require CORS headers
1373
- * for the loaded media files, though text-tracks from foreign origins then cannot be loaded.
1374
- */
1375
- crossorigin?: '' | 'anonymous' | 'use-credentials' | 'none';
1376
- /**
1377
- * Preferred language for the current user.
1378
- * When provided, this value is used for the UI instead of the browser language detected in the environment.
1379
- * Accepts a BCP 47 language tag (e.g. "de", "en-US").
1380
- */
1381
- userLanguage?: string;
1382
- /**
1383
- * {@inheritDoc ExtraContext}
1384
- */
1385
- extraContext?: ExtraContext;
1386
- /**
1387
- * Supply chain (schain) information provided by the integrating party (e.g. meta-publisher).
1388
- * Must be set as an IAB serialized string (e.g. `"1.0,1!exchange.com,123,1"`).
1389
- * Supply chain nodes provided here are extended with the relevant downstream nodes.
1390
- */
1391
- schain?: string;
1392
- }
1393
-
1394
- /**
1395
- * Web component that allows to register Joyn media items. It can be placed
1396
- * inside the integration element as a child.
1397
- *
1398
- * @tagname joyn-media-item
1399
- *
1400
- * @attribute id - The Joyn media ID to load.
1401
- * @attribute {stage|prod} environment - The environment to use for the provider request.
1402
- *
1403
- * @example with a joyn-media-item
1404
- *
1405
- * This only works when no `playlist-id` is assigned to `glomex-integration`
1406
- *
1407
- * ```html
1408
- * <glomex-integration
1409
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
1410
- * >
1411
- * <joyn-media-item
1412
- * id="REPLACE_WITH_JOYN_MEDIA_ID"
1413
- * ></joyn-media-item>
1414
- * </glomex-integration>
1415
- * ```
1416
- *
1417
- * @example with 2 joyn-media-items
1418
- *
1419
- * ```html
1420
- * <glomex-integration
1421
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
1422
- * >
1423
- * <joyn-media-item
1424
- * id="REPLACE_WITH_JOYN_MEDIA_ID"
1425
- * ></joyn-media-item>
1426
- * <joyn-media-item
1427
- * id="ANOTHER_JOYN_MEDIA_ID"
1428
- * ></joyn-media-item>
1429
- * </glomex-integration>
1430
- * ```
1431
- *
1432
- * @example joyn-media-item targeting the stage environment
1433
- *
1434
- * ```html
1435
- * <glomex-integration
1436
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
1437
- * >
1438
- * <joyn-media-item
1439
- * id="REPLACE_WITH_JOYN_MEDIA_ID"
1440
- * environment="stage"
1441
- * ></joyn-media-item>
1442
- * </glomex-integration>
1443
- * ```
1444
- */
1445
- export declare class JoynMediaItemElement extends MediaItemElement {
1446
- }
1447
-
1448
- /** Source metadata produced by the Joyn media provider. */
1449
- export declare interface JoynSourceMetadata extends SourceMetadataBase {
1450
- /** Identifies this metadata as produced by the Joyn provider. */
1451
- provider: 'joyn';
1452
- /** Distribution tenant name (e.g. `"JOYN"`, `"JOYN_AT"`, `"JOYN_CH"`). May be absent when the entitlement token cannot be decoded. */
1453
- distributionTenant?: string;
1454
- /** Anonymous user identifier. May be absent when the entitlement token cannot be decoded. */
1455
- anonymousId?: string;
1456
- /** Authenticated user identifier. May be absent when the entitlement token cannot be decoded. */
1457
- userId?: string;
1458
- /** Entitlement identifier from the entitlement token. May be absent when the entitlement token cannot be decoded. */
1459
- entitlementId?: string;
1460
- /** Business model for this entitlement (e.g. `"RVOD"`, `"SVOD"`). May be absent when the entitlement token cannot be decoded. */
1461
- businessModel?: string;
1462
- /** CDN delivery network identifier returned by the playlist service (e.g. `"akamai"`, `"amazon"`, `"fastly"`). */
1463
- deliveryNetwork: string;
1464
- /** DRM protection system used for the source (e.g. `"fairplay"`, `"widevine"`, `"playready"`). */
1465
- protectionSystem: string;
1466
- /** DRM encryption scheme used for the source (`"cenc"` or `"cbcs"`). */
1467
- encryptionScheme: string;
1468
- /** Entitlement token received from the Joyn entitlement service. */
1469
- entitlementToken: string;
1470
- /** Joyn packages associated with the entitlement token (e.g. `DE_FREE`, `DE_PREMIUM`, `DE_REG`) */
1471
- joynPackages?: string[];
1472
- }
1473
-
1474
- export declare enum KnownMarkerName {
1475
- PREROLL = "preroll",
1476
- MIDROLL = "midroll",
1477
- POSTROLL = "postroll",
1478
- FIRST_QUARTILE = "contentFirstQuartile",
1479
- MIDPOINT = "contentMidpoint",
1480
- THIRD_QUARTILE = "contentThirdQuartile",
1481
- COMPLETE = "contentComplete",
1482
- STILL_INTERESTING = "stillInteresting",
1483
- REQUEST_RECOMMENDATIONS = "requestRecommendations"
1484
- }
1485
-
1486
- /**
1487
- * Loads the integration custom element by injecting the tenant-specific
1488
- * script into the document. Does nothing if the element is already defined.
1489
- */
1490
- export declare function loadIntegrationComponent(tenant?: string, env?: TenantEnvironment): void;
1491
-
1492
- /**
1493
- * Loads the variant CSS for the given integration ID by injecting a
1494
- * `<link>` element into the document head. Does nothing if the stylesheet
1495
- * is already loaded.
1496
- *
1497
- * @example
1498
- * ```ts
1499
- * import { loadIntegrationStyles } from '@glomex/integration-web-component';
1500
- *
1501
- * loadIntegrationStyles('my-integration-id');
1502
- * ```
1503
- */
1504
- export declare function loadIntegrationStyles(integrationId: string, tenant?: string, env?: TenantEnvironment): void;
1505
-
1506
- /**
1507
- * Known markers that the integration interprets.
1508
- */
1509
- export declare interface Marker {
1510
- /** Name of the marker */
1511
- name: KnownMarkerName;
1512
- /** Type of the marker */
1513
- type: MarkerType;
1514
- /**
1515
- * Threshold for the marker:
1516
- * - {@link MarkerType.TIME_IN_SECONDS}: seconds (use negative values to calculate position from end of content, e.g., -10 means 10 seconds before the end; only valid for VoD content)
1517
- * - {@link MarkerType.PERCENT}: percent as fraction (0-1)
1518
- * - {@link MarkerType.TIME_IN_SECONDS_RECURRING}: seconds
1519
- */
1520
- threshold: number;
1521
- /** Whether the marker should reference watch time instead of current time. Livestreams always use watch time. */
1522
- useWatchTime?: boolean;
1523
- }
1524
-
1525
- export declare enum MarkerType {
1526
- /** Triggers by time in seconds */
1527
- TIME_IN_SECONDS = "time",
1528
- /** Triggers by percentage (only works when media item has a {@link MediaItem#duration duration}) */
1529
- PERCENT = "percent",
1530
- /** Recurringly triggers by time in seconds (e.g. every 60 seconds) */
1531
- TIME_IN_SECONDS_RECURRING = "timeRecurring"
1532
- }
1533
-
1534
- /**
1535
- * Represents the input description of a media asset for the player.
1536
- *
1537
- * A minimal playable `MediaItem` requires only a source — every other field is optional.
1538
- * Additional fields can be supplied to support analytics, monetization, UI enhancements, and other use cases.
1539
- * In general, the richer the metadata, the more likely the `MediaItem` can satisfy all integration requirements.
1540
- *
1541
- * Alternatively, a {@link MediaItemReference} can be passed to the player instead of a
1542
- * full `MediaItem`. A reference carries only an `id` and a `provider`, letting the player
1543
- * resolve the complete media item from that provider by ID.
1544
- *
1545
- * When the player processes a `MediaItem` (or a resolved {@link MediaItemReference}) it
1546
- * produces a {@link MediaItemResolved} — an expanded version where missing fields are
1547
- * filled with defaults (e.g. `id`, `language`, `aspectRatio`) and additional data is
1548
- * derived automatically.
1549
- */
1550
- export declare interface MediaItem {
1551
- /**
1552
- * Unique identifier of the media item.
1553
- */
1554
- id?: string;
1555
- /**
1556
- * Additional ids that identify the media item in other systems
1557
- */
1558
- additionalIds?: {
1559
- originId?: string;
1560
- externalId?: string;
1561
- };
1562
- /**
1563
- * Poster image of the media item.
1564
- */
1565
- poster?: string;
1566
- /**
1567
- * Sources of the media item.
1568
- */
1569
- sources?: Partial<SourceMediaItem>[];
1570
- /**
1571
- * Array of text tracks for subtitles, captions, etc.
1572
- * These tracks apply to the whole media item, not to individual sources.
1573
- *
1574
- * Note: This is only useful for progressive sources or when the adaptive stream
1575
- * (HLS/DASH) does not deliver the text tracks / subtitles within the manifest.
1576
- */
1577
- textTracks?: MediaItemTextTrack[];
1578
- /**
1579
- * Title of the media item.
1580
- */
1581
- title?: string;
1582
- /**
1583
- * Duration of the media item in seconds. Not defined when livestream.
1584
- */
1585
- duration?: number;
1586
- /**
1587
- * Position (in seconds) at which playback should resume.
1588
- * Applied automatically when the media item is loaded.
1589
- */
1590
- resumePosition?: number;
1591
- /**
1592
- * Description of the media item.
1593
- */
1594
- description?: string;
1595
- /**
1596
- * Language of the media item. 2-letter ISO language code.
1597
- *
1598
- * @defaultValue `de` (German)
1599
- */
1600
- language?: string;
1601
- /**
1602
- * IAB categories (as {@link iabCategoryTaxonomy}) of the media item. Used for monetization.
1603
- */
1604
- iabCategories?: string[];
1605
- /**
1606
- * IAB category taxonomy used for {@link iabCategories} ({@link https://github.com/InteractiveAdvertisingBureau/AdCOM/blob/main/AdCOM%20v1.0%20FINAL.md#list_categorytaxonomies see IAB spec for details})
1607
- * @defaultValue `9` for IAB Tech Lab Content Taxonomy 3.1
1608
- */
1609
- iabCategoryTaxonomy?: number;
1610
- /**
1611
- * Aspect ratio of the media item. Useful when vertical variants are used.
1612
- *
1613
- * @defaultValue `16:9`
1614
- */
1615
- aspectRatio?: string;
1616
- /**
1617
- * Minimum age to watch the media item. Shows a minimum age indicator in the UI.
1618
- *
1619
- * @defaultValue `0` (no minimum age)
1620
- */
1621
- minimumAge?: number;
1622
- /**
1623
- * Release date of the media item. Unix timestamp in milliseconds.
1624
- * Useful for JSON-LD generation.
1625
- */
1626
- releaseDate?: number;
1627
- /**
1628
- * Original TV air date of the media item. Unix timestamp in milliseconds.
1629
- * Used for analytics (e.g. Comscore dateOfTVAiring).
1630
- */
1631
- tvAirDate?: number;
1632
- /**
1633
- * Time when the media item expires. Unix timestamp in milliseconds.
1634
- * Useful for JSON-LD generation.
1635
- */
1636
- endDate?: number;
1637
- /**
1638
- * Whether the media item has product placements. Shows a product placement indicator in the UI.
1639
- */
1640
- hasProductPlacement?: boolean;
1641
- /**
1642
- * Channel (or often referred to as brand) of the media item.
1643
- */
1644
- channel?: Channel;
1645
- /**
1646
- * Markers control ad breaks and custom time-based events during playback.
1647
- *
1648
- * **⚠️ Important:** When providing custom markers, the default PREROLL is **not** added automatically.
1649
- * You must explicitly include a PREROLL marker if you want ads to play.
1650
- *
1651
- * **Reserved marker names:** Only `PREROLL`, `MIDROLL`, and `POSTROLL` from {@link KnownMarkerName}
1652
- * can be used for ad markers. All other `KnownMarkerName` values are reserved for internal use.
1653
- * Use custom string names (e.g., `'halfwayPoint'`) for your own markers.
1654
- *
1655
- * **Listening for custom markers:** When a custom marker is reached, the player dispatches
1656
- * an {@link IntegrationEvent.CONTENT_MARKER_REACHED} event. Listen for this event to react
1657
- * to your custom markers:
1658
- *
1659
- * ```js
1660
- * player.addEventListener('contentmarkerreached', (event) => {
1661
- * const { markerName, markerData } = event.detail;
1662
- * if (markerName === 'showEndCreditsOverlay') {
1663
- * // Show your overlay
1664
- * }
1665
- * });
1666
- * ```
1667
- *
1668
- * @example
1669
- * // Default: pre-roll ads only (same as omitting markers)
1670
- * markers: [{ name: KnownMarkerName.PREROLL, type: MarkerType.TIME_IN_SECONDS, threshold: 0 }]
1671
- *
1672
- * @example
1673
- * // Pre-roll + mid-roll at 60 seconds
1674
- * markers: [
1675
- * { name: KnownMarkerName.PREROLL, type: MarkerType.TIME_IN_SECONDS, threshold: 0 },
1676
- * { name: KnownMarkerName.MIDROLL, type: MarkerType.TIME_IN_SECONDS, threshold: 60 }
1677
- * ]
1678
- *
1679
- * @example
1680
- * // Custom marker at 50% of content
1681
- * markers: [
1682
- * { name: KnownMarkerName.PREROLL, type: MarkerType.TIME_IN_SECONDS, threshold: 0 },
1683
- * { name: 'halfwayPoint', type: MarkerType.PERCENT, threshold: 0.5 }
1684
- * ]
1685
- *
1686
- * @example
1687
- * // Custom marker 15 seconds before end (e.g., for end credits overlay)
1688
- * markers: [
1689
- * { name: KnownMarkerName.PREROLL, type: MarkerType.TIME_IN_SECONDS, threshold: 0 },
1690
- * { name: 'showEndCreditsOverlay', type: MarkerType.TIME_IN_SECONDS, threshold: -15 }
1691
- * ]
1692
- *
1693
- * @defaultValue `[{ name: KnownMarkerName.PREROLL, type: MarkerType.TIME_IN_SECONDS, threshold: 0 }]`
1694
- */
1695
- markers?: (Marker | CustomMarker)[];
1696
- /**
1697
- * In which country can this media item be played (e.g. `['de', 'at']`)? Useful for
1698
- * JSON-LD generation.
1699
- *
1700
- * @defaultValue `['all']` (worldwide)
1701
- */
1702
- regionsAllowed?: string[];
1703
- /**
1704
- * Mark this media item as a recommendation.
1705
- */
1706
- isRecommendation?: boolean;
1707
- /**
1708
- * JSON-LD `contentUrl` that allows search engines to crawl the media source.
1709
- * You should only allow known crawlers ({@link https://developers.google.com/search/docs/crawling-indexing/verifying-googlebot?hl=en how to verify Googlebot & Crawler})
1710
- * to access those media sources.
1711
- */
1712
- seoContentUrl?: string;
1713
- /**
1714
- * Additional teaser options that improve the loading experience and enable additional
1715
- * integration variants.
1716
- */
1717
- teaser?: {
1718
- /** Image of the first frame of the media item. Used for initially showing the first frame of the media item. */
1719
- firstFrame?: string;
1720
- /** {@link https://blurha.sh/ Blurhash} of the first frame of the media item. Used for coloring the background. */
1721
- firstFrameBlurHash?: string | null;
1722
- /** Blurred version of the first frame of the media item. Used to show something early while loading. */
1723
- firstFrameBlurred?: string;
1724
- /** {@link https://blurha.sh/ Blurhash} of the poster of the media item. Used for coloring the background. */
1725
- posterBlurHash?: string | null;
1726
- /** Blurred version of the poster of the media item. Used to show something early while loading. */
1727
- posterBlurred?: string;
1728
- /** Teaser video URL which is used for previewing the media item for some integrations. */
1729
- video?: string;
1730
- };
1731
- /**
1732
- * Additional labels for this media item.
1733
- */
1734
- labels?: {
1735
- id: string;
1736
- name: string;
1737
- }[];
1738
- /** Genre of the media item (e.g. `Documentary`) */
1739
- genre?: string;
1740
- /**
1741
- * Editorial program type of the media item describing what kind of content it is.
1742
- *
1743
- * @example ProgramType.MOVIE
1744
- * @example ProgramType.SERIES
1745
- */
1746
- programType?: ProgramType | `${ProgramType}`;
1747
- /** Content owner id and name of the media item */
1748
- contentOwner?: {
1749
- id?: string;
1750
- name: string;
1751
- };
1752
- /**
1753
- * Additional details to show for the age rating (e.g. `['Alcohol']`) next to the minimum age.
1754
- */
1755
- ageRatingDetails?: string[];
1756
- /** Keywords of the media item */
1757
- keywords?: string[];
1758
- /** Logo of the media item in size 220x90 (e.g. for shows, movies, sports events etc.) */
1759
- logo?: string;
1760
- /** Alt text for the logo of the media item */
1761
- logoAltText?: string;
1762
- /** Accent color of the media item that is shown behind the logo */
1763
- logoAccentColor?: string;
1764
- /** Show (often referred to as series, format or tv-show) the media item belongs to */
1765
- show?: {
1766
- id?: string;
1767
- name: string;
1768
- episodeNumber?: number;
1769
- seasonNumber?: number;
1770
- };
1771
- /** Competition the media item belongs to */
1772
- competition?: {
1773
- id?: string;
1774
- name?: string;
1775
- };
1776
- /** Compilation the media item belongs to */
1777
- compilation?: {
1778
- id?: string;
1779
- name?: string;
1780
- };
1781
- /** The live on demand channel (livestream using a VoD playlist, often called ODC) the media item belongs to */
1782
- liveOnDemandChannel?: {
1783
- id?: string;
1784
- name?: string;
1785
- };
1786
- /** Category id and name of the media item */
1787
- category?: {
1788
- id?: string;
1789
- name: string;
1790
- };
1791
- /** Error information if the media item is not available upfront. */
1792
- error?: MediaItemError;
1793
- /**
1794
- * Internal definition of experiments.
1795
- * @ignore
1796
- */
1797
- experiments?: Experiment[];
1798
- /**
1799
- * Additional content branding
1800
- */
1801
- branding?: {
1802
- /** @ignore */
1803
- backgroundColor?: string;
1804
- /** @ignore */
1805
- cutInZoomAssetUrl?: string;
1806
- /** @ignore */
1807
- cutInZoomHideTimeout?: number;
1808
- /** Logo that should appear in the corner */
1809
- logoUrl?: string;
1810
- /** Optional link target for the logo */
1811
- logoLinkUrl?: string;
1812
- };
1813
- /** Livestream details */
1814
- livestream?: {
1815
- /** UTC start time of the livestream in milliseconds */
1816
- startTime: number;
1817
- /** UTC end time of the livestream in milliseconds */
1818
- endTime?: number;
1819
- /** EPG entries containing UTC start and end times in milliseconds. Can be used for timeshift functionality (e.g., jump markers within the DVR window).*/
1820
- epgEntries?: {
1821
- /** UTC start time of the livestream program in milliseconds */
1822
- startDate: number;
1823
- /** UTC end time of the livestream program in milliseconds */
1824
- endDate: number;
1825
- /** Show (series, format or program) name */
1826
- name: string;
1827
- /** Title of the livestream program */
1828
- title?: string;
1829
- /** Poster image URL of the livestream program */
1830
- poster?: string;
1831
- }[];
1832
- };
1833
- /**
1834
- * An additional API script definition that should be executed for this media-item.
1835
- * @ignore
1836
- */
1837
- apiScript?: ApiScript;
1838
- /**
1839
- * Indicates the source from which additional metadata was derived (e.g., "joyn").
1840
- */
1841
- metadataSource?: string;
1842
- /**
1843
- * Name of actors appearing in the given media item
1844
- *
1845
- * @example ["Cate Blanchett", "Leonardo DiCaprio"]
1846
- */
1847
- actors?: string[];
1848
- /**
1849
- * Links to related content (e.g., a news article or blog post).
1850
- */
1851
- links?: {
1852
- type: 'article';
1853
- url: string;
1854
- caption: string;
1855
- }[];
1856
- }
1857
-
1858
- /**
1859
- * Abstract definition of a media item web component that can be used as a child of the {@link IntegrationElement}.
1860
- *
1861
- * @example of a custom media item
1862
- *
1863
- * It is possible to create more complex media items that query an own API.
1864
- *
1865
- * ```html
1866
- * <script>
1867
- * class CustomMediaItemElement extends HTMLElement {
1868
- * get data() {
1869
- * return fetch(`https://api.example.com/media/${this.id}`)
1870
- * .then(response => response.json())
1871
- * .then((body) => ({
1872
- * id: this.id,
1873
- * provider: 'external',
1874
- * item: {
1875
- * id: this.id,
1876
- * sources: body.sources,
1877
- * duration: body.duration,
1878
- * poster: body.poster,
1879
- * title: body.title
1880
- * }
1881
- * }));
1882
- * }
1883
- * }
1884
- * window.customElements.define('custom-media-item', CustomMediaItemElement);
1885
- * </script>
1886
- * <glomex-integration
1887
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
1888
- * >
1889
- * <custom-media-item id="API_CONTENT_ID"></custom-media-item>
1890
- * </glomex-integration>
1891
- * ```
1892
- *
1893
- * @example of a custom media item that returns multiple items
1894
- *
1895
- * The `data` getter can also return an array of {@link MediaItemReference} objects
1896
- * to define a playlist from a single element.
1897
- *
1898
- * ```html
1899
- * <script>
1900
- * class CustomPlaylistElement extends HTMLElement {
1901
- * get data() {
1902
- * return fetch(`https://api.example.com/playlist/${this.id}`)
1903
- * .then(response => response.json())
1904
- * .then((body) => body.items.map((item) => ({
1905
- * id: item.id,
1906
- * provider: 'external',
1907
- * item: {
1908
- * id: item.id,
1909
- * sources: item.sources,
1910
- * duration: item.duration,
1911
- * poster: item.poster,
1912
- * title: item.title
1913
- * }
1914
- * })));
1915
- * }
1916
- * }
1917
- * window.customElements.define('custom-playlist', CustomPlaylistElement);
1918
- * </script>
1919
- * <glomex-integration
1920
- * integration-id="REPLACE_WITH_INTEGRATION_ID"
1921
- * >
1922
- * <custom-playlist id="API_PLAYLIST_ID"></custom-playlist>
1923
- * </glomex-integration>
1924
- * ```
1925
- */
1926
- export declare abstract class MediaItemElement extends HTMLElement {
1927
- /**
1928
- * The content ID used by the provider to look up the media item.
1929
- * For glomex, this can be a media ID or a playlist ID.
1930
- * For Joyn, this is a Joyn media ID.
1931
- * @attribute id
1932
- */
1933
- id: string;
1934
- /**
1935
- * The environment to use for the provider.
1936
- * @attribute {stage|prod} environment
1937
- * @defaultValue 'prod'
1938
- */
1939
- environment?: 'stage' | 'prod';
1940
- abstract get data(): MediaItemReference | MediaItemReference[] | Promise<MediaItemReference | MediaItemReference[]>;
1941
- }
1942
-
1943
- /**
1944
- * Error known before the media item gets loaded.
1945
- */
1946
- export declare class MediaItemError extends BaseMediaError<MediaItemErrorCode> {
1947
- name: string;
1948
- }
1949
-
1950
- export declare enum MediaItemErrorCode {
1951
- NOT_FOUND = "NotFound",
1952
- NOT_AVAILABLE = "NotAvailable",
1953
- GEOBLOCKED = "Geoblocked",
1954
- YOUTH_PROTECTED = "YouthProtected",
1955
- TERMINATED = "Terminated",
1956
- EXPIRED = "Expired",
1957
- LOGIN_REQUIRED = "LoginRequired",
1958
- HIGHER_TIER_ACCOUNT_REQUIRED = "HigherTierAccountRequired",
1959
- VPN_DETECTED = "VpnDetected",
1960
- AGE_VERIFICATION_REQUIRED = "AgeVerificationRequired",
1961
- PIN_REQUIRED = "PinRequired",
1962
- INVALID_PIN = "InvalidPin",
1963
- GENERIC = "Generic"
1964
- }
1965
-
1966
- export declare enum MediaItemProvider {
1967
- /** Content from glomex */
1968
- GLOMEX = "glomex",
1969
- /** Content from joyn */
1970
- JOYN = "joyn",
1971
- /** External content provided directly */
1972
- EXTERNAL = "external"
1973
- }
1974
-
1975
- /**
1976
- * Describes how to fetch a media item from a given provider.
1977
- *
1978
- * The provider resolves the media item by its {@link id}. When an {@link item}
1979
- * is supplied, its properties are merged on top of the fetched result, allowing
1980
- * callers to override individual fields such as `title` or `poster`.
1981
- */
1982
- export declare interface MediaItemReference {
1983
- /** Media item ID used by the provider to look up the content. */
1984
- id: string;
1985
- /** Provider that is responsible for resolving this media item. */
1986
- provider: MediaItemProvider | `${MediaItemProvider}`;
1987
- /**
1988
- * Target environment for the provider request.
1989
- * @defaultValue 'prod'
1990
- */
1991
- environment?: 'stage' | 'prod';
1992
- /**
1993
- * Optional partial media item whose properties are merged on top of the
1994
- * data returned by the provider, allowing individual fields to be overridden.
1995
- *
1996
- * **Required** when the provider is `external`, since there is no remote
1997
- * source to fetch the media item from.
1998
- */
1999
- item?: MediaItem;
2000
- /** Whether to observe stream termination independent of business model. */
2001
- forceObserveTermination?: boolean;
2002
- }
2003
-
2004
- /**
2005
- * Represents a {@link MediaItem} after it has been resolved by the player.
2006
- *
2007
- * When a {@link MediaItem} is passed to the player, it is expanded into a
2008
- * `MediaItemResolved`: fields that were omitted receive sensible defaults
2009
- * (e.g. `id`, `language`, `aspectRatio`), and additional fields such as
2010
- * `originalId`, `provider`, and `ppsj` are derived automatically.
2011
- *
2012
- * As a result, several properties that are optional on {@link MediaItem}
2013
- * become required here.
2014
- */
2015
- export declare interface MediaItemResolved extends Omit<MediaItem, 'id' | 'sources' | 'title' | 'regionsAllowed' | 'aspectRatio' | 'minimumAge' | 'iabCategoryTaxonomy' | 'language'> {
2016
- id: NonNullable<MediaItem['id']>;
2017
- sources: (SourceMediaItem & {
2018
- id: string;
2019
- mimetype: Mimetype;
2020
- })[];
2021
- title: NonNullable<MediaItem['title']>;
2022
- regionsAllowed: NonNullable<MediaItem['regionsAllowed']>;
2023
- /**
2024
- * An internal marker for the used playlist. It is automatically filled.
2025
- * @ignore
2026
- */
2027
- playlistId: string;
2028
- aspectRatio: NonNullable<MediaItem['aspectRatio']>;
2029
- minimumAge: NonNullable<MediaItem['minimumAge']>;
2030
- iabCategoryTaxonomy: NonNullable<MediaItem['iabCategoryTaxonomy']>;
2031
- language: NonNullable<MediaItem['language']>;
2032
- /**
2033
- * Mark this media item to allow teaser experiments.
2034
- * @ignore
2035
- */
2036
- allowTeaserExperiments: boolean;
2037
- /**
2038
- * Will be automatically filled based on {@link MediaItem#minimumAge} and {@link MediaItem#iabCategories}.
2039
- * @ignore
2040
- */
2041
- ppsj?: string;
2042
- /**
2043
- * Indicates the provider of the media item.
2044
- */
2045
- provider: MediaItemProvider | `${MediaItemProvider}`;
2046
- /**
2047
- * The original {@link MediaItemReference} that produced this resolved item.
2048
- * Preserved so that re-resolution (e.g. playlist-item updates) can pass it
2049
- * back to the provider.
2050
- *
2051
- * @ignore
2052
- */
2053
- _referenceItem?: MediaItemReference;
2054
- }
2055
-
2056
- /**
2057
- * Text track definition for a media item.
2058
- * Based on {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLTrackElement | HTMLTrackElement}.
2059
- */
2060
- export declare interface MediaItemTextTrack {
2061
- /**
2062
- * Unique identifier for the track.
2063
- */
2064
- id?: string;
2065
- /**
2066
- * The kind of text track.
2067
- */
2068
- kind: 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata';
2069
- /**
2070
- * URL of the track file (e.g., WebVTT file).
2071
- */
2072
- src: string;
2073
- /**
2074
- * Language of the track text data (BCP 47 language tag).
2075
- */
2076
- srclang: string;
2077
- /**
2078
- * Human-readable title of the track.
2079
- */
2080
- label: string;
2081
- /**
2082
- * Whether the track should be enabled by default.
2083
- */
2084
- default?: boolean;
2085
- }
2086
-
2087
- /**
2088
- * Network error when a request fails due to connectivity issues.
2089
- * Shaka Player network errors have codes in the 1000-1999 range
2090
- * while HTMLMediaElement errors with 2 and 4 are considered network errors.
2091
- */
2092
- export declare class MediaNetworkError extends BaseMediaError {
2093
- name: string;
2094
- }
2095
-
2096
- /**
2097
- * Error after loading the media item.
2098
- */
2099
- export declare class MediaPlaybackError extends BaseMediaError {
2100
- name: string;
2101
- }
2102
-
2103
- /**
2104
- * Context object returned by a media-provider resolver registered via
2105
- * {@link SharedContextData.providers}.
2106
- *
2107
- * Only {@link token} is required. Additional provider-specific fields
2108
- * (e.g. subscription state, user ID) can be added freely.
2109
- */
2110
- export declare interface MediaProviderContext {
2111
- /** Authentication token (should be fresh / handle refresh internally). */
2112
- token: string;
2113
- /** Any additional provider-specific fields. */
2114
- [key: string]: unknown;
2115
- }
2116
-
2117
- /**
2118
- * Error while fetching metadata of the media item.
2119
- */
2120
- export declare class MediaProviderError extends BaseMediaError<MediaProviderErrorCode> {
2121
- name: string;
2122
- }
2123
-
2124
- export declare enum MediaProviderErrorCode {
2125
- NOT_FOUND = "NotFound",
2126
- FORBIDDEN = "Forbidden",
2127
- HIDDEN = "Hidden",
2128
- NO_CONTENT = "NoContent",
2129
- GENERIC = "Generic"
2130
- }
2131
-
2132
- /**
2133
- * @deprecated Use {@link SourceMediaItem} instead.
2134
- */
2135
- declare type MediaSource_2 = SourceMediaItem;
2136
- export { MediaSource_2 as MediaSource }
2137
-
2138
- /**
2139
- * Base interface for all media track types.
2140
- * Provides common properties shared by audio, video, and text tracks.
2141
- */
2142
- declare interface MediaTrack {
2143
- /** Unique identifier for the track. */
2144
- id: string;
2145
- /** The type or category of the track. */
2146
- kind: string;
2147
- /** Human-readable label for the track. */
2148
- label: string;
2149
- /** BCP 47 language tag (e.g., "en", "de", "es"). */
2150
- language: string;
2151
- }
2152
-
2153
- /**
2154
- * Base interface for track list collections.
2155
- * Extends EventTarget to support track change events and is iterable.
2156
- *
2157
- * @typeParam T - The specific track type this list contains.
2158
- */
2159
- declare interface MediaTrackList<T extends MediaTrack> extends EventTarget, Iterable<T> {
2160
- /** The number of tracks in the list. */
2161
- readonly length: number;
2162
- /**
2163
- * Returns the track with the specified ID.
2164
- * @param id - The track ID to search for.
2165
- * @returns The matching track, or `null` if not found.
2166
- */
2167
- getTrackById(id: string): T | null;
2168
- /**
2169
- * Adds an event listener for track list changes.
2170
- * @param type - The event type: `'trackschange'` (track list changed) or `'change'` (selection changed).
2171
- * @param listener - The callback function.
2172
- * @param options - Optional event listener options.
2173
- */
2174
- addEventListener(type: 'trackschange' | 'change', listener: EventListener, options?: boolean | AddEventListenerOptions): void;
2175
- }
2176
-
2177
- export declare enum Mimetype {
2178
- HLS = "application/vnd.apple.mpegurl",
2179
- HLS_LEGACY = "application/x-mpegURL",
2180
- DASH = "application/dash+xml",
2181
- MP4 = "video/mp4",
2182
- OGG = "video/ogg",
2183
- WEBM = "video/webm",
2184
- MP3 = "audio/mp3",
2185
- AAC = "audio/aac",
2186
- WAV = "audio/wav",
2187
- OGG_AUDIO = "audio/ogg",
2188
- MPEG_AUDIO = "audio/mpeg",
2189
- DYNAMIC_CONTENT = "application/x-turbo-dynamic-content",
2190
- JOYN = "application/x-joyn-source"
2191
- }
2192
-
2193
- /**
2194
- * Normalizes a {@link MediaItem} or {@link MediaItemReference} into a
2195
- * {@link MediaItemReference}.
2196
- *
2197
- * @ignore
2198
- *
2199
- * If the input already has a `provider` it is returned as-is.
2200
- * Otherwise the provider is detected from the media item's sources
2201
- * (Joyn when a source with {@link Mimetype.JOYN} is present, external otherwise).
2202
- */
2203
- export declare function normalizeMediaItem(input: MediaItemReference | MediaItem): MediaItemReference;
2204
-
2205
- export declare interface Page {
2206
- url: string;
2207
- searchParams: Record<string, string>;
2208
- utm?: {
2209
- source?: string;
2210
- medium?: string;
2211
- campaign?: string;
2212
- content?: string;
2213
- term?: string;
2214
- };
2215
- apexDomain: string;
2216
- hostname: string;
2217
- pathSegment1?: string;
2218
- pathSegment2?: string;
2219
- pathSegment3?: string;
2220
- referrer: string;
2221
- }
2222
-
2223
- export declare enum PlaybackMode {
2224
- LIVE = "live",
2225
- VOD = "vod",
2226
- INTERACTIVE = "interactive",
2227
- EMBED = "embed"
2228
- }
2229
-
2230
- export declare enum PresentationMode {
2231
- HIDDEN = "hidden",
2232
- INLINE = "inline",
2233
- DOCK = "dock",
2234
- LIGHTBOX = "lightbox",
2235
- LIGHTBOX_EXTERNAL = "lightbox-external",
2236
- FULLSCREEN = "fullscreen",
2237
- AMP_DOCK = "amp-dock"
2238
- }
2239
-
2240
- /**
2241
- * Editorial classification of the media item describing what type of program it is.
2242
- */
2243
- export declare enum ProgramType {
2244
- COMPILATION = "compilation",
2245
- CLIP = "clip",
2246
- INTERACTIVE = "interactive",
2247
- LIVE_ON_DEMAND = "live-on-demand",
2248
- LIVE = "live",
2249
- MOVIE = "movie",
2250
- SERIES = "series",
2251
- SPORTS_MATCH = "sports-match",
2252
- TRAILER = "trailer"
2253
- }
2254
-
2255
- export declare enum ScriptType {
2256
- INTEGRATION_CONFIGS = "application/integration-configs+json",
2257
- /** @deprecated Use {@link ScriptType.INTEGRATION_CONFIGS} instead. */
2258
- INTEGRATION_CONFIGS_LEGACY = "application/glomex-integration-configs+json",
2259
- EXTERNAL_MEDIA_ITEM = "application/external-media-item+json",
2260
- /** @deprecated Use {@link ScriptType.EXTERNAL_MEDIA_ITEM} instead. */
2261
- EXTERNAL_MEDIA_ITEM_LEGACY = "application/glomex-external-media-item+json"
2262
- }
2263
-
2264
- /**
2265
- * Represents the seekable range of the media.
2266
- * For VoD content, this typically represents the full duration (0 to duration).
2267
- * For live streams, this represents the DVR window that can be seeked to.
2268
- */
2269
- export declare interface SeekRange {
2270
- /** The start time of the seekable range in seconds, or undefined if not yet available */
2271
- start?: number;
2272
- /** The end time of the seekable range in seconds, or undefined if not yet available */
2273
- end?: number;
2274
- }
2275
-
2276
- /**
2277
- * A global context singleton shared by every `<glomex-integration>` instance
2278
- * on the page.
2279
- *
2280
- * @example JavaScript (dynamic import)
2281
- * ```ts
2282
- * const { sharedContext } = await import('https://player.glomex.com/integration/1/integration.js');
2283
- *
2284
- * sharedContext.set({
2285
- * appVersion: '2.3.0',
2286
- * appName: 'my-app',
2287
- * deviceId: { id: '...', name: 'idfa' },
2288
- * userIds: async () => await cmp.getConsentedUserIds(),
2289
- * providers: {
2290
- * 'my-provider': async () => ({
2291
- * token: await myAuth.getFreshToken(),
2292
- * }),
2293
- * },
2294
- * });
2295
- * ```
2296
- *
2297
- * @example React
2298
- * ```tsx
2299
- * import { getSharedContext } from '@glomex/integration-react';
2300
- * import { useEffect } from 'react';
2301
- *
2302
- * function App() {
2303
- * useEffect(() => {
2304
- * async function setup() {
2305
- * const sharedContext = await getSharedContext();
2306
- * sharedContext.set({
2307
- * appVersion: '2.3.0',
2308
- * appName: 'my-app',
2309
- * deviceId: { id: '...', name: 'idfa' },
2310
- * userIds: async () => await cmp.getConsentedUserIds(),
2311
- * providers: {
2312
- * 'my-provider': async () => ({
2313
- * token: await myAuth.getFreshToken(),
2314
- * }),
2315
- * },
2316
- * });
2317
- * }
2318
- * setup();
2319
- * }, []);
2320
- * }
2321
- * ```
2322
- */
2323
- export declare interface SharedContext {
2324
- /**
2325
- * Merge context data into the shared context.
2326
- *
2327
- * - Provider resolvers under `providers` are merged individually —
2328
- * only the specified providers are replaced, others are kept.
2329
- * - Calling `set()` multiple times merges incrementally.
2330
- */
2331
- set(data: SharedContextData): void;
2332
- }
2333
-
2334
- /**
2335
- * Module-level singleton shared by every `<glomex-integration>` instance on
2336
- * the page.
2337
- *
2338
- * Publishers obtain it via dynamic import of `integration.js` to ensure they
2339
- * get the same singleton instance as the running player:
2340
- *
2341
- * ```ts
2342
- * const { sharedContext } = await import('https://player.glomex.com/integration/1/integration.js');
2343
- * ```
2344
- *
2345
- * When using the React wrapper, use {@link https://www.npmjs.com/package/@glomex/integration-react @glomex/integration-react} instead:
2346
- *
2347
- * ```ts
2348
- * import { getSharedContext } from '@glomex/integration-react';
2349
- *
2350
- * const sharedContext = await getSharedContext();
2351
- * ```
2352
- */
2353
- export declare const sharedContext: SharedContext;
2354
-
2355
- /**
2356
- * The data object accepted by {@link SharedContext.set}.
2357
- *
2358
- * Every field is optional and merged on top of previously set values.
2359
- * Calling `set()` multiple times merges incrementally — previously set
2360
- * values are preserved unless explicitly overwritten.
2361
- */
2362
- export declare interface SharedContextData {
2363
- /**
2364
- * The presentational context of the integration.
2365
- * Do not define it when it is not part of those contexts.
2366
- */
2367
- presentationalContext?: 'curated-list' | 'discovery-page';
2368
- /**
2369
- * The version of the app.
2370
- * When it is a website, fill in the deployed version of the website.
2371
- */
2372
- appVersion?: string;
2373
- /**
2374
- * The name of the app.
2375
- * When it is a website, fill in the name of the project.
2376
- */
2377
- appName?: string;
2378
- /**
2379
- * The bundle id of the app. Only required for iOS apps.
2380
- */
2381
- appBundleId?: string;
2382
- /**
2383
- * The store id of the app. Only required for apps.
2384
- * Depending on the app store, the id is formatted differently.
2385
- *
2386
- * {@link https://iabtechlab.com/wp-content/uploads/2020/08/IAB-Tech-Lab-OTT-store-assigned-App-Identification-Guidelines-2020.pdf IAB Tech Lab App Identification Guidelines}
2387
- */
2388
- appStoreId?: string;
2389
- /**
2390
- * The store URL of the app. Only required for apps.
2391
- *
2392
- * {@link https://iabtechlab.com/wp-content/uploads/2020/08/IAB-Tech-Lab-OTT-store-assigned-App-Identification-Guidelines-2020.pdf IAB Tech Lab App Identification Guidelines}
2393
- */
2394
- appStoreUrl?: string;
2395
- /** Business-to-business context identifier. */
2396
- b2bContext?: string;
2397
- /**
2398
- * Device id of the user. Only required for app environments.
2399
- * When no listed deviceId is available, you can pass a ppid as a user id instead.
2400
- */
2401
- deviceId?: {
2402
- id: string;
2403
- name: DeviceIdName | `${DeviceIdName}`;
2404
- };
2405
- /**
2406
- * Identifiers for the current user (e.g. netID, LiveRamp, PAIR).
2407
- *
2408
- * You can pass either a **static array** or a **resolver function**.
2409
- * A resolver is re-invoked every time the player needs user IDs
2410
- * (for example before each ad request), so it can return a different
2411
- * set of IDs when the user's consent state has changed.
2412
- * The resolver may be asynchronous.
2413
- *
2414
- * @example Static array
2415
- * ```ts
2416
- * sharedContext.set({
2417
- * userIds: [{ id: '...', name: 'netId' }],
2418
- * });
2419
- * ```
2420
- *
2421
- * @example Async resolver (re-evaluated on every ad request)
2422
- * ```ts
2423
- * sharedContext.set({
2424
- * userIds: async () => await cmp.getConsentedUserIds(),
2425
- * });
2426
- * ```
2427
- */
2428
- userIds?: {
2429
- id: string;
2430
- name: UserIdName | `${UserIdName}`;
2431
- ext?: Record<string, unknown>;
2432
- }[] | (() => {
2433
- id: string;
2434
- name: UserIdName | `${UserIdName}`;
2435
- ext?: Record<string, unknown>;
2436
- }[] | Promise<{
2437
- id: string;
2438
- name: UserIdName | `${UserIdName}`;
2439
- ext?: Record<string, unknown>;
2440
- }[]>);
2441
- /**
2442
- * Media-provider-specific context resolvers keyed by provider name.
2443
- *
2444
- * Each resolver is called every time the player needs fresh context for
2445
- * the given provider (e.g. to obtain a fresh auth token).
2446
- *
2447
- * @example
2448
- * ```ts
2449
- * sharedContext.set({
2450
- * providers: {
2451
- * 'my-provider': async () => ({
2452
- * token: await myAuth.getFreshToken(),
2453
- * }),
2454
- * },
2455
- * });
2456
- * ```
2457
- */
2458
- providers?: {
2459
- [providerName: string]: (context?: {
2460
- environment?: string;
2461
- }) => MediaProviderContext | Promise<MediaProviderContext>;
2462
- };
2463
- }
2464
-
2465
- export declare type SourceMediaItem = SourceMediaItemBase | SourceMediaItemDrm | SourceMediaItemJoyn;
2466
-
2467
- export declare interface SourceMediaItemBase {
2468
- /**
2469
- * Unique identifier of the media source.
2470
- *
2471
- * @defaultValue `V1StGXR8_Z5jdHi6B-myT` a generated identifier
2472
- */
2473
- id?: string;
2474
- /**
2475
- * Mimetype of the media source.
2476
- *
2477
- * @defaultValue detected from file extension of given {@link src} or `undefined`
2478
- */
2479
- mimetype?: Mimetype;
2480
- /**
2481
- * The source URL of this media source.
2482
- */
2483
- src: string;
2484
- /**
2485
- * Until the media source is valid. Unix timestamp in milliseconds.
2486
- */
2487
- validUntil?: number;
2488
- /**
2489
- * Content mode of the media source.
2490
- *
2491
- * @defaultValue `PlaybackMode.VOD`
2492
- */
2493
- playbackMode?: PlaybackMode;
2494
- /**
2495
- * When `true`, playback must always remain at the live edge.
2496
- * Seeking behind the live edge is not permitted.
2497
- *
2498
- * @defaultValue `undefined` (treated as `false` — timeshift / seek-back is allowed)
2499
- */
2500
- liveEdgeOnly?: boolean;
2501
- /**
2502
- * Classification of the user's access level for this source.
2503
- *
2504
- * @defaultValue `undefined` (user tier is unknown or not applicable)
2505
- */
2506
- userTier?: UserTier;
2507
- /**
2508
- * Duration in seconds. Only relevant for dynamic content.
2509
- */
2510
- duration?: number;
2511
- }
2512
-
2513
- export declare interface SourceMediaItemDrm extends SourceMediaItemBase {
2514
- /**
2515
- * The DRM system this source requires.
2516
- */
2517
- drmSystem: DrmSystem;
2518
- /**
2519
- * DRM token to include in license requests for the selected DRM system.
2520
- */
2521
- token?: string;
2522
- /**
2523
- * License server URL for the selected DRM system.
2524
- */
2525
- licenseUrl: string;
2526
- /**
2527
- * Certificate URL (relevant for FairPlay).
2528
- */
2529
- certificateUrl?: string;
2530
- }
2531
-
2532
- export declare interface SourceMediaItemJoyn {
2533
- /**
2534
- * Media / asset identifier of joyn.
2535
- */
2536
- id: string;
2537
- mimetype: Mimetype.JOYN;
2538
- /**
2539
- * User token used for authentication.
2540
- */
2541
- token: string;
2542
- /**
2543
- * Allowing to enforce stage environment.
2544
- * @deprecated Use {@link MediaItemReference.environment} instead.
2545
- */
2546
- environment?: 'stg';
2547
- /** {@inheritDoc SourceMediaItemBase.playbackMode} */
2548
- playbackMode?: PlaybackMode;
2549
- }
2550
-
2551
- /**
2552
- * Source metadata that may differ per provider.
2553
- *
2554
- * Available on {@link SourceSelected.metadata}. Narrow with
2555
- * `metadata.provider === 'joyn'` to access {@link JoynSourceMetadata} fields.
2556
- */
2557
- export declare type SourceMetadata = JoynSourceMetadata;
2558
-
2559
- /**
2560
- * Base metadata for providers that don't have a dedicated interface.
2561
- */
2562
- declare interface SourceMetadataBase {
2563
- /** Identifies which provider produced this metadata. */
2564
- provider: string;
2565
- }
2566
-
2567
- /**
2568
- * Metadata of the source that was selected for playback.
2569
- */
2570
- export declare interface SourceSelected {
2571
- /** Unique identifier of the source. */
2572
- id: string;
2573
- /** MIME type of the media source (e.g. HLS, DASH, MP4). */
2574
- mimetype: Mimetype;
2575
- /** URL of the media source. */
2576
- src: string;
2577
- /** Playback mode indicating how the content should be played. */
2578
- playbackMode?: PlaybackMode;
2579
- /** DRM system used to protect the source, if any. */
2580
- drmSystem?: DrmSystem;
2581
- /**
2582
- * When `true`, playback always remains at the live edge.
2583
- * Seeking behind the live edge is not permitted.
2584
- */
2585
- liveEdgeOnly?: boolean;
2586
- /**
2587
- * Classification of the user's tier for this source.
2588
- *
2589
- * `undefined` means the user tier is unknown or not applicable.
2590
- */
2591
- userTier?: UserTier;
2592
- /** Provider-generated metadata for this source. */
2593
- metadata?: SourceMetadata;
2594
- }
2595
-
2596
- export declare enum StartMethod {
2597
- /** Autoplay occured for above the fold content */
2598
- PRE_CLICK = "pre-click-to-play",
2599
- /** Playback started with click */
2600
- CLICK = "click-to-play",
2601
- /** Autoplay started when scrolling into view */
2602
- AUTOPLAY_SCROLL = "autoplay-scroll",
2603
- /** Autoplay started when scrolling out of view, player was docked */
2604
- AUTOPLAY_SCROLL_OUT = "autoplay-scroll-out",
2605
- /** Playback of next video started with click */
2606
- CLICK_NEXT = "click-to-play-next",
2607
- /** Replay of current video started with click */
2608
- CLICK_REPLAY = "click-to-play-replay",
2609
- /** Autoplay of next video */
2610
- AUTOPLAY_NEXT = "autoplay-next"
2611
- }
2612
-
2613
- /** Runtime environment for resolving tenant endpoints. */
2614
- declare type TenantEnvironment = 'prod' | 'stage' | 'local';
2615
-
2616
- /**
2617
- * Represents a text track (subtitles, captions, etc.).
2618
- */
2619
- declare interface TextTrack_2 extends MediaTrack {
2620
- /** The type of text track. */
2621
- kind: 'subtitles' | 'captions' | 'descriptions' | 'chapters';
2622
- /**
2623
- * The current display mode of the track.
2624
- * - `'disabled'`: Track is not active.
2625
- * - `'hidden'`: Track is active but not displayed (for programmatic access).
2626
- * - `'showing'`: Track is active and displayed to the user.
2627
- */
2628
- mode: 'disabled' | 'hidden' | 'showing';
2629
- }
2630
- export { TextTrack_2 as TextTrack }
2631
-
2632
- /**
2633
- * A collection of text tracks with selection support.
2634
- * Text tracks can be deselected by passing `undefined` to `select()`.
2635
- *
2636
- * **Note:** Text tracks are available after the {@link IntegrationElement.ready | integration.ready} promise resolves.
2637
- *
2638
- * The list is iterable and can be converted to an array:
2639
- * @example
2640
- * ```ts
2641
- * for (const track of integration.textTracks) { console.log(track); }
2642
- * const tracks = Array.from(integration.textTracks);
2643
- * ```
2644
- */
2645
- declare interface TextTrackList_2 extends MediaTrackList<TextTrack_2> {
2646
- /** The currently selected text track, or `null` if none is selected. */
2647
- readonly selected: TextTrack_2 | null;
2648
- /**
2649
- * Selects a text track or disables text tracks.
2650
- * @param trackOrId - The track, track ID, or `undefined` to disable all text tracks.
2651
- */
2652
- select(trackOrId: TextTrack_2 | string | undefined): void;
2653
- }
2654
- export { TextTrackList_2 as TextTrackList }
2655
-
2656
- /**
2657
- * A multi-tenant integration custom element that automatically determines
2658
- * the correct tenant from the domain the script was loaded from.
2659
- *
2660
- * When the integration bundle is served from `player.joyn.de` the tenant
2661
- * resolves to `"joyn"`; when served from `player.glomex.com` it resolves
2662
- * to `"glomex"`, and so on. The mapping is driven by the `domains` list
2663
- * in each tenant configuration (see `@glomex/turbo-shared-types`).
2664
- *
2665
- * For **local development** the tenant can still be overridden via the
2666
- * `tenant` HTML attribute / DOM property so that developers can test any
2667
- * tenant without deploying to the corresponding CDN.
2668
- *
2669
- * > The legacy `<glomex-integration>` element is kept for backwards
2670
- * > compatibility. New tenants should use `<turbo-integration>`.
2671
- *
2672
- * @tagname turbo-integration
2673
- *
2674
- * @example Basic usage (tenant is auto-detected from the script URL)
2675
- *
2676
- * ```html
2677
- * <turbo-integration
2678
- * integration-id="joyn-vod"
2679
- * >
2680
- * <joyn-media-item id="MEDIA_ID"></joyn-media-item>
2681
- * </turbo-integration>
2682
- * ```
2683
- *
2684
- * @example Override tenant for local development
2685
- *
2686
- * ```html
2687
- * <turbo-integration
2688
- * integration-id="joyn-vod"
2689
- * tenant="joyn"
2690
- * ></turbo-integration>
2691
- * ```
2692
- */
2693
- export declare class TurboIntegrationElement extends IntegrationElement {
2694
- constructor();
2695
- }
2696
-
2697
- /**
2698
- * Properties for the `<turbo-integration>` custom element.
2699
- *
2700
- * Identical to {@link IntegrationProperties}. The `tenant` is normally
2701
- * auto-detected from the domain the integration script was loaded from,
2702
- * but can be overridden for local development.
2703
- */
2704
- export declare type TurboIntegrationProperties = IntegrationProperties;
2705
-
2706
- declare type UiAction = (typeof ALLOWED_UI_ACTIONS)[number];
2707
-
2708
- /**
2709
- * Identifier names for user IDs that can be passed via {@link SharedContextData.userIds}.
2710
- */
2711
- export declare enum UserIdName {
2712
- /** {@link https://netid.de netID} — European login alliance ID */
2713
- NET_ID = "netId",
2714
- /** Publisher Provided ID */
2715
- PPID = "ppid",
2716
- /** {@link https://utiq.com Utiq} — telco-based advertising ID */
2717
- UTIQ_ID = "utiqId",
2718
- /** {@link https://liveramp.com LiveRamp} — identity resolution ID */
2719
- LIVERAMP_ID = "liverampId",
2720
- /** {@link https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/pair Google PAIR} — Publisher Advertiser Identity Reconciliation ID */
2721
- PAIR_ID = "pairId",
2722
- /** {@link https://liveramp.com LiveRamp} — Authenticated Traffic Solution (ATS) direct encrypted identity envelope */
2723
- ATS_DIRECT = "atsDirect"
2724
- }
2725
-
2726
- /**
2727
- * Classification of the user's tier.
2728
- */
2729
- export declare enum UserTier {
2730
- ANONYMOUS = "anonymous",
2731
- REGISTERED = "registered",
2732
- PAID = "paid"
2733
- }
2734
-
2735
- /**
2736
- * Represents a video track (quality variant).
2737
- */
2738
- export declare interface VideoTrack {
2739
- /** Unique identifier for the track. */
2740
- id: string;
2741
- /**
2742
- * The type of video track.
2743
- * - `'variant'`: A specific quality level.
2744
- * - `'auto'`: Synthetic track representing automatic quality selection (ABR).
2745
- */
2746
- kind: 'variant' | 'auto';
2747
- /** Human-readable label (e.g., "1080p (6.2 Mbps)"). */
2748
- label: string;
2749
- /** Bitrate in bits per second. */
2750
- bandwidth: number;
2751
- /** Video width in pixels. */
2752
- width?: number;
2753
- /** Video height in pixels. */
2754
- height?: number;
2755
- }
2756
-
2757
- /**
2758
- * A collection of video tracks with selection support.
2759
- * May be empty or only synthetic when native track info is unavailable.
2760
- *
2761
- * **Note:** Video tracks are available after the {@link IntegrationElement.ready | integration.ready} promise resolves.
2762
- *
2763
- * The list is iterable and can be converted to an array:
2764
- * @example
2765
- * ```ts
2766
- * for (const track of integration.videoTracks) { console.log(track); }
2767
- * const tracks = Array.from(integration.videoTracks);
2768
- * ```
2769
- */
2770
- export declare interface VideoTrackList extends EventTarget, Iterable<VideoTrack> {
2771
- /** The number of tracks in the list. */
2772
- readonly length: number;
2773
- /**
2774
- * Returns the track with the specified ID.
2775
- * @param id - The track ID to search for.
2776
- * @returns The matching track, or `null` if not found.
2777
- */
2778
- getTrackById(id: string): VideoTrack | null;
2779
- /** The currently selected video track, or `null` if unavailable. */
2780
- readonly selected: VideoTrack | null;
2781
- /**
2782
- * Selects a video track or enables automatic quality selection.
2783
- * @param trackOrId - The track, track ID, or `'auto'` for ABR.
2784
- */
2785
- select(trackOrId: VideoTrack | string): void;
2786
- /**
2787
- * Adds an event listener for track list changes.
2788
- * @param type - The event type: `'trackschange'` (track list changed) or `'change'` (selection changed).
2789
- * @param listener - The callback function.
2790
- * @param options - Optional event listener options.
2791
- */
2792
- addEventListener(type: 'trackschange' | 'change', listener: EventListener, options?: boolean | AddEventListenerOptions): void;
2793
- }
2794
-
2795
- export { }
2796
-
2797
- declare global {
2798
- interface HTMLElementTagNameMap {
2799
- [ComponentName.INTEGRATION]: IntegrationElement;
2800
- [ComponentName.GLOMEX_MEDIA_ITEM]: GlomexMediaItemElement;
2801
- [ComponentName.JOYN_MEDIA_ITEM]: JoynMediaItemElement;
2802
- [ComponentName.EXTERNAL_MEDIA_ITEM]: ExternalMediaItemElement;
2803
- }
2804
- interface HTMLElementEventMap extends IntegrationElementEventMap {}
2805
- }
1
+ export * from '@turbo-player/integration-web-component';
2
+ import type { SharedContext } from '@turbo-player/integration-web-component';
3
+ import { ComponentName as BaseComponentName } from '@turbo-player/integration-web-component';
4
+ export declare const ComponentName: {
5
+ readonly INTEGRATION: "glomex-integration";
6
+ readonly EXTERNAL_MEDIA_ITEM: BaseComponentName.EXTERNAL_MEDIA_ITEM;
7
+ readonly GLOMEX_MEDIA_ITEM: BaseComponentName.GLOMEX_MEDIA_ITEM;
8
+ readonly JOYN_MEDIA_ITEM: BaseComponentName.JOYN_MEDIA_ITEM;
9
+ };
10
+ /** Returns the CSS URL for a given integration */
11
+ export declare function getIntegrationCssUrl(integrationId: string): string;
12
+ /** Returns the custom element name. */
13
+ export declare function getIntegrationComponentName(): string;
14
+ /**
15
+ * Loads the integration custom element by injecting the script into the document.
16
+ * Does nothing if the element is already defined.
17
+ */
18
+ export declare function loadIntegrationComponent(): void;
19
+ /**
20
+ * Loads the variant CSS for the given integration ID by injecting a
21
+ * `<link>` element into the document head. Does nothing if the stylesheet
22
+ * is already loaded.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * import { loadIntegrationStyles } from '@glomex/integration-web-component';
27
+ *
28
+ * loadIntegrationStyles('your-integration-id');
29
+ * ```
30
+ */
31
+ export declare function loadIntegrationStyles(integrationId: string, doc?: Document | ShadowRoot): void;
32
+ /**
33
+ * Returns the {@link SharedContext} singleton from the loaded integration.
34
+ *
35
+ * Waits for the integration custom element to be defined, then
36
+ * reads the singleton from its static property — guaranteeing the same
37
+ * instance that the running player uses.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * import { getSharedContext } from '@glomex/integration-web-component';
42
+ *
43
+ * const sharedContext = await getSharedContext();
44
+ * sharedContext.set({
45
+ * appVersion: '2.3.0',
46
+ * providers: {
47
+ * 'my-provider': async () => ({ token: await myAuth.getFreshToken() }),
48
+ * }
49
+ * });
50
+ * ```
51
+ */
52
+ export declare function getSharedContext(): Promise<SharedContext>;