@devix-technologies/react-gjirafa-vp-player 1.0.31-beta.1 → 1.0.31-beta.5
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/README.md +202 -99
- package/dist/index.d.ts +374 -562
- package/dist/react-gjirafa-vp-player.es.js +1075 -1327
- package/dist/react-gjirafa-vp-player.umd.js +9 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,72 +1,27 @@
|
|
|
1
1
|
import { CurrentVideoData as CurrentVideoData_2 } from '../../../../../../../src/types';
|
|
2
|
-
import { default as default_2 } from 'react';
|
|
3
2
|
import { DetailedHTMLProps } from 'react';
|
|
3
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
4
4
|
import { HTMLAttributes } from 'react';
|
|
5
|
-
import {
|
|
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';
|
|
5
|
+
import { RefAttributes } from 'react';
|
|
9
6
|
import { RefObject } from 'react';
|
|
10
7
|
import { StyledComponent } from '@emotion/styled';
|
|
11
8
|
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
9
|
import { VPPlayerInstance as VPPlayerInstance_2 } from '../../../../../../../src/interfaces';
|
|
15
10
|
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";
|
|
11
|
+
import { VPPlayerRef as VPPlayerRef_2 } from '../../../../../../../src/interfaces';
|
|
40
12
|
|
|
41
13
|
/**
|
|
42
|
-
*
|
|
14
|
+
* Appends the divId query parameter to a script URL.
|
|
15
|
+
* This tells the managed script which DOM element to use as the player container.
|
|
43
16
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @throws {Error} - Throws error if no valid video source is found
|
|
51
|
-
*/
|
|
52
|
-
export declare const buildVPPlayerConfig: ({ videoUrl, projectId, config, isVerticalPlayer, pureMode, }: ConfigBuilderOptions) => VPPlayerConfig_2;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Interface for options used in building the VP Player configuration.
|
|
56
|
-
*
|
|
57
|
-
* @interface ConfigBuilderOptions
|
|
17
|
+
* @param url - The base script URL
|
|
18
|
+
* @param divId - The DOM element ID for the player container
|
|
19
|
+
* @returns The URL with ?divId= parameter appended
|
|
20
|
+
* @example
|
|
21
|
+
* appendDivIdToUrl('https://host.vpplayer.tech/player/ptkzurnx/vjsobqhe.js', 'my-player')
|
|
22
|
+
* // Returns: 'https://host.vpplayer.tech/player/ptkzurnx/vjsobqhe.js?divId=my-player'
|
|
58
23
|
*/
|
|
59
|
-
declare
|
|
60
|
-
videoUrl?: string;
|
|
61
|
-
projectId?: string;
|
|
62
|
-
config?: Partial<VPPlayerConfig_2>;
|
|
63
|
-
isVerticalPlayer?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* When true, skips all wrapper defaults and passes only minimal config to the SDK.
|
|
66
|
-
* Use this to let the GTech admin panel settings be the source of truth.
|
|
67
|
-
*/
|
|
68
|
-
pureMode?: boolean;
|
|
69
|
-
}
|
|
24
|
+
export declare const appendDivIdToUrl: (url: string, divId: string) => string;
|
|
70
25
|
|
|
71
26
|
/**
|
|
72
27
|
* Represents data about the currently playing video.
|
|
@@ -94,44 +49,83 @@ export declare interface CurrentVideoData {
|
|
|
94
49
|
}
|
|
95
50
|
|
|
96
51
|
/**
|
|
97
|
-
*
|
|
52
|
+
* Event callback refs interface for internal use
|
|
53
|
+
* Prevents stale closures in event handlers
|
|
54
|
+
*/
|
|
55
|
+
export declare interface EventCallbackRefs {
|
|
56
|
+
onReady?: () => void;
|
|
57
|
+
onPlay?: () => void;
|
|
58
|
+
onPause?: () => void;
|
|
59
|
+
onResume?: () => void;
|
|
60
|
+
onComplete?: () => void;
|
|
61
|
+
onError?: (error: string) => void;
|
|
62
|
+
onVideoStarted?: (data: CurrentVideoData_2) => void;
|
|
63
|
+
onTimeUpdate?: (seconds: number) => void;
|
|
64
|
+
onQuartile25?: () => void;
|
|
65
|
+
onQuartile50?: () => void;
|
|
66
|
+
onQuartile75?: () => void;
|
|
67
|
+
onNext?: () => void;
|
|
68
|
+
onPrevious?: () => void;
|
|
69
|
+
onProgress10s?: (seconds: number) => void;
|
|
70
|
+
onProgress20s?: (seconds: number) => void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Generates a full player DOM element ID based on provided playerId and videoId.
|
|
75
|
+
* Falls back to "default" if playerId is not provided.
|
|
98
76
|
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
77
|
+
* @param playerId - Base identifier for the player.
|
|
78
|
+
* @param videoId - Optional video identifier.
|
|
79
|
+
* @returns Full DOM element ID string.
|
|
80
|
+
*/
|
|
81
|
+
export declare const generatePlayerId: (playerId?: string, videoId?: string) => string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Generates the URL for a FULLY managed video-specific player script.
|
|
85
|
+
* This script auto-initializes with all config from GTech admin panel -
|
|
86
|
+
* NO .setup() call needed! Chapters, ads, controls, etc. are all pre-configured.
|
|
102
87
|
*
|
|
103
|
-
* @
|
|
104
|
-
* @
|
|
105
|
-
* @
|
|
88
|
+
* @param {string} scriptId - The player script ID (e.g., 'ptkzurnx').
|
|
89
|
+
* @param {string} videoId - The video ID (e.g., 'vjsobqhe').
|
|
90
|
+
* @returns {string} - The complete URL for the fully managed player script.
|
|
91
|
+
* @example
|
|
92
|
+
* // Returns: https://host.vpplayer.tech/player/ptkzurnx/vjsobqhe.js
|
|
93
|
+
* getFullyManagedPlayerScriptUrl('ptkzurnx', 'vjsobqhe')
|
|
106
94
|
*/
|
|
107
|
-
export declare const
|
|
95
|
+
export declare const getFullyManagedPlayerScriptUrl: (scriptId: string, videoId: string) => string;
|
|
108
96
|
|
|
109
|
-
/**
|
|
110
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Generates the URL for loading a managed VP Player script (Web Player).
|
|
99
|
+
* This script requires calling .setup() with your config.
|
|
100
|
+
* @param {string} scriptId - The unique script ID (e.g., 'ptkzurly').
|
|
101
|
+
* @returns {string} - The complete URL for the managed player script.
|
|
102
|
+
*/
|
|
103
|
+
export declare const getManagedPlayerScriptUrl: (scriptId: string) => string;
|
|
111
104
|
|
|
112
105
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* Vertical player URLs contain a player script ID, NOT a video ID.
|
|
117
|
-
* - Horizontal: ${VP_PLAYER_BASE_URL}/player/{version}/{videoId}.js -> extracts videoId
|
|
118
|
-
* - Vertical: ${VP_PLAYER_BASE_URL}/vertical-player/{scriptId}.js -> returns undefined
|
|
119
|
-
*
|
|
120
|
-
* @function
|
|
121
|
-
* @param {string} [scriptUrl] - The script URL containing the video ID.
|
|
122
|
-
* @returns {string | undefined} The extracted video ID, or `undefined` if not found or if vertical player.
|
|
106
|
+
* Generates the URL for loading the standard VP Player script by version.
|
|
107
|
+
* @param {string} playerVersion - The version of the VP Player script (e.g., 'latest', 'v2.1.1').
|
|
108
|
+
* @returns {string} - The complete URL for the player script.
|
|
123
109
|
*/
|
|
124
|
-
export declare const
|
|
110
|
+
export declare const getPlayerScriptUrl: (playerVersion: string) => string;
|
|
125
111
|
|
|
126
112
|
/**
|
|
127
|
-
* Generates
|
|
128
|
-
* @param
|
|
129
|
-
* @
|
|
130
|
-
* @param breakTimingType - The timing type for the ad break (e.g., "time", "percentage", "playlist").
|
|
131
|
-
* @param breakTimingValue - The timing value for the ad break (e.g., 0 for immediate, 2 for playlist index).
|
|
132
|
-
* @returns A partial VPPlayerConfig with the ad configuration.
|
|
113
|
+
* Generates the URL for loading a vertical VP Player script.
|
|
114
|
+
* @param {string} scriptId - The unique script ID (e.g., 'rbqcdwzlg').
|
|
115
|
+
* @returns {string} - The complete URL for the vertical player script.
|
|
133
116
|
*/
|
|
134
|
-
export declare const
|
|
117
|
+
export declare const getVerticalPlayerScriptUrl: (scriptId: string) => string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Manual playlist configuration
|
|
121
|
+
* Used when you want to provide your own videos array instead of using GTech admin playlists
|
|
122
|
+
*/
|
|
123
|
+
export declare interface ManualPlaylistConfig {
|
|
124
|
+
/** Array of videos to play */
|
|
125
|
+
videos: PlaylistVideoItem[];
|
|
126
|
+
/** Starting video index (0-based) */
|
|
127
|
+
startIndex?: number;
|
|
128
|
+
}
|
|
135
129
|
|
|
136
130
|
/**
|
|
137
131
|
* Styled component for the full-screen overlay when the player is active.
|
|
@@ -146,12 +140,6 @@ as?: React.ElementType;
|
|
|
146
140
|
className?: string;
|
|
147
141
|
}, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
148
142
|
|
|
149
|
-
/** URL for the Pexels thumbnail */
|
|
150
|
-
export declare const PEXELS_THUMBNAIL_URL = "https://images.pexels.com/videos/4678261/pexels-photo-4678261.jpeg?auto=compress&cs=tinysrgb&w=600";
|
|
151
|
-
|
|
152
|
-
/** URL for the Pexels vertical video */
|
|
153
|
-
export declare const PEXELS_VERTICAL_VIDEO_URL = "https://videos.pexels.com/video-files/4678261/4678261-hd_1080_1920_25fps.mp4";
|
|
154
|
-
|
|
155
143
|
/**
|
|
156
144
|
* Styled component for the video player container.
|
|
157
145
|
*
|
|
@@ -231,55 +219,6 @@ export declare interface PlayerObject {
|
|
|
231
219
|
progress?: number;
|
|
232
220
|
}
|
|
233
221
|
|
|
234
|
-
/**
|
|
235
|
-
* Interface defining the parameters for configuring the VP Player instance.
|
|
236
|
-
*
|
|
237
|
-
* @interface
|
|
238
|
-
*/
|
|
239
|
-
export declare interface PlayerParams {
|
|
240
|
-
playerId: string;
|
|
241
|
-
config?: Partial<VPPlayerConfig>;
|
|
242
|
-
videoId?: string;
|
|
243
|
-
projectId?: string;
|
|
244
|
-
videoUrl?: string;
|
|
245
|
-
playlistId?: string;
|
|
246
|
-
scriptUrl?: string;
|
|
247
|
-
version?: string | null;
|
|
248
|
-
thumbnailUrl?: string;
|
|
249
|
-
isReels?: boolean;
|
|
250
|
-
hiddenClasses?: string[];
|
|
251
|
-
className?: string;
|
|
252
|
-
/**
|
|
253
|
-
* When true (default), skips all wrapper defaults and passes only minimal config to the SDK.
|
|
254
|
-
* This lets the GTech admin panel settings be the source of truth for
|
|
255
|
-
* controls, autoplay, muted, size, and other configuration.
|
|
256
|
-
* Set to false to use legacy behavior with wrapper defaults.
|
|
257
|
-
* @default true
|
|
258
|
-
*/
|
|
259
|
-
pureMode?: boolean;
|
|
260
|
-
onPlaylistData?: (videos: PlaylistItem_2[]) => void;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Interface defining the parameters for initializing the VPPlayer.
|
|
265
|
-
*
|
|
266
|
-
* @interface PlayerParams
|
|
267
|
-
*/
|
|
268
|
-
declare interface PlayerParams_2 {
|
|
269
|
-
playerId?: string;
|
|
270
|
-
videoId?: string;
|
|
271
|
-
projectId?: string;
|
|
272
|
-
videoUrl?: string;
|
|
273
|
-
playlistId?: string;
|
|
274
|
-
scriptUrl?: string;
|
|
275
|
-
version?: string | null;
|
|
276
|
-
config?: VPPlayerProps_2["config"];
|
|
277
|
-
thumbnailUrl?: string;
|
|
278
|
-
isReels?: boolean;
|
|
279
|
-
hiddenClasses?: string[];
|
|
280
|
-
className?: string;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
222
|
/**
|
|
284
223
|
* Tracking metadata for analytics (available in v1.0.23+)
|
|
285
224
|
*/
|
|
@@ -335,19 +274,35 @@ export declare interface PlaylistItem {
|
|
|
335
274
|
}
|
|
336
275
|
|
|
337
276
|
/**
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
* @function
|
|
341
|
-
* @throws {Error} If used outside of the VPPlayerProvider.
|
|
342
|
-
* @returns {VPPlayerContextType} The VPPlayer context.
|
|
277
|
+
* Video item for manual playlist
|
|
343
278
|
*/
|
|
344
|
-
export declare
|
|
279
|
+
export declare interface PlaylistVideoItem {
|
|
280
|
+
/** Unique video identifier */
|
|
281
|
+
videoId: string;
|
|
282
|
+
/** Video title */
|
|
283
|
+
title: string;
|
|
284
|
+
/** Video file URL (mp4, m3u8, etc.) */
|
|
285
|
+
file: string;
|
|
286
|
+
/** Alternative: HLS URL */
|
|
287
|
+
hlsUrl?: string;
|
|
288
|
+
/** Thumbnail image URL */
|
|
289
|
+
thumbnailUrl?: string;
|
|
290
|
+
/** Alternative: Thumbnail URL */
|
|
291
|
+
thumbnail?: string;
|
|
292
|
+
/** Video duration in seconds */
|
|
293
|
+
duration?: number;
|
|
294
|
+
}
|
|
345
295
|
|
|
346
296
|
/**
|
|
347
|
-
*
|
|
348
|
-
*
|
|
297
|
+
* VP Player logic hook
|
|
298
|
+
*
|
|
299
|
+
* Supports two modes:
|
|
300
|
+
* 1. **Auto-init mode** (default): Load managed script that auto-initializes with GTech admin config
|
|
301
|
+
* 2. **Manual playlist mode**: Build config and call setup() with custom videos array
|
|
302
|
+
*
|
|
303
|
+
* The manual playlist mode is required for vertical player when supplying your own videos.
|
|
349
304
|
*/
|
|
350
|
-
export declare const useVPPlayerLogic: ({
|
|
305
|
+
export declare const useVPPlayerLogic: ({ scriptId, videoId, scriptUrl, projectId, playlist, playerId, isVertical, isReels, onReady, onPlay, onPause, onResume, onComplete, onError, onVideoStarted, onTimeUpdate, onQuartile25, onQuartile50, onQuartile75, onNext, onPrevious, onProgress10s, onProgress20s, }: VPPlayerProps_2) => {
|
|
351
306
|
playerRef: RefObject<HTMLDivElement | null>;
|
|
352
307
|
playerInstanceRef: RefObject<VPPlayerInstance_2 | null>;
|
|
353
308
|
isScriptLoaded: boolean;
|
|
@@ -405,51 +360,102 @@ export declare interface VideoDataResult {
|
|
|
405
360
|
}
|
|
406
361
|
|
|
407
362
|
/**
|
|
408
|
-
*
|
|
409
|
-
|
|
363
|
+
* Base URL for the VP Player host.
|
|
364
|
+
*/
|
|
365
|
+
export declare const VP_PLAYER_BASE_URL = "https://host.vpplayer.tech";
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* VP Player Component (v2.0.0)
|
|
410
369
|
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
370
|
+
* A thin React wrapper for the GTech VP Player.
|
|
371
|
+
* All configuration is managed through the GTech admin panel -
|
|
372
|
+
* this wrapper just provides a DOM container, loads the script, and exposes events.
|
|
373
|
+
*
|
|
374
|
+
* ## Basic Usage
|
|
375
|
+
*
|
|
376
|
+
* ```tsx
|
|
377
|
+
* // Using scriptId + videoId (recommended)
|
|
378
|
+
* <VPPlayer
|
|
379
|
+
* scriptId="ptkzurnx"
|
|
380
|
+
* videoId="vjsobqhe"
|
|
381
|
+
* onPlay={() => console.log('Playing!')}
|
|
382
|
+
* />
|
|
383
|
+
*
|
|
384
|
+
* // OR using full script URL
|
|
385
|
+
* <VPPlayer
|
|
386
|
+
* scriptUrl="https://host.vpplayer.tech/player/ptkzurnx/vjsobqhe.js"
|
|
387
|
+
* onPlay={() => console.log('Playing!')}
|
|
388
|
+
* />
|
|
389
|
+
* ```
|
|
390
|
+
*
|
|
391
|
+
* ## Using the ref for imperative control
|
|
392
|
+
*
|
|
393
|
+
* ```tsx
|
|
394
|
+
* const playerRef = useRef<VPPlayerRef>(null);
|
|
395
|
+
*
|
|
396
|
+
* <VPPlayer
|
|
397
|
+
* ref={playerRef}
|
|
398
|
+
* scriptId="ptkzurnx"
|
|
399
|
+
* videoId="vjsobqhe"
|
|
400
|
+
* />
|
|
401
|
+
*
|
|
402
|
+
* // Later:
|
|
403
|
+
* playerRef.current?.seek(60);
|
|
404
|
+
* playerRef.current?.play();
|
|
405
|
+
* console.log(playerRef.current?.getPosition());
|
|
406
|
+
* ```
|
|
407
|
+
*
|
|
408
|
+
* ## Manual Playlist Mode (Vertical Player)
|
|
409
|
+
*
|
|
410
|
+
* For vertical player with custom videos array:
|
|
411
|
+
*
|
|
412
|
+
* ```tsx
|
|
413
|
+
* <VPPlayer
|
|
414
|
+
* scriptId="rbqcdwzlg"
|
|
415
|
+
* projectId="agmipnzb"
|
|
416
|
+
* isVertical={true}
|
|
417
|
+
* playlist={{
|
|
418
|
+
* videos: [
|
|
419
|
+
* { videoId: "1", title: "Video 1", file: "https://...mp4", thumbnailUrl: "...", duration: 120 },
|
|
420
|
+
* { videoId: "2", title: "Video 2", file: "https://...mp4", thumbnailUrl: "...", duration: 150 },
|
|
421
|
+
* ],
|
|
422
|
+
* startIndex: 0,
|
|
423
|
+
* }}
|
|
424
|
+
* onNext={() => console.log('Next video')}
|
|
425
|
+
* />
|
|
426
|
+
* ```
|
|
427
|
+
*
|
|
428
|
+
* ## Reels Mode
|
|
429
|
+
*
|
|
430
|
+
* For TikTok-style vertical videos with overlay:
|
|
431
|
+
*
|
|
432
|
+
* ```tsx
|
|
433
|
+
* <VPPlayer
|
|
434
|
+
* scriptId="rbqcdwzlg"
|
|
435
|
+
* videoId="vjsobqhe"
|
|
436
|
+
* isReels={true}
|
|
437
|
+
* thumbnailUrl="https://example.com/thumb.jpg"
|
|
438
|
+
* onClose={() => console.log('Closed')}
|
|
439
|
+
* />
|
|
440
|
+
* ```
|
|
441
|
+
*
|
|
442
|
+
* @param props - VPPlayer configuration props
|
|
443
|
+
*/
|
|
444
|
+
export declare const VPPlayer: ForwardRefExoticComponent<VPPlayerProps_2 & RefAttributes<VPPlayerRef_2>>;
|
|
447
445
|
|
|
448
446
|
/**
|
|
449
|
-
*
|
|
447
|
+
* VP Player Configuration Types (v2.0.0)
|
|
448
|
+
*
|
|
449
|
+
* NOTE: In v2.0.0, configuration is managed through the GTech admin panel.
|
|
450
|
+
* These types are kept for reference only - the React wrapper does NOT
|
|
451
|
+
* pass configuration to the SDK. The managed script auto-initializes
|
|
452
|
+
* with all settings from the admin panel.
|
|
450
453
|
*
|
|
451
|
-
* @
|
|
452
|
-
|
|
454
|
+
* @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/configuration}
|
|
455
|
+
*/
|
|
456
|
+
/**
|
|
457
|
+
* Advertising configuration interface (reference only)
|
|
458
|
+
* Configured through GTech admin panel
|
|
453
459
|
*/
|
|
454
460
|
export declare interface VPPlayerAdsConfig {
|
|
455
461
|
skipAd?: {
|
|
@@ -459,343 +465,27 @@ export declare interface VPPlayerAdsConfig {
|
|
|
459
465
|
vmap?: string;
|
|
460
466
|
VPAIDmode?: string;
|
|
461
467
|
enableProgrammability?: boolean;
|
|
462
|
-
functions?: Array<{
|
|
463
|
-
isDynamicKey: boolean;
|
|
464
|
-
isDynamicValue: boolean;
|
|
465
|
-
key: string;
|
|
466
|
-
order: number;
|
|
467
|
-
value: string;
|
|
468
|
-
}>;
|
|
469
|
-
bidding?: boolean;
|
|
470
|
-
afterMidrollBacktrack?: {
|
|
471
|
-
state: boolean;
|
|
472
|
-
seconds: number;
|
|
473
|
-
};
|
|
474
468
|
adBreaks?: Array<{
|
|
475
469
|
adTagUrl: string[];
|
|
476
|
-
breakType?:
|
|
477
|
-
breakTimingType?:
|
|
470
|
+
breakType?: "preroll" | "midroll" | "postroll";
|
|
471
|
+
breakTimingType?: "time" | "percentage" | "playlist";
|
|
478
472
|
breakTimingValue?: number;
|
|
479
|
-
schedule?: {
|
|
480
|
-
type?: 'CUSTOM' | 'RECURRING';
|
|
481
|
-
ranges?: Array<{
|
|
482
|
-
startTime?: number;
|
|
483
|
-
endTime?: number;
|
|
484
|
-
count?: number;
|
|
485
|
-
breaks?: number[];
|
|
486
|
-
}>;
|
|
487
|
-
algorithm?: 'PASSIVE' | 'AGGRESSIVE' | 'SIMILAR_DISTANCE' | 'CUSTOM';
|
|
488
|
-
protectFirst?: number;
|
|
489
|
-
protectLast?: number;
|
|
490
|
-
occurEvery?: number;
|
|
491
|
-
liveCount?: number;
|
|
492
|
-
};
|
|
493
|
-
}>;
|
|
494
|
-
bidders?: Array<{
|
|
495
|
-
name: string;
|
|
496
|
-
params?: Array<{
|
|
497
|
-
paramName?: string;
|
|
498
|
-
paramType?: string;
|
|
499
|
-
paramValue?: string;
|
|
500
|
-
}>;
|
|
501
473
|
}>;
|
|
502
|
-
adsRequireInteraction?: boolean;
|
|
503
474
|
}
|
|
504
475
|
|
|
505
476
|
/**
|
|
506
|
-
* Interface
|
|
477
|
+
* Interface representing an instance of the VP Player.
|
|
507
478
|
*
|
|
508
|
-
*
|
|
509
|
-
*
|
|
510
|
-
* @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/playing}
|
|
511
|
-
* @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/advertising}
|
|
512
|
-
* @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/styling}
|
|
513
|
-
* @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/localization}
|
|
514
|
-
* @see {@link https://vp.gjirafa.tech/documentation/docs/web-player/setup-the-player/full-configuration}
|
|
515
|
-
*/
|
|
516
|
-
export declare interface VPPlayerConfig {
|
|
517
|
-
projectId?: string;
|
|
518
|
-
videoId?: string;
|
|
519
|
-
categoryName?: string;
|
|
520
|
-
gemiusIdentifier?: string;
|
|
521
|
-
typology?: string;
|
|
522
|
-
video: {
|
|
523
|
-
videoId?: string;
|
|
524
|
-
ads?: VPPlayerAdsConfig;
|
|
525
|
-
advertising?: boolean;
|
|
526
|
-
videoLocking?: {
|
|
527
|
-
isEnabled: boolean;
|
|
528
|
-
type: string;
|
|
529
|
-
value: number;
|
|
530
|
-
};
|
|
531
|
-
file?: string;
|
|
532
|
-
title?: string;
|
|
533
|
-
description?: string;
|
|
534
|
-
publishDate?: string;
|
|
535
|
-
duration?: number;
|
|
536
|
-
preload?: string;
|
|
537
|
-
thumbnail?: string;
|
|
538
|
-
filmstrip?: string;
|
|
539
|
-
author?: string;
|
|
540
|
-
source?: string;
|
|
541
|
-
tags?: string[];
|
|
542
|
-
tracks?: Array<{
|
|
543
|
-
file: string;
|
|
544
|
-
label: string;
|
|
545
|
-
kind: string;
|
|
546
|
-
default?: boolean;
|
|
547
|
-
}>;
|
|
548
|
-
playlist?: {
|
|
549
|
-
state?: boolean;
|
|
550
|
-
playlistId?: string;
|
|
551
|
-
playlistVideoIndex?: number;
|
|
552
|
-
videos?: Array<{
|
|
553
|
-
videoId: string;
|
|
554
|
-
title: string;
|
|
555
|
-
thumbnailUrl?: string;
|
|
556
|
-
duration?: number;
|
|
557
|
-
file?: string;
|
|
558
|
-
hlsUrl?: string;
|
|
559
|
-
}>;
|
|
560
|
-
};
|
|
561
|
-
};
|
|
562
|
-
config: {
|
|
563
|
-
adAnnouncement?: {
|
|
564
|
-
state?: boolean;
|
|
565
|
-
timeBeforeAd?: number;
|
|
566
|
-
};
|
|
567
|
-
autostartOnLoad?: {
|
|
568
|
-
state?: boolean;
|
|
569
|
-
onMobile?: boolean;
|
|
570
|
-
onData?: boolean;
|
|
571
|
-
};
|
|
572
|
-
adsRequireInteraction?: boolean;
|
|
573
|
-
autoplay?: boolean;
|
|
574
|
-
pauseOtherVideos?: boolean;
|
|
575
|
-
focusOnAutostart?: boolean;
|
|
576
|
-
muted?: boolean;
|
|
577
|
-
loop?: boolean;
|
|
578
|
-
size?: {
|
|
579
|
-
sizeType?: string;
|
|
580
|
-
aspectRatio?: string;
|
|
581
|
-
width?: number | string;
|
|
582
|
-
height?: number | string;
|
|
583
|
-
};
|
|
584
|
-
showRelatedOnPause?: {
|
|
585
|
-
state?: boolean;
|
|
586
|
-
onMobile?: boolean;
|
|
587
|
-
from?: number;
|
|
588
|
-
};
|
|
589
|
-
float?: {
|
|
590
|
-
state: boolean;
|
|
591
|
-
onMobile: boolean;
|
|
592
|
-
position: string;
|
|
593
|
-
dismissible: boolean;
|
|
594
|
-
requiresInteraction: boolean;
|
|
595
|
-
toVideoThreshold: number;
|
|
596
|
-
toFloatThreshold: number;
|
|
597
|
-
style: {
|
|
598
|
-
width: number;
|
|
599
|
-
border: string;
|
|
600
|
-
};
|
|
601
|
-
};
|
|
602
|
-
controls?: {
|
|
603
|
-
theaterButton?: boolean;
|
|
604
|
-
settingsButton?: boolean;
|
|
605
|
-
chromecastButton?: boolean;
|
|
606
|
-
nextButton?: boolean;
|
|
607
|
-
fullscreenButton?: boolean;
|
|
608
|
-
airplayButton?: boolean;
|
|
609
|
-
bigPlayButton?: boolean;
|
|
610
|
-
autopausePlayButton?: boolean;
|
|
611
|
-
pictureInPictureButton?: boolean;
|
|
612
|
-
relatedButton?: boolean;
|
|
613
|
-
volumeButton?: boolean;
|
|
614
|
-
shareButton?: boolean;
|
|
615
|
-
subtitlesButton?: boolean;
|
|
616
|
-
showCaptions?: boolean;
|
|
617
|
-
};
|
|
618
|
-
logo?: {
|
|
619
|
-
state?: boolean;
|
|
620
|
-
file?: string;
|
|
621
|
-
position?: string;
|
|
622
|
-
defaultOpacity?: number;
|
|
623
|
-
inactiveOpacity?: number;
|
|
624
|
-
onClickURL?: string;
|
|
625
|
-
};
|
|
626
|
-
skin?: {
|
|
627
|
-
controlBar?: {
|
|
628
|
-
background?: string;
|
|
629
|
-
spread?: "solid" | "gradient";
|
|
630
|
-
gradientMidPoint?: number;
|
|
631
|
-
text?: string;
|
|
632
|
-
icons?: {
|
|
633
|
-
default?: string;
|
|
634
|
-
hover?: string;
|
|
635
|
-
};
|
|
636
|
-
timeslider?: {
|
|
637
|
-
progress?: string;
|
|
638
|
-
rail?: string;
|
|
639
|
-
buffer?: string;
|
|
640
|
-
dragger?: string;
|
|
641
|
-
};
|
|
642
|
-
timesliderOnAd?: {
|
|
643
|
-
progress?: string;
|
|
644
|
-
rail?: string;
|
|
645
|
-
buffer?: string;
|
|
646
|
-
dragger?: string;
|
|
647
|
-
};
|
|
648
|
-
volume?: {
|
|
649
|
-
dragger?: string;
|
|
650
|
-
progress?: string;
|
|
651
|
-
rail?: string;
|
|
652
|
-
notifier?: string;
|
|
653
|
-
};
|
|
654
|
-
};
|
|
655
|
-
menus?: {
|
|
656
|
-
background?: {
|
|
657
|
-
default?: string;
|
|
658
|
-
hover?: string;
|
|
659
|
-
};
|
|
660
|
-
links?: {
|
|
661
|
-
default?: string;
|
|
662
|
-
hover?: string;
|
|
663
|
-
};
|
|
664
|
-
autoplay?: {
|
|
665
|
-
autoplayOn?: string;
|
|
666
|
-
autoplayOff?: string;
|
|
667
|
-
};
|
|
668
|
-
};
|
|
669
|
-
nextVideo?: {
|
|
670
|
-
background?: string;
|
|
671
|
-
text?: string;
|
|
672
|
-
timeslider?: {
|
|
673
|
-
rail?: string;
|
|
674
|
-
progress?: string;
|
|
675
|
-
};
|
|
676
|
-
icons?: {
|
|
677
|
-
play?: {
|
|
678
|
-
default?: string;
|
|
679
|
-
hover?: string;
|
|
680
|
-
};
|
|
681
|
-
close?: string;
|
|
682
|
-
};
|
|
683
|
-
};
|
|
684
|
-
playlist?: {
|
|
685
|
-
background?: string;
|
|
686
|
-
text?: string;
|
|
687
|
-
icons?: {
|
|
688
|
-
arrows?: {
|
|
689
|
-
active?: string;
|
|
690
|
-
inactive?: string;
|
|
691
|
-
};
|
|
692
|
-
close?: string;
|
|
693
|
-
};
|
|
694
|
-
card?: {
|
|
695
|
-
background?: string;
|
|
696
|
-
title?: string;
|
|
697
|
-
duration?: {
|
|
698
|
-
text?: string;
|
|
699
|
-
background?: string;
|
|
700
|
-
};
|
|
701
|
-
icons?: {
|
|
702
|
-
play?: {
|
|
703
|
-
default?: string;
|
|
704
|
-
hover?: string;
|
|
705
|
-
};
|
|
706
|
-
};
|
|
707
|
-
};
|
|
708
|
-
};
|
|
709
|
-
};
|
|
710
|
-
lang?: {
|
|
711
|
-
locale?: string;
|
|
712
|
-
controls?: {
|
|
713
|
-
play?: string;
|
|
714
|
-
pause?: string;
|
|
715
|
-
next?: string;
|
|
716
|
-
replay?: string;
|
|
717
|
-
volume?: string;
|
|
718
|
-
mute?: string;
|
|
719
|
-
unmute?: string;
|
|
720
|
-
settings?: string;
|
|
721
|
-
theater?: string;
|
|
722
|
-
fullscreen?: string;
|
|
723
|
-
chromecast?: string;
|
|
724
|
-
airplay?: string;
|
|
725
|
-
pictureInPicture?: string;
|
|
726
|
-
related?: string;
|
|
727
|
-
skipIntro?: string;
|
|
728
|
-
skipAd?: string;
|
|
729
|
-
playlistTitle?: string;
|
|
730
|
-
upNext?: string;
|
|
731
|
-
live?: string;
|
|
732
|
-
continueAfterPause?: string;
|
|
733
|
-
};
|
|
734
|
-
settings?: {
|
|
735
|
-
quality?: string;
|
|
736
|
-
subtitles?: string;
|
|
737
|
-
autoplay?: string;
|
|
738
|
-
playbackRate?: string;
|
|
739
|
-
auto?: string;
|
|
740
|
-
off?: string;
|
|
741
|
-
normal?: string;
|
|
742
|
-
share?: string;
|
|
743
|
-
};
|
|
744
|
-
ads?: {
|
|
745
|
-
ad?: string;
|
|
746
|
-
skip?: string;
|
|
747
|
-
skipIn?: string;
|
|
748
|
-
visit?: string;
|
|
749
|
-
info?: string;
|
|
750
|
-
simultaneousAds?: string;
|
|
751
|
-
adAnnouncement?: string;
|
|
752
|
-
};
|
|
753
|
-
messages?: {
|
|
754
|
-
playbackErrorTitle?: string;
|
|
755
|
-
playbackErrorDescription?: string;
|
|
756
|
-
geoBlockedTitle?: string;
|
|
757
|
-
geoBlockedDescription?: string;
|
|
758
|
-
streamInterruptedTitle?: string;
|
|
759
|
-
streamInterruptedDescription?: string;
|
|
760
|
-
};
|
|
761
|
-
};
|
|
762
|
-
ads?: VPPlayerAdsConfig;
|
|
763
|
-
};
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
/**
|
|
767
|
-
* Interface for the VP Player context, providing methods and state for controlling the player.
|
|
479
|
+
* NOTE: The VP Player SDK does not ship with TypeScript types.
|
|
480
|
+
* This is our own type definition based on the official API documentation.
|
|
768
481
|
*
|
|
769
|
-
* @
|
|
770
|
-
|
|
771
|
-
export declare interface VPPlayerContextType {
|
|
772
|
-
showPlayer: (params: PlayerParams) => void;
|
|
773
|
-
hidePlayer: () => void;
|
|
774
|
-
isPlayerVisible: boolean;
|
|
775
|
-
playerParams: PlayerParams | null;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
/**
|
|
779
|
-
* Interface defining the context for VPPlayer.
|
|
780
|
-
*
|
|
781
|
-
* @interface VPPlayerContextType
|
|
782
|
-
*/
|
|
783
|
-
declare interface VPPlayerContextType_2 {
|
|
784
|
-
showPlayer: (params: PlayerParams_2) => void;
|
|
785
|
-
hidePlayer: () => void;
|
|
786
|
-
isPlayerVisible: boolean;
|
|
787
|
-
playerParams: PlayerParams_2 | null;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
/**
|
|
791
|
-
* Interface representing an instance of the VP Player.
|
|
792
|
-
* Based on VP Player API Reference: https://vp.gjirafa.tech/documentation/docs/web-player/api-reference
|
|
793
|
-
* And VP Vertical Player API Reference: https://vp.gjirafa.tech/documentation/docs/vertical-player/api-reference
|
|
482
|
+
* @see https://vp.gjirafa.tech/documentation/docs/web-player/api-reference
|
|
483
|
+
* @see https://vp.gjirafa.tech/documentation/docs/vertical-player/api-reference
|
|
794
484
|
*
|
|
795
|
-
* @interface
|
|
485
|
+
* @interface VPPlayerInstance
|
|
796
486
|
*/
|
|
797
487
|
export declare interface VPPlayerInstance {
|
|
798
|
-
setup: (config:
|
|
488
|
+
setup: (config: unknown) => void;
|
|
799
489
|
destroy?: () => void;
|
|
800
490
|
play?: () => void;
|
|
801
491
|
pause?: () => void;
|
|
@@ -809,8 +499,6 @@ export declare interface VPPlayerInstance {
|
|
|
809
499
|
exitFullScreen?: () => void;
|
|
810
500
|
enterFullscreen?: () => void;
|
|
811
501
|
exitFullscreen?: () => void;
|
|
812
|
-
enterPictureInPicture?: () => void;
|
|
813
|
-
exitPictureInPicture?: () => void;
|
|
814
502
|
togglePlay?: () => void;
|
|
815
503
|
toggleMute?: () => void;
|
|
816
504
|
isMuted?: () => boolean;
|
|
@@ -824,7 +512,7 @@ export declare interface VPPlayerInstance {
|
|
|
824
512
|
getVolume?: () => number;
|
|
825
513
|
getContainer?: () => HTMLElement;
|
|
826
514
|
getDuration?: () => number;
|
|
827
|
-
getConfig?: () =>
|
|
515
|
+
getConfig?: () => unknown;
|
|
828
516
|
getQualityLevels?: () => unknown[];
|
|
829
517
|
getCurrentQuality?: () => number;
|
|
830
518
|
checkViewability?: () => boolean;
|
|
@@ -852,68 +540,192 @@ export declare interface VPPlayerInstance {
|
|
|
852
540
|
}
|
|
853
541
|
|
|
854
542
|
/**
|
|
855
|
-
*
|
|
543
|
+
* Simplified props interface for VPPlayer v2.0.0
|
|
856
544
|
*
|
|
857
|
-
*
|
|
545
|
+
* The wrapper is now a thin bridge to the GTech JS player.
|
|
546
|
+
* All configuration is managed through the GTech admin panel.
|
|
547
|
+
*
|
|
548
|
+
* @interface VPPlayerProps
|
|
858
549
|
*/
|
|
859
550
|
export declare interface VPPlayerProps {
|
|
860
|
-
|
|
861
|
-
|
|
551
|
+
/**
|
|
552
|
+
* GTech script ID (e.g., 'ptkzurnx')
|
|
553
|
+
* Used with videoId to build the fully managed script URL
|
|
554
|
+
*/
|
|
555
|
+
scriptId?: string;
|
|
556
|
+
/**
|
|
557
|
+
* GTech video ID (e.g., 'vjsobqhe')
|
|
558
|
+
* Used with scriptId to build the fully managed script URL
|
|
559
|
+
*/
|
|
862
560
|
videoId?: string;
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
561
|
+
/**
|
|
562
|
+
* Full managed script URL (alternative to scriptId + videoId)
|
|
563
|
+
* @example "https://host.vpplayer.tech/player/ptkzurnx/vjsobqhe.js"
|
|
564
|
+
*/
|
|
866
565
|
scriptUrl?: string;
|
|
867
|
-
|
|
566
|
+
/**
|
|
567
|
+
* GTech project ID (required for manual playlist mode)
|
|
568
|
+
*/
|
|
569
|
+
projectId?: string;
|
|
570
|
+
/**
|
|
571
|
+
* Manual playlist configuration - provide your own videos array.
|
|
572
|
+
* When provided, the wrapper will call setup() with the built config
|
|
573
|
+
* instead of relying on auto-initialization.
|
|
574
|
+
*
|
|
575
|
+
* IMPORTANT: This is required for vertical player when you want to
|
|
576
|
+
* supply your own videos (not using GTech admin playlists).
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```tsx
|
|
580
|
+
* <VPPlayer
|
|
581
|
+
* scriptId="rbqcdwzlg"
|
|
582
|
+
* projectId="agmipnzb"
|
|
583
|
+
* isVertical={true}
|
|
584
|
+
* playlist={{
|
|
585
|
+
* videos: [
|
|
586
|
+
* { videoId: "1", title: "Video 1", file: "https://...mp4", thumbnailUrl: "...", duration: 120 },
|
|
587
|
+
* { videoId: "2", title: "Video 2", file: "https://...mp4", thumbnailUrl: "...", duration: 150 },
|
|
588
|
+
* ],
|
|
589
|
+
* startIndex: 0,
|
|
590
|
+
* }}
|
|
591
|
+
* />
|
|
592
|
+
* ```
|
|
593
|
+
*/
|
|
594
|
+
playlist?: ManualPlaylistConfig;
|
|
595
|
+
/**
|
|
596
|
+
* Custom container ID for the player div
|
|
597
|
+
* Auto-generated if not provided
|
|
598
|
+
*/
|
|
599
|
+
playerId?: string;
|
|
600
|
+
/**
|
|
601
|
+
* Use vertical player script URL builder
|
|
602
|
+
* When true, uses /vertical-player/{scriptId}.js pattern
|
|
603
|
+
*/
|
|
604
|
+
isVertical?: boolean;
|
|
605
|
+
/**
|
|
606
|
+
* Enable Reels/TikTok-style overlay mode
|
|
607
|
+
* Shows thumbnail first, then fullscreen overlay when clicked
|
|
608
|
+
*/
|
|
868
609
|
isReels?: boolean;
|
|
610
|
+
/**
|
|
611
|
+
* Thumbnail URL for Reels mode
|
|
612
|
+
*/
|
|
869
613
|
thumbnailUrl?: string;
|
|
614
|
+
/**
|
|
615
|
+
* Callback when Reels overlay is closed
|
|
616
|
+
*/
|
|
870
617
|
onClose?: () => void;
|
|
871
|
-
|
|
872
|
-
|
|
618
|
+
/**
|
|
619
|
+
* Additional CSS class name for the player container
|
|
620
|
+
*/
|
|
873
621
|
className?: string;
|
|
874
622
|
/**
|
|
875
|
-
*
|
|
876
|
-
*
|
|
877
|
-
* controls, autoplay, muted, size, and other configuration.
|
|
878
|
-
* Set to false to use legacy behavior with wrapper defaults.
|
|
879
|
-
* @default true
|
|
623
|
+
* CSS classes to hide specific SDK elements
|
|
624
|
+
* @example ['vp-share-button', 'vp-logo']
|
|
880
625
|
*/
|
|
881
|
-
|
|
882
|
-
onPlaylistData?: (videos: PlaylistItem_2[]) => void;
|
|
883
|
-
onVideoStarted?: (videoData: CurrentVideoData_2) => void;
|
|
626
|
+
hiddenClasses?: string[];
|
|
884
627
|
/**
|
|
885
|
-
*
|
|
628
|
+
* Called when the player is ready/initialized
|
|
886
629
|
*/
|
|
887
|
-
|
|
888
|
-
onPlayerStart?: PlayerEventCallbacks_2["onPlayerStart"];
|
|
889
|
-
onPlayerPlay?: PlayerEventCallbacks_2["onPlayerPlay"];
|
|
890
|
-
onPlayerPause?: PlayerEventCallbacks_2["onPlayerPause"];
|
|
891
|
-
onPlayerResume?: PlayerEventCallbacks_2["onPlayerResume"];
|
|
892
|
-
onPlayerEnd?: PlayerEventCallbacks_2["onPlayerEnd"];
|
|
893
|
-
onPlayerProgressEvery10Seconds?: PlayerEventCallbacks_2["onPlayerProgressEvery10Seconds"];
|
|
894
|
-
onPlayerProgressAt20Seconds?: PlayerEventCallbacks_2["onPlayerProgressAt20Seconds"];
|
|
895
|
-
onPlayerQuartile25?: PlayerEventCallbacks_2["onPlayerQuartile25"];
|
|
896
|
-
onPlayerQuartile50?: PlayerEventCallbacks_2["onPlayerQuartile50"];
|
|
897
|
-
onPlayerQuartile75?: PlayerEventCallbacks_2["onPlayerQuartile75"];
|
|
898
|
-
onPlayerNext?: PlayerEventCallbacks_2["onPlayerNext"];
|
|
899
|
-
onPlayerPrevious?: PlayerEventCallbacks_2["onPlayerPrevious"];
|
|
630
|
+
onReady?: () => void;
|
|
900
631
|
/**
|
|
901
|
-
*
|
|
902
|
-
|
|
632
|
+
* Called when playback starts
|
|
633
|
+
*/
|
|
634
|
+
onPlay?: () => void;
|
|
635
|
+
/**
|
|
636
|
+
* Called when playback is paused
|
|
637
|
+
*/
|
|
638
|
+
onPause?: () => void;
|
|
639
|
+
/**
|
|
640
|
+
* Called when playback resumes after pause
|
|
641
|
+
*/
|
|
642
|
+
onResume?: () => void;
|
|
643
|
+
/**
|
|
644
|
+
* Called when video playback completes
|
|
645
|
+
*/
|
|
646
|
+
onComplete?: () => void;
|
|
647
|
+
/**
|
|
648
|
+
* Called when an error occurs
|
|
903
649
|
*/
|
|
904
|
-
|
|
650
|
+
onError?: (error: string) => void;
|
|
651
|
+
/**
|
|
652
|
+
* Called when a video starts playing
|
|
653
|
+
* Provides metadata about the current video
|
|
654
|
+
*/
|
|
655
|
+
onVideoStarted?: (data: CurrentVideoData_2) => void;
|
|
656
|
+
/**
|
|
657
|
+
* Called on time updates during playback
|
|
658
|
+
* @param seconds - Current playback position in seconds
|
|
659
|
+
*/
|
|
660
|
+
onTimeUpdate?: (seconds: number) => void;
|
|
661
|
+
/**
|
|
662
|
+
* Called when playback reaches 25% of video duration
|
|
663
|
+
*/
|
|
664
|
+
onQuartile25?: () => void;
|
|
665
|
+
/**
|
|
666
|
+
* Called when playback reaches 50% of video duration
|
|
667
|
+
*/
|
|
668
|
+
onQuartile50?: () => void;
|
|
669
|
+
/**
|
|
670
|
+
* Called when playback reaches 75% of video duration
|
|
671
|
+
*/
|
|
672
|
+
onQuartile75?: () => void;
|
|
673
|
+
/**
|
|
674
|
+
* Called when transitioning to the next video in playlist
|
|
675
|
+
*/
|
|
676
|
+
onNext?: () => void;
|
|
677
|
+
/**
|
|
678
|
+
* Called when transitioning to the previous video in playlist
|
|
679
|
+
*/
|
|
680
|
+
onPrevious?: () => void;
|
|
681
|
+
/**
|
|
682
|
+
* Called every 10 seconds during playback
|
|
683
|
+
* @param seconds - Current playback position in seconds
|
|
684
|
+
*/
|
|
685
|
+
onProgress10s?: (seconds: number) => void;
|
|
686
|
+
/**
|
|
687
|
+
* Called when playback reaches 20 seconds
|
|
688
|
+
* @param seconds - Current playback position (should be ~20)
|
|
689
|
+
*/
|
|
690
|
+
onProgress20s?: (seconds: number) => void;
|
|
905
691
|
}
|
|
906
692
|
|
|
907
693
|
/**
|
|
908
|
-
*
|
|
694
|
+
* Interface for the imperative handle exposed by VPPlayer via ref.
|
|
695
|
+
* Use this to call player methods from parent components.
|
|
909
696
|
*
|
|
910
|
-
* @
|
|
911
|
-
*
|
|
912
|
-
*
|
|
913
|
-
*
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
697
|
+
* @example
|
|
698
|
+
* ```tsx
|
|
699
|
+
* const playerRef = useRef<VPPlayerRef>(null);
|
|
700
|
+
*
|
|
701
|
+
* <VPPlayer ref={playerRef} scriptId="..." videoId="..." />
|
|
702
|
+
*
|
|
703
|
+
* // Later:
|
|
704
|
+
* playerRef.current?.seek(60);
|
|
705
|
+
* playerRef.current?.play();
|
|
706
|
+
* ```
|
|
707
|
+
*/
|
|
708
|
+
export declare interface VPPlayerRef {
|
|
709
|
+
play: () => void;
|
|
710
|
+
pause: () => void;
|
|
711
|
+
seek: (position: number) => void;
|
|
712
|
+
forward: () => void;
|
|
713
|
+
rewind: () => void;
|
|
714
|
+
replay: () => void;
|
|
715
|
+
mute: () => void;
|
|
716
|
+
unmute: () => void;
|
|
717
|
+
togglePlay: () => void;
|
|
718
|
+
toggleMute: () => void;
|
|
719
|
+
enterFullScreen: () => void;
|
|
720
|
+
exitFullScreen: () => void;
|
|
721
|
+
getPosition: () => number | null;
|
|
722
|
+
getDuration: () => number | null;
|
|
723
|
+
getVolume: () => number | null;
|
|
724
|
+
setVolume: (volume: number) => void;
|
|
725
|
+
isMuted: () => boolean;
|
|
726
|
+
isPlaying: () => boolean;
|
|
727
|
+
isPaused: () => boolean;
|
|
728
|
+
isFullscreen: () => boolean;
|
|
729
|
+
}
|
|
918
730
|
|
|
919
731
|
export { }
|