@devix-technologies/react-gjirafa-vp-player 1.0.29 → 1.0.31-beta.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.
Files changed (43) hide show
  1. package/README.md +95 -707
  2. package/dist/index.d.ts +897 -9
  3. package/dist/react-gjirafa-vp-player.es.js +1183 -1289
  4. package/dist/react-gjirafa-vp-player.umd.js +12 -11
  5. package/package.json +8 -11
  6. package/dist/App.d.ts +0 -2
  7. package/dist/components/Feedback.d.ts +0 -25
  8. package/dist/components/VPPlayer/index.d.ts +0 -2
  9. package/dist/components/VPPlayer/ui/index.d.ts +0 -1
  10. package/dist/components/VPPlayer/ui/styled.d.ts +0 -42
  11. package/dist/config/index.d.ts +0 -1
  12. package/dist/config/vpPlayerConfig.d.ts +0 -9
  13. package/dist/constants/configs.d.ts +0 -22
  14. package/dist/constants/index.d.ts +0 -1
  15. package/dist/constants/storybook.d.ts +0 -9
  16. package/dist/constants/styles.d.ts +0 -11
  17. package/dist/constants/urls.d.ts +0 -18
  18. package/dist/constants/vpPlayer.d.ts +0 -47
  19. package/dist/contexts/VPPlayerContext.d.ts +0 -52
  20. package/dist/contexts/index.d.ts +0 -1
  21. package/dist/features/VPPlayer.d.ts +0 -41
  22. package/dist/features/stories/ads/Ads.stories.d.ts +0 -20
  23. package/dist/features/stories/context/Context.stories.d.ts +0 -10
  24. package/dist/features/stories/index.d.ts +0 -3
  25. package/dist/features/stories/playback/Playback.stories.d.ts +0 -38
  26. package/dist/fixtures/index.d.ts +0 -1
  27. package/dist/fixtures/playlist.d.ts +0 -11
  28. package/dist/hooks/index.d.ts +0 -4
  29. package/dist/hooks/useVPPlayerEvents.d.ts +0 -24
  30. package/dist/hooks/useVPPlayerLogic.d.ts +0 -22
  31. package/dist/hooks/useVPPlayerScript.d.ts +0 -13
  32. package/dist/hooks/useVideoData.d.ts +0 -19
  33. package/dist/interfaces/config.d.ts +0 -314
  34. package/dist/interfaces/index.d.ts +0 -3
  35. package/dist/interfaces/instance.d.ts +0 -73
  36. package/dist/interfaces/props.d.ts +0 -77
  37. package/dist/main.d.ts +0 -0
  38. package/dist/types/api.types.d.ts +0 -81
  39. package/dist/types/index.d.ts +0 -2
  40. package/dist/types/playerEvents.types.d.ts +0 -67
  41. package/dist/utils/index.d.ts +0 -2
  42. package/dist/utils/vpPlayerConfigBuilder.d.ts +0 -30
  43. package/dist/utils/vpPlayerUtils.d.ts +0 -8
