@devix-technologies/react-gjirafa-vp-player 1.0.31-beta.6 → 1.0.31-beta.9

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 CHANGED
@@ -157,24 +157,39 @@ The player fills its container (100% width/height). Control sizing with a wrappe
157
157
 
158
158
  ### Event Callbacks
159
159
 
160
- | Prop | Description |
161
- |------|-------------|
162
- | `onReady` | Player initialized |
163
- | `onPlay` | Playback started |
164
- | `onPause` | Playback paused |
165
- | `onResume` | Playback resumed |
166
- | `onComplete` | Video completed |
167
- | `onError` | Error occurred |
168
- | `onVideoStarted` | Video metadata available |
169
- | `onTimeUpdate` | Continuous time updates |
170
- | `onQuartile25` | 25% watched |
171
- | `onQuartile50` | 50% watched |
172
- | `onQuartile75` | 75% watched |
173
- | `onNext` | Next video in playlist |
174
- | `onPrevious` | Previous video |
175
- | `onProgress10s` | Every 10 seconds |
176
- | `onProgress20s` | 20 second milestone |
177
- | `onClose` | Reels overlay closed |
160
+ | Prop | Horizontal | Vertical | Description |
161
+ |------|:----------:|:--------:|-------------|
162
+ | `onReady` | ✓ | ✓ | Player initialized |
163
+ | `onPlay` | ✓ | ✓ | Playback started |
164
+ | `onPause` | ✓ | ✓ | Playback paused |
165
+ | `onComplete` | | | Video completed (horizontal only) |
166
+ | `onError` | | | Error occurred |
167
+ | `onVideoStarted` | | | Video metadata available (returns `CurrentVideoData`) |
168
+ | `onTimeUpdate` | | | Continuous time updates (returns seconds) |
169
+ | `onQuartile25` | | | 25% watched |
170
+ | `onQuartile50` | ✓ | ✓ | 50% watched |
171
+ | `onQuartile75` | ✓ | ✓ | 75% watched |
172
+ | `onNext` | | | Next video in playlist |
173
+ | `onPrevious` | | ✓ | Previous video (vertical only) |
174
+ | `onProgress10s` | | | Every ~10 seconds (returns seconds) |
175
+ | `onProgress20s` | | ✓ | 20 second milestone (returns seconds) |
176
+ | `onClose` | - | - | Reels overlay closed |
177
+
178
+ #### Event Implementation Notes
179
+
180
+ **Horizontal Player** uses standard VP Player SDK events:
181
+ - `ready`, `play`, `pause`, `complete`, `video-started`, `video-state`, `time`, `playlistItem`, `error`
182
+ - Quartiles: `analytics-25%-completed`, `analytics-50%-completed`, `analytics-75%-completed`
183
+
184
+ **Vertical Player** uses VP Vertical Player SDK events (different naming):
185
+ - `vp-ready`, `playing`, `pause`, `vp-video-started`, `vp-video-state`, `vp-time`, `vp-video-switch`, `error`
186
+ - Quartiles: `analytics-25%-completed`, `analytics-50%-completed`, `analytics-75%-completed`
187
+ - Direction detection: Uses `player._switchDirection` property (via `queueMicrotask`) to differentiate `onNext` vs `onPrevious`
188
+
189
+ **Key Differences:**
190
+ - `onComplete` - Only available on horizontal player (vertical auto-advances)
191
+ - `onPrevious` - Only available on vertical player (horizontal has no direction detection)
192
+ - `onNext` on horizontal fires for ANY playlist change (next button, auto-advance after complete)
178
193
 
179
194
  ## URL Helpers
180
195
 
package/dist/index.d.ts CHANGED
@@ -251,10 +251,9 @@ export declare type DeepPartial<T> = T extends object ? {
251
251
  * Prevents stale closures in event handlers
252
252
  */
253
253
  export declare interface EventCallbackRefs {
254
- onReady?: () => void;
255
- onPlay?: () => void;
254
+ onReady?: (data?: CurrentVideoData_2) => void;
255
+ onPlay?: (data?: CurrentVideoData_2) => void;
256
256
  onPause?: () => void;
257
- onResume?: () => void;
258
257
  onComplete?: () => void;
259
258
  onError?: (error: string) => void;
260
259
  onVideoStarted?: (data: CurrentVideoData_2) => void;
@@ -725,7 +724,7 @@ export declare interface TimesliderSkin {
725
724
  * 1. **Auto-init mode** (default): Load managed script that auto-initializes with GTech admin config
726
725
  * 2. **Config override mode**: Fetch config, merge user overrides, and call setup()
727
726
  */
728
- export declare const useVPPlayerLogic: ({ scriptId, videoId, scriptUrl, projectId, config, playerId, isVertical, isReels, onReady, onPlay, onPause, onResume, onComplete, onError, onVideoStarted, onTimeUpdate, onQuartile25, onQuartile50, onQuartile75, onNext, onPrevious, onProgress10s, onProgress20s, }: VPPlayerProps_2) => {
727
+ export declare const useVPPlayerLogic: ({ scriptId, videoId, scriptUrl, projectId, config, playerId, isVertical, isReels, onReady, onPlay, onPause, onComplete, onError, onVideoStarted, onTimeUpdate, onQuartile25, onQuartile50, onQuartile75, onNext, onPrevious, onProgress10s, onProgress20s, }: VPPlayerProps_2) => {
729
728
  playerRef: RefObject<HTMLDivElement | null>;
730
729
  playerInstanceRef: RefObject<VPPlayerInstance_2 | null>;
731
730
  isScriptLoaded: boolean;
@@ -1084,20 +1083,18 @@ export declare interface VPPlayerProps {
1084
1083
  hiddenClasses?: string[];
1085
1084
  /**
1086
1085
  * Called when the player is ready/initialized
1086
+ * @param data - Optional video metadata (available in vertical player)
1087
1087
  */
1088
- onReady?: () => void;
1088
+ onReady?: (data?: CurrentVideoData_2) => void;
1089
1089
  /**
1090
1090
  * Called when playback starts
1091
+ * @param data - Optional video metadata (available in vertical player)
1091
1092
  */
1092
- onPlay?: () => void;
1093
+ onPlay?: (data?: CurrentVideoData_2) => void;
1093
1094
  /**
1094
1095
  * Called when playback is paused
1095
1096
  */
1096
1097
  onPause?: () => void;
1097
- /**
1098
- * Called when playback resumes after pause
1099
- */
1100
- onResume?: () => void;
1101
1098
  /**
1102
1099
  * Called when video playback completes
1103
1100
  */