package/dist/index.d.ts CHANGED
@@ -1,9 +1,897 @@
1
- export { default as VPPlayer } from './features/VPPlayer';
2
- export * from './components/VPPlayer/ui';
3
- export { VPPlayerProvider, useVPPlayer } from './contexts/VPPlayerContext';
4
- export * from './hooks';
5
- export * from './interfaces';
6
- export * from './types';
7
- export * from './utils';
8
- export * from './constants/configs';
9
- export * from './constants/urls';
1
+ import { CurrentVideoData as CurrentVideoData_2 } from '../../../../../../../src/types';
2
+ import { default as default_2 } from 'react';
3
+ import { DetailedHTMLProps } from 'react';
4
+ import { HTMLAttributes } from 'react';
5
+ import { JSX } from 'react/jsx-runtime';
6
+ import { PlayerEventCallbacks as PlayerEventCallbacks_2 } from '../../../../../../../src/types';
7
+ import { PlayerTrackingMetadata as PlayerTrackingMetadata_2 } from '../../../../../../../src/types';
8
+ import { PlaylistItem as PlaylistItem_2 } from '../../../../../../../src/types';
9
+ import { RefObject } from 'react';
10
+ import { StyledComponent } from '@emotion/styled';
11
+ import { Theme } from '@emotion/react';
12
+ import { VPPlayerConfig as VPPlayerConfig_2 } from '../../../../../../../src/interfaces';
13
+ import { VPPlayerConfig as VPPlayerConfig_3 } from '../../../../../../../src/interfaces/config';
14
+ import { VPPlayerInstance as VPPlayerInstance_2 } from '../../../../../../../src/interfaces';
15
+ import { VPPlayerProps as VPPlayerProps_2 } from '../../../../../../../src/interfaces';
16
+
17
+ /** Ad tag URL for linear ads */
18
+ export declare const AD_TAG_LINEAR_URL = "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dlinear&correlator=";
19
+
20
+ /** Ad tag URL for skippable linear ads */
21
+ export declare const AD_TAG_SKIPPABLE_LINEAR_URL = "https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=";
22
+
23
+ /**
24
+ * Base configuration for VP Player with common settings.
25
+ */
26
+ export declare const baseConfig: Partial<VPPlayerConfig_3>;
27
+
28
+ /**
29
+ * Base configuration for ads with common ad settings.
30
+ */
31
+ export declare const baseConfigWithAds: Partial<VPPlayerConfig_3>;
32
+
33
+ /**
34
+ * Base configuration with autoplay enabled.
35
+ */
36
+ export declare const baseConfigWithAutoplay: Partial<VPPlayerConfig_3>;
37
+
38
+ /** URL for the Big Buck Bunny video */
39
+ export declare const BIG_BUCK_BUNNY_URL = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4";
40
+
41
+ /**
42
+ * Builds the final VP Player configuration based on available data.
43
+ *
44
+ * For vertical player with playlist, BOTH video.file AND video.playlist are needed.
45
+ * The video.file should contain the URL of the current/first video to play.
46
+ *
47
+ * @function
48
+ * @param {ConfigBuilderOptions} options - Options for building the configuration
49
+ * @returns {VPPlayerConfig} - The final configuration object for the player
50
+ * @throws {Error} - Throws error if no valid video source is found
51
+ */
52
+ export declare const buildVPPlayerConfig: ({ videoUrl, projectId, config, isVerticalPlayer, }: ConfigBuilderOptions) => VPPlayerConfig_2;
53
+
54
+ /**
55
+ * Interface for options used in building the VP Player configuration.
56
+ *
57
+ * @interface ConfigBuilderOptions
58
+ */
59
+ declare interface ConfigBuilderOptions {
60
+ videoUrl?: string;
61
+ projectId?: string;
62
+ config?: Partial<VPPlayerConfig_2>;
63
+ isVerticalPlayer?: boolean;
64
+ }
65
+
66
+ /**
67
+ * Represents data about the currently playing video.
68
+ * Used in onVideoStarted callback.
69
+ *
70
+ * @interface CurrentVideoData
71
+ */
72
+ export declare interface CurrentVideoData {
73
+ title?: string;
74
+ file?: string;
75
+ hlsUrl?: string;
76
+ thumbnailUrl?: string;
77
+ duration?: number;
78
+ videoIndex?: number;
79
+ playlistVideoIndex?: number;
80
+ isBackupPlaylist?: boolean;
81
+ videoId?: string;
82
+ mediaId?: string;
83
+ publishDate?: string;
84
+ projectId?: string;
85
+ premium?: boolean;
86
+ author?: string;
87
+ tags?: string[];
88
+ description?: string;
89
+ }
90
+
91
+ /**
92
+ * Default configuration object for the VP Player.
93
+ *
94
+ * NOTE: Intentionally minimal defaults to avoid interfering with managed mode.
95
+ * When using videoId + projectId (managed mode), the SDK fetches video details
96
+ * from the backend. Providing empty `file` or `playlist` can break this flow.
97
+ *
98
+ * @constant
99
+ * @type {VPPlayerConfig}
100
+ * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/configuration}
101
+ */
102
+ export declare const defaultVPPlayerConfig: VPPlayerConfig;
103
+
104
+ /** URL for the Elephants Dream video */
105
+ export declare const ELEPHANTS_DREAM_URL = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4";
106
+
107
+ /**
108
+ * Extracts the video ID from a given VP Player script URL.
109
+ *
110
+ * IMPORTANT: Only extracts from HORIZONTAL player URLs.
111
+ * Vertical player URLs contain a player script ID, NOT a video ID.
112
+ * - Horizontal: ${VP_PLAYER_BASE_URL}/player/{version}/{videoId}.js -> extracts videoId
113
+ * - Vertical: ${VP_PLAYER_BASE_URL}/vertical-player/{scriptId}.js -> returns undefined
114
+ *
115
+ * @function
116
+ * @param {string} [scriptUrl] - The script URL containing the video ID.
117
+ * @returns {string | undefined} The extracted video ID, or `undefined` if not found or if vertical player.
118
+ */
119
+ export declare const extractVideoId: (scriptUrl?: string) => string | undefined;
120
+
121
+ /**
122
+ * Generates an ad configuration for VP Player based on provided parameters.
123
+ * @param breakType - The type of ad break (e.g., "preroll", "postroll", "midroll").
124
+ * @param adTagUrls - Array of ad tag URLs to use for the ad break.
125
+ * @param breakTimingType - The timing type for the ad break (e.g., "time", "percentage", "playlist").
126
+ * @param breakTimingValue - The timing value for the ad break (e.g., 0 for immediate, 2 for playlist index).
127
+ * @returns A partial VPPlayerConfig with the ad configuration.
128
+ */
129
+ export declare const getAdConfig: (breakType: "preroll" | "postroll" | "midroll", adTagUrls: string[], breakTimingType?: "time" | "percentage" | "playlist", breakTimingValue?: number) => Partial<VPPlayerConfig_3>;
130
+
131
+ /**
132
+ * Styled component for the full-screen overlay when the player is active.
133
+ *
134
+ * @component
135
+ * @param {string} [className] - CSS class name for additional styling.
136
+ */
137
+ export declare const Overlay: StyledComponent< {
138
+ theme?: Theme;
139
+ as?: React.ElementType;
140
+ } & {
141
+ className?: string;
142
+ }, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
143
+
144
+ /** URL for the Pexels thumbnail */
145
+ export declare const PEXELS_THUMBNAIL_URL = "https://images.pexels.com/videos/4678261/pexels-photo-4678261.jpeg?auto=compress&cs=tinysrgb&w=600";
146
+
147
+ /** URL for the Pexels vertical video */
148
+ export declare const PEXELS_VERTICAL_VIDEO_URL = "https://videos.pexels.com/video-files/4678261/4678261-hd_1080_1920_25fps.mp4";
149
+
150
+ /**
151
+ * Styled component for the video player container.
152
+ *
153
+ * @component
154
+ * @param {string} [width] - The width of the player (default: "100%").
155
+ * @param {string} [height] - The height of the player (default: "100%").
156
+ * @param {string[]} [$hiddenClasses] - CSS class names to hide elements inside the player.
157
+ * @param {string} [className] - CSS class name for additional styling.
158
+ */
159
+ export declare const PlayerContainer: StyledComponent< {
160
+ theme?: Theme;
161
+ as?: React.ElementType;
162
+ } & {
163
+ width?: string;
164
+ height?: string;
165
+ $hiddenClasses?: string[];
166
+ className?: string;
167
+ }, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
168
+
169
+ /**
170
+ * Callback function type for player events
171
+ * Accepts event name (PlayerEventType) and optionally currentPosition for progress events
172
+ */
173
+ export declare type PlayerEventCallback = (event: PlayerEventType, currentPosition?: number) => void;
174
+
175
+ /**
176
+ * Individual event callbacks
177
+ * Each callback accepts only the event name (PlayerEventType)
178
+ */
179
+ export declare interface PlayerEventCallbacks {
180
+ onPlayerStart?: (event: PlayerEventType) => void;
181
+ onPlayerPlay?: (event: PlayerEventType) => void;
182
+ onPlayerPause?: (event: PlayerEventType) => void;
183
+ onPlayerResume?: (event: PlayerEventType) => void;
184
+ onPlayerEnd?: (event: PlayerEventType) => void;
185
+ onPlayerProgressEvery10Seconds?: (event: PlayerEventType, currentPosition: number) => void;
186
+ onPlayerProgressAt20Seconds?: (event: PlayerEventType, currentPosition: number) => void;
187
+ onPlayerQuartile25?: (event: PlayerEventType, currentPosition: number) => void;
188
+ onPlayerQuartile50?: (event: PlayerEventType, currentPosition: number) => void;
189
+ onPlayerQuartile75?: (event: PlayerEventType, currentPosition: number) => void;
190
+ onPlayerNext?: (event: PlayerEventType) => void;
191
+ onPlayerPrevious?: (event: PlayerEventType) => void;
192
+ /**
193
+ * Universal callback for all events - called in addition to specific callbacks
194
+ * Accepts event name (PlayerEventType) and optionally currentPosition for progress events
195
+ */
196
+ onPlayerEvent?: PlayerEventCallback;
197
+ }
198
+
199
+ /**
200
+ * Player event data structure
201
+ */
202
+ export declare interface PlayerEventData {
203
+ event: PlayerEventType;
204
+ player: PlayerObject;
205
+ _clear?: boolean;
206
+ }
207
+
208
+ /**
209
+ * Player event types that can be tracked
210
+ */
211
+ export declare type PlayerEventType = "player_start" | "player_play" | "player_pause" | "player_resume" | "player_end" | "player_progress_every_10_seconds" | "player_progress_at_20_seconds" | "player_quartile_25" | "player_quartile_50" | "player_quartile_75" | "player_next" | "player_previous";
212
+
213
+ /**
214
+ * Player object structure for analytics
215
+ */
216
+ export declare interface PlayerObject {
217
+ videoId?: string;
218
+ title?: string;
219
+ categoryName?: string;
220
+ publishedDate?: string;
221
+ isPremium?: boolean;
222
+ tags?: string[];
223
+ isReels?: boolean;
224
+ currentPosition?: number;
225
+ duration?: number;
226
+ progress?: number;
227
+ }
228
+
229
+ /**
230
+ * Interface defining the parameters for configuring the VP Player instance.
231
+ *
232
+ * @interface
233
+ */
234
+ export declare interface PlayerParams {
235
+ playerId: string;
236
+ config?: Partial<VPPlayerConfig>;
237
+ videoId?: string;
238
+ projectId?: string;
239
+ videoUrl?: string;
240
+ playlistId?: string;
241
+ scriptUrl?: string;
242
+ version?: string | null;
243
+ thumbnailUrl?: string;
244
+ isReels?: boolean;
245
+ hiddenClasses?: string[];
246
+ className?: string;
247
+ onPlaylistData?: (videos: PlaylistItem_2[]) => void;
248
+ }
249
+
250
+ /**
251
+ * Interface defining the parameters for initializing the VPPlayer.
252
+ *
253
+ * @interface PlayerParams
254
+ */
255
+ declare interface PlayerParams_2 {
256
+ playerId?: string;
257
+ videoId?: string;
258
+ projectId?: string;
259
+ videoUrl?: string;
260
+ playlistId?: string;
261
+ scriptUrl?: string;
262
+ version?: string | null;
263
+ config?: VPPlayerProps_2["config"];
264
+ thumbnailUrl?: string;
265
+ isReels?: boolean;
266
+ hiddenClasses?: string[];
267
+ className?: string;
268
+ }
269
+
270
+ /**
271
+ * Tracking metadata for analytics (available in v1.0.23+)
272
+ */
273
+ export declare interface PlayerTrackingMetadata {
274
+ videoId: string;
275
+ title: string;
276
+ categoryName?: string;
277
+ publishedDate?: string;
278
+ isPremium?: boolean;
279
+ tags?: string[];
280
+ isReels?: boolean;
281
+ }
282
+
283
+ /**
284
+ * Styled wrapper for the player, adjusting its size based on viewport width.
285
+ *
286
+ * @component
287
+ * @param {string} [className] - CSS class name for additional styling.
288
+ */
289
+ export declare const PlayerWrapper: StyledComponent< {
290
+ theme?: Theme;
291
+ as?: React.ElementType;
292
+ } & {
293
+ className?: string;
294
+ }, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
295
+
296
+ /**
297
+ * API response structure for fetching playlist data.
298
+ *
299
+ * @interface PlaylistApiResponse
300
+ */
301
+ export declare interface PlaylistApiResponse {
302
+ result: PlaylistItem[];
303
+ }
304
+
305
+ /**
306
+ * Represents an item in a video playlist.
307
+ *
308
+ * @interface PlaylistItem
309
+ */
310
+ export declare interface PlaylistItem {
311
+ mediaId: string;
312
+ videoId?: string;
313
+ title: string;
314
+ description?: string;
315
+ hlsUrl: string;
316
+ playbackUrl?: string;
317
+ file?: string;
318
+ thumbnailUrl: string;
319
+ duration: number;
320
+ durationString?: string;
321
+ isBackupPlaylist?: boolean;
322
+ }
323
+
324
+ /**
325
+ * Hook for accessing the VPPlayer context.
326
+ *
327
+ * @function
328
+ * @throws {Error} If used outside of the VPPlayerProvider.
329
+ * @returns {VPPlayerContextType} The VPPlayer context.
330
+ */
331
+ export declare const useVPPlayer: () => VPPlayerContextType_2;
332
+
333
+ /**
334
+ * Custom hook to manage VP Player logic.
335
+ * Uses native SDK events instead of manual progress tracking.
336
+ */
337
+ export declare const useVPPlayerLogic: ({ playerId, videoId: propVideoId, version, videoUrl, projectId, playlistId, scriptUrl, config, isReels, onPlaylistData, onVideoStarted, onPlayerStart, onPlayerPlay, onPlayerPause, onPlayerResume, onPlayerEnd, onPlayerProgressEvery10Seconds, onPlayerProgressAt20Seconds, onPlayerQuartile25, onPlayerQuartile50, onPlayerQuartile75, onPlayerNext, onPlayerPrevious, onPlayerEvent, }: VPPlayerProps_2) => {
338
+ playerRef: RefObject<HTMLDivElement | null>;
339
+ playerInstanceRef: RefObject<VPPlayerInstance_2 | null>;
340
+ isScriptLoaded: boolean;
341
+ isLoading: boolean;
342
+ error: string | null;
343
+ generatedPlayerId: string;
344
+ };
345
+
346
+ /**
347
+ * Custom hook to dynamically load the VP Player script into the document.
348
+ * It ensures that the script is only loaded once and provides a loading state.
349
+ *
350
+ * @function
351
+ * @param {string | null} [version] - The version of the VP Player script to load (defaults to "latest").
352
+ * @param {string} [scriptUrl] - Custom script URL (if provided, it overrides the version-based URL).
353
+ * @returns {{ isLoaded: boolean; error: string | null }} Indicates load success and any error message.
354
+ */
355
+ export declare const useVPPlayerScript: (version?: string | null, scriptUrl?: string) => {
356
+ isLoaded: boolean;
357
+ error: string | null;
358
+ };
359
+
360
+ /**
361
+ * API response types for VP Player.
362
+ *
363
+ * @interface VideoApiItem
364
+ * Represents an individual video item in the API response.
365
+ */
366
+ export declare interface VideoApiItem {
367
+ mediaId: string;
368
+ playbackUrl: string;
369
+ }
370
+
371
+ /**
372
+ * API response structure for fetching video data.
373
+ *
374
+ * @interface VideoApiResponse
375
+ */
376
+ export declare interface VideoApiResponse {
377
+ result: {
378
+ items: VideoApiItem[];
379
+ };
380
+ }
381
+
382
+ /**
383
+ * Result structure returned by the video data fetching logic.
384
+ *
385
+ * @interface VideoDataResult
386
+ */
387
+ export declare interface VideoDataResult {
388
+ fetchedPlaybackUrl: string | null;
389
+ fetchedPlaylist: PlaylistItem[] | null;
390
+ isLoading: boolean;
391
+ error: string | null;
392
+ }
393
+
394
+ /**
395
+ * Video Player Component for rendering a video player with overlay and responsive behavior.
396
+ * Handles initialization of the player and displays loading/error states.
397
+ *
398
+ * @function
399
+ * @param {VPPlayerProps} props - The properties for configuring the video player.
400
+ * @param {string} props.playerId - Unique identifier for the player instance.
401
+ * @param {string} [props.videoId] - ID of the video to be played.
402
+ * @param {string} [props.version] - Version of the player.
403
+ * @param {string} [props.videoUrl] - Direct video URL (bypasses API calls).
404
+ * @param {string} [props.projectId] - Project ID associated with the video.
405
+ * @param {string} [props.playlistId] - Playlist ID if playing a collection of videos.
406
+ * @param {string} [props.scriptUrl] - URL of the video player script.
407
+ * @param {object} [props.config={}] - Configuration settings for the player.
408
+ * @param {boolean} [props.isReels=false] - Determines if the player should behave as a short-video reel.
409
+ * @param {string[]} [props.hiddenClasses=[]] - CSS classes to hide player elements.
410
+ * @param {function} [props.onClose] - Callback triggered when the player is closed.
411
+ * @param {boolean} [props.isPlayerVisible=false] - Controls the initial visibility of the player.
412
+ * @param {string} [props.className] - CSS class name for additional styling.
413
+ * @param {function} [props.onPlaylistData] - Callback triggered when the playlist data is loaded.
414
+ * @param {function} [props.onVideoStarted] - Callback triggered when the video starts playing.
415
+ * @param {object} [props.trackingMetadata] - Video metadata for tracking/analytics callbacks.
416
+ * @param {function} [props.onPlayerStart] - Callback triggered when the player starts playing.
417
+ * @param {function} [props.onPlayerPlay] - Callback triggered when the player plays.
418
+ * @param {function} [props.onPlayerPause] - Callback triggered when the player pauses.
419
+ * @param {function} [props.onPlayerResume] - Callback triggered when the player resumes.
420
+ * @param {function} [props.onPlayerEnd] - Callback triggered when the player ends.
421
+ * @param {function} [props.onPlayerProgressEvery10Seconds] - Callback triggered every 10 seconds.
422
+ * @param {function} [props.onPlayerProgressAt20Seconds] - Callback triggered at 20 seconds.
423
+ * @param {function} [props.onPlayerQuartile25] - Callback triggered at 25% quartile.
424
+ * @param {function} [props.onPlayerQuartile50] - Callback triggered at 50% quartile.
425
+ * @param {function} [props.onPlayerQuartile75] - Callback triggered at 75% quartile.
426
+ * @param {function} [props.onPlayerNext] - Callback triggered when the player goes to the next video.
427
+ * @param {function} [props.onPlayerEvent] - Callback triggered for all events.
428
+ * @returns {JSX.Element} The rendered video player component.
429
+ */
430
+ export declare const VPPlayer: ({ playerId, videoId, version, videoUrl, projectId, playlistId, scriptUrl, config, isReels, hiddenClasses, onClose, className, onPlaylistData, onVideoStarted, trackingMetadata, onPlayerStart, onPlayerPlay, onPlayerPause, onPlayerResume, onPlayerEnd, onPlayerProgressEvery10Seconds, onPlayerProgressAt20Seconds, onPlayerQuartile25, onPlayerQuartile50, onPlayerQuartile75, onPlayerNext, onPlayerPrevious, onPlayerEvent, }: VPPlayerProps_2 & {
431
+ className?: string;
432
+ }) => JSX.Element;
433
+
434
+ /**
435
+ * Interface describing the advertising configuration options for the VP Player.
436
+ *
437
+ * @interface
438
+ * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/advertising}
439
+ */
440
+ export declare interface VPPlayerAdsConfig {
441
+ skipAd?: {
442
+ state: boolean;
443
+ skipFrom: number;
444
+ };
445
+ vmap?: string;
446
+ VPAIDmode?: string;
447
+ enableProgrammability?: boolean;
448
+ functions?: Array<{
449
+ isDynamicKey: boolean;
450
+ isDynamicValue: boolean;
451
+ key: string;
452
+ order: number;
453
+ value: string;
454
+ }>;
455
+ bidding?: boolean;
456
+ afterMidrollBacktrack?: {
457
+ state: boolean;
458
+ seconds: number;
459
+ };
460
+ adBreaks?: Array<{
461
+ adTagUrl: string[];
462
+ breakType?: 'preroll' | 'midroll' | 'postroll';
463
+ breakTimingType?: 'time' | 'percentage' | 'playlist';
464
+ breakTimingValue?: number;
465
+ schedule?: {
466
+ type?: 'CUSTOM' | 'RECURRING';
467
+ ranges?: Array<{
468
+ startTime?: number;
469
+ endTime?: number;
470
+ count?: number;
471
+ breaks?: number[];
472
+ }>;
473
+ algorithm?: 'PASSIVE' | 'AGGRESSIVE' | 'SIMILAR_DISTANCE' | 'CUSTOM';
474
+ protectFirst?: number;
475
+ protectLast?: number;
476
+ occurEvery?: number;
477
+ liveCount?: number;
478
+ };
479
+ }>;
480
+ bidders?: Array<{
481
+ name: string;
482
+ params?: Array<{
483
+ paramName?: string;
484
+ paramType?: string;
485
+ paramValue?: string;
486
+ }>;
487
+ }>;
488
+ adsRequireInteraction?: boolean;
489
+ }
490
+
491
+ /**
492
+ * Interface defining the configuration options for the VP Player.
493
+ *
494
+ * @interface
495
+ * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/configuration}
496
+ * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/playing}
497
+ * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/advertising}
498
+ * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/styling}
499
+ * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/localization}
500
+ * @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/full-configuration}
501
+ */
502
+ export declare interface VPPlayerConfig {
503
+ projectId?: string;
504
+ videoId?: string;
505
+ categoryName?: string;
506
+ gemiusIdentifier?: string;
507
+ typology?: string;
508
+ video: {
509
+ videoId?: string;
510
+ ads?: VPPlayerAdsConfig;
511
+ advertising?: boolean;
512
+ videoLocking?: {
513
+ isEnabled: boolean;
514
+ type: string;
515
+ value: number;
516
+ };
517
+ file?: string;
518
+ title?: string;
519
+ description?: string;
520
+ publishDate?: string;
521
+ duration?: number;
522
+ preload?: string;
523
+ thumbnail?: string;
524
+ filmstrip?: string;
525
+ author?: string;
526
+ source?: string;
527
+ tags?: string[];
528
+ tracks?: Array<{
529
+ file: string;
530
+ label: string;
531
+ kind: string;
532
+ default?: boolean;
533
+ }>;
534
+ playlist?: {
535
+ state?: boolean;
536
+ playlistId?: string;
537
+ playlistVideoIndex?: number;
538
+ videos?: Array<{
539
+ videoId: string;
540
+ title: string;
541
+ thumbnailUrl?: string;
542
+ duration?: number;
543
+ file?: string;
544
+ hlsUrl?: string;
545
+ }>;
546
+ };
547
+ };
548
+ config: {
549
+ adAnnouncement?: {
550
+ state?: boolean;
551
+ timeBeforeAd?: number;
552
+ };
553
+ autostartOnLoad?: {
554
+ state?: boolean;
555
+ onMobile?: boolean;
556
+ onData?: boolean;
557
+ };
558
+ adsRequireInteraction?: boolean;
559
+ autoplay?: boolean;
560
+ pauseOtherVideos?: boolean;
561
+ focusOnAutostart?: boolean;
562
+ muted?: boolean;
563
+ loop?: boolean;
564
+ size?: {
565
+ sizeType?: string;
566
+ aspectRatio?: string;
567
+ width?: number | string;
568
+ height?: number | string;
569
+ };
570
+ showRelatedOnPause?: {
571
+ state?: boolean;
572
+ onMobile?: boolean;
573
+ from?: number;
574
+ };
575
+ float?: {
576
+ state: boolean;
577
+ onMobile: boolean;
578
+ position: string;
579
+ dismissible: boolean;
580
+ requiresInteraction: boolean;
581
+ toVideoThreshold: number;
582
+ toFloatThreshold: number;
583
+ style: {
584
+ width: number;
585
+ border: string;
586
+ };
587
+ };
588
+ controls?: {
589
+ theaterButton?: boolean;
590
+ settingsButton?: boolean;
591
+ chromecastButton?: boolean;
592
+ nextButton?: boolean;
593
+ fullscreenButton?: boolean;
594
+ airplayButton?: boolean;
595
+ bigPlayButton?: boolean;
596
+ autopausePlayButton?: boolean;
597
+ pictureInPictureButton?: boolean;
598
+ relatedButton?: boolean;
599
+ volumeButton?: boolean;
600
+ shareButton?: boolean;
601
+ subtitlesButton?: boolean;
602
+ showCaptions?: boolean;
603
+ };
604
+ logo?: {
605
+ state?: boolean;
606
+ file?: string;
607
+ position?: string;
608
+ defaultOpacity?: number;
609
+ inactiveOpacity?: number;
610
+ onClickURL?: string;
611
+ };
612
+ skin?: {
613
+ controlBar?: {
614
+ background?: string;
615
+ spread?: "solid" | "gradient";
616
+ gradientMidPoint?: number;
617
+ text?: string;
618
+ icons?: {
619
+ default?: string;
620
+ hover?: string;
621
+ };
622
+ timeslider?: {
623
+ progress?: string;
624
+ rail?: string;
625
+ buffer?: string;
626
+ dragger?: string;
627
+ };
628
+ timesliderOnAd?: {
629
+ progress?: string;
630
+ rail?: string;
631
+ buffer?: string;
632
+ dragger?: string;
633
+ };
634
+ volume?: {
635
+ dragger?: string;
636
+ progress?: string;
637
+ rail?: string;
638
+ notifier?: string;
639
+ };
640
+ };
641
+ menus?: {
642
+ background?: {
643
+ default?: string;
644
+ hover?: string;
645
+ };
646
+ links?: {
647
+ default?: string;
648
+ hover?: string;
649
+ };
650
+ autoplay?: {
651
+ autoplayOn?: string;
652
+ autoplayOff?: string;
653
+ };
654
+ };
655
+ nextVideo?: {
656
+ background?: string;
657
+ text?: string;
658
+ timeslider?: {
659
+ rail?: string;
660
+ progress?: string;
661
+ };
662
+ icons?: {
663
+ play?: {
664
+ default?: string;
665
+ hover?: string;
666
+ };
667
+ close?: string;
668
+ };
669
+ };
670
+ playlist?: {
671
+ background?: string;
672
+ text?: string;
673
+ icons?: {
674
+ arrows?: {
675
+ active?: string;
676
+ inactive?: string;
677
+ };
678
+ close?: string;
679
+ };
680
+ card?: {
681
+ background?: string;
682
+ title?: string;
683
+ duration?: {
684
+ text?: string;
685
+ background?: string;
686
+ };
687
+ icons?: {
688
+ play?: {
689
+ default?: string;
690
+ hover?: string;
691
+ };
692
+ };
693
+ };
694
+ };
695
+ };
696
+ lang?: {
697
+ locale?: string;
698
+ controls?: {
699
+ play?: string;
700
+ pause?: string;
701
+ next?: string;
702
+ replay?: string;
703
+ volume?: string;
704
+ mute?: string;
705
+ unmute?: string;
706
+ settings?: string;
707
+ theater?: string;
708
+ fullscreen?: string;
709
+ chromecast?: string;
710
+ airplay?: string;
711
+ pictureInPicture?: string;
712
+ related?: string;
713
+ skipIntro?: string;
714
+ skipAd?: string;
715
+ playlistTitle?: string;
716
+ upNext?: string;
717
+ live?: string;
718
+ continueAfterPause?: string;
719
+ };
720
+ settings?: {
721
+ quality?: string;
722
+ subtitles?: string;
723
+ autoplay?: string;
724
+ playbackRate?: string;
725
+ auto?: string;
726
+ off?: string;
727
+ normal?: string;
728
+ share?: string;
729
+ };
730
+ ads?: {
731
+ ad?: string;
732
+ skip?: string;
733
+ skipIn?: string;
734
+ visit?: string;
735
+ info?: string;
736
+ simultaneousAds?: string;
737
+ adAnnouncement?: string;
738
+ };
739
+ messages?: {
740
+ playbackErrorTitle?: string;
741
+ playbackErrorDescription?: string;
742
+ geoBlockedTitle?: string;
743
+ geoBlockedDescription?: string;
744
+ streamInterruptedTitle?: string;
745
+ streamInterruptedDescription?: string;
746
+ };
747
+ };
748
+ ads?: VPPlayerAdsConfig;
749
+ };
750
+ }
751
+
752
+ /**
753
+ * Interface for the VP Player context, providing methods and state for controlling the player.
754
+ *
755
+ * @interface
756
+ */
757
+ export declare interface VPPlayerContextType {
758
+ showPlayer: (params: PlayerParams) => void;
759
+ hidePlayer: () => void;
760
+ isPlayerVisible: boolean;
761
+ playerParams: PlayerParams | null;
762
+ }
763
+
764
+ /**
765
+ * Interface defining the context for VPPlayer.
766
+ *
767
+ * @interface VPPlayerContextType
768
+ */
769
+ declare interface VPPlayerContextType_2 {
770
+ showPlayer: (params: PlayerParams_2) => void;
771
+ hidePlayer: () => void;
772
+ isPlayerVisible: boolean;
773
+ playerParams: PlayerParams_2 | null;
774
+ }
775
+
776
+ /**
777
+ * Interface representing an instance of the VP Player.
778
+ * Based on VP Player API Reference: https://vp.gjirafa.tech/documentation/docs/web-player/api-reference
779
+ * And VP Vertical Player API Reference: https://vp.gjirafa.tech/documentation/docs/vertical-player/api-reference
780
+ *
781
+ * @interface
782
+ */
783
+ export declare interface VPPlayerInstance {
784
+ setup: (config: VPPlayerConfig) => void;
785
+ destroy?: () => void;
786
+ play?: () => void;
787
+ pause?: () => void;
788
+ forward?: () => void;
789
+ rewind?: () => void;
790
+ replay?: () => void;
791
+ seek?: (position: number) => void;
792
+ mute?: () => void;
793
+ unmute?: () => void;
794
+ enterFullScreen?: () => void;
795
+ exitFullScreen?: () => void;
796
+ enterFullscreen?: () => void;
797
+ exitFullscreen?: () => void;
798
+ enterPictureInPicture?: () => void;
799
+ exitPictureInPicture?: () => void;
800
+ togglePlay?: () => void;
801
+ toggleMute?: () => void;
802
+ isMuted?: () => boolean;
803
+ isPlaying?: () => boolean;
804
+ isPaused?: () => boolean;
805
+ isFullscreen?: () => boolean;
806
+ isEnded?: () => boolean;
807
+ isFocused?: () => boolean;
808
+ getPosition?: () => number;
809
+ getBuffered?: () => number;
810
+ getVolume?: () => number;
811
+ getContainer?: () => HTMLElement;
812
+ getDuration?: () => number;
813
+ getConfig?: () => VPPlayerConfig;
814
+ getQualityLevels?: () => unknown[];
815
+ getCurrentQuality?: () => number;
816
+ checkViewability?: () => boolean;
817
+ setConfig?: (config: unknown) => void;
818
+ setVideo?: (video: unknown) => void;
819
+ setPlaylist?: (playlist: unknown) => void;
820
+ setVolume?: (volume: number) => void;
821
+ setCurrentQuality?: (index: number) => void;
822
+ setLevelToAuto?: () => void;
823
+ setCuePoint?: (cue: number, callback: () => void) => void;
824
+ on?: (event: string, callback: (data?: unknown) => void) => void;
825
+ off?: (event: string, callback?: (data?: unknown) => void) => void;
826
+ videoIndex?: number;
827
+ playlist?: {
828
+ state: boolean;
829
+ playlistId: string;
830
+ playlistVideoIndex: number;
831
+ videos: unknown[];
832
+ };
833
+ multipleVideos?: Map<number, unknown>;
834
+ firstInList?: boolean;
835
+ lastInList?: boolean;
836
+ setupComplete?: boolean;
837
+ initialized?: boolean;
838
+ }
839
+
840
+ /**
841
+ * Interface defining the properties for the VP Player component.
842
+ *
843
+ * @interface
844
+ */
845
+ export declare interface VPPlayerProps {
846
+ playerId: string;
847
+ config?: Partial<VPPlayerConfig>;
848
+ videoId?: string;
849
+ projectId?: string;
850
+ videoUrl?: string;
851
+ playlistId?: string;
852
+ scriptUrl?: string;
853
+ version?: string | null;
854
+ isReels?: boolean;
855
+ thumbnailUrl?: string;
856
+ onClose?: () => void;
857
+ hiddenClasses?: string[];
858
+ isPlayerVisible?: boolean;
859
+ className?: string;
860
+ onPlaylistData?: (videos: PlaylistItem_2[]) => void;
861
+ onVideoStarted?: (videoData: CurrentVideoData_2) => void;
862
+ /**
863
+ * Video metadata for tracking/analytics callbacks
864
+ */
865
+ trackingMetadata?: PlayerTrackingMetadata_2;
866
+ onPlayerStart?: PlayerEventCallbacks_2["onPlayerStart"];
867
+ onPlayerPlay?: PlayerEventCallbacks_2["onPlayerPlay"];
868
+ onPlayerPause?: PlayerEventCallbacks_2["onPlayerPause"];
869
+ onPlayerResume?: PlayerEventCallbacks_2["onPlayerResume"];
870
+ onPlayerEnd?: PlayerEventCallbacks_2["onPlayerEnd"];
871
+ onPlayerProgressEvery10Seconds?: PlayerEventCallbacks_2["onPlayerProgressEvery10Seconds"];
872
+ onPlayerProgressAt20Seconds?: PlayerEventCallbacks_2["onPlayerProgressAt20Seconds"];
873
+ onPlayerQuartile25?: PlayerEventCallbacks_2["onPlayerQuartile25"];
874
+ onPlayerQuartile50?: PlayerEventCallbacks_2["onPlayerQuartile50"];
875
+ onPlayerQuartile75?: PlayerEventCallbacks_2["onPlayerQuartile75"];
876
+ onPlayerNext?: PlayerEventCallbacks_2["onPlayerNext"];
877
+ onPlayerPrevious?: PlayerEventCallbacks_2["onPlayerPrevious"];
878
+ /**
879
+ * Universal callback for all events - called in addition to specific callbacks
880
+ * this gives us all event in one callback
881
+ */
882
+ onPlayerEvent?: PlayerEventCallbacks_2["onPlayerEvent"];
883
+ }
884
+
885
+ /**
886
+ * VPPlayerProvider component provides context for managing the VPPlayer state.
887
+ *
888
+ * @function
889
+ * @param {Object} props - The component props.
890
+ * @param {React.ReactNode} props.children - The child components.
891
+ * @returns {JSX.Element} The provider component for VPPlayer.
892
+ */
893
+ export declare const VPPlayerProvider: default_2.FC<{
894
+ children: default_2.ReactNode;
895
+ }>;
896
+
897
+ export { }