@devix-technologies/react-gjirafa-vp-player 1.0.24 → 1.0.27

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
@@ -114,7 +114,6 @@ interface VPPlayerProps {
114
114
  projectId?: string; // Project ID for API calls (used with videoId or playlistId)
115
115
  playlistId?: string; // Playlist ID for fetching a playlist from API
116
116
  config?: Partial<VPPlayerConfig>; // Optional partial configuration to override defaults
117
- apiKey?: string; // Optional API key for VP player requests; falls back to VP_API_KEY from .env if not provided.
118
117
  isReels?: boolean; // Optional flag to enable Reels/iShorties mode (defaults to false)
119
118
  thumbnailUrl?: string; // Optional URL to a thumbnail image for Reels mode
120
119
  hiddenClasses?: string[]; // Optional array of CSS class names to hide specific player elements
@@ -171,10 +170,6 @@ interface VPPlayerProps {
171
170
 
172
171
  - Optional partial configuration object to override the default `VPPlayerConfig`. Allows customization of player behavior and settings.
173
172
 
174
- ### **apiKey?: string**
175
-
176
- - Optional API key for VP Player API requests. Falls back to `VITE_VP_API_KEY` from `.env` if not provided. A warning is logged if missing for API-based configurations.
177
-
178
173
  ### **isReels?: boolean**
179
174
 
180
175
  - Optional flag to enable Reels/iShorties mode, optimizing the player for short vertical video playback (e.g., 9:16 aspect ratio). Defaults to `false`.
@@ -218,7 +213,6 @@ interface VPPlayerProps {
218
213
  playerId="player"
219
214
  projectId="agmipnzb"
220
215
  playlistId="lzxikgjw"
221
- apiKey="YOUR_API_KEY"
222
216
  onPlaylistData={(videos) => {
223
217
  console.log('Playlist loaded:', videos.length, 'videos');
224
218
  console.log('Main videos:', videos.filter(v => !v.isBackupPlaylist).length);
@@ -276,7 +270,6 @@ interface VPPlayerProps {
276
270
  playlistId="lzxikgjw"
277
271
  scriptUrl="https://host.vpplayer.tech/vertical-player/rbqcdwznd.js"
278
272
  isReels={true}
279
- apiKey="YOUR_API_KEY"
280
273
  onVideoStarted={(videoData) => {
281
274
  console.log('Video changed:', videoData.title);
282
275
  console.log('Video index:', videoData.videoIndex);
@@ -292,7 +285,6 @@ interface VPPlayerProps {
292
285
  projectId="agmipnzb"
293
286
  videoId="vjsnuhvm"
294
287
  scriptUrl="https://host.vpplayer.tech/player/ptkzurnx.js"
295
- apiKey="YOUR_API_KEY"
296
288
  onVideoStarted={(videoData) => {
297
289
  console.log('Video started:', videoData.title);
298
290
  console.log('Author:', videoData.author);
@@ -319,46 +311,6 @@ interface VPPlayerProps {
319
311
 
320
312
  2. Player Setup: Once the script is loaded and the DOM element is rendered, the vpPlayer function is called with the element's ID and the final configuration.
321
313
 
322
- ### API Key Usage
323
-
324
- The API key can be provided via the apiKey prop or the VITE_VP_API_KEY environment variable, with props taking precedence, and a warning is logged if neither is supplied for API requests.
325
-
326
- - **Source:**
327
- - Props (`apiKey`) or `.env` (`VITE_VP_API_KEY`).
328
- - **Priority:**
329
- - Props > `.env`.
330
- - **Fallback:**
331
- - Optional, e.g., `'FALLBACK_TEST_KEY'`.
332
- - **Warning:**
333
- - Logged if missing for API calls.
334
-
335
- ### Setting up the API Key
336
-
337
- #### Step 1: Create a .env File
338
-
339
- In the root of your project, create a `.env` file (or update an existing one) and add the following line:
340
-
341
- ```bash
342
- VITE_VP_API_KEY=YOUR_API_KEY_HERE
343
- ```
344
-
345
- Replace `YOUR_API_KEY_HERE` with your actual API key.
346
-
347
- The VPPlayer component will automatically use the `VITE_VP_API_KEY` environment variable if the `apiKey` is not provided via props:
348
-
349
- ```bash
350
- import { VPPlayer } from "@dvxx/vp-player";
351
-
352
- const MyComponent = () => (
353
- <VPPlayer
354
- playerId="my-player"
355
- videoId="abcdefgh123"
356
- projectId="ijklmnop456"
357
- // apiKey will be read from VITE_VP_API_KEY since it is not passed
358
- />
359
- );
360
- ```
361
-
362
314
  ## Supported Data Input Types
363
315
 
364
316
  ## Supported Data Input Types
@@ -492,7 +444,6 @@ const MyPlaylistComponent = () => {
492
444
  playerId="my-playlist-player"
493
445
  projectId="agmipnzb"
494
446
  playlistId="lzxikgjw"
495
- apiKey="YOUR_API_KEY"
496
447
  onPlaylistData={(playlistVideos) => {
497
448
  setVideos(playlistVideos);
498
449
  console.log("Loaded videos:", playlistVideos.length);
@@ -516,7 +467,6 @@ Fires every time a video starts (scroll, click, auto-play). Perfect for analytic
516
467
  playlistId="lzxikgjw"
517
468
  scriptUrl="https://host.vpplayer.tech/vertical-player/rbqcdwznd.js"
518
469
  isReels={true}
519
- apiKey="YOUR_API_KEY"
520
470
  onVideoStarted={(videoData) => {
521
471
  // Fires on scroll or arrow navigation
522
472
  console.log("Now playing:", videoData.title);
@@ -540,7 +490,6 @@ Fires every time a video starts (scroll, click, auto-play). Perfect for analytic
540
490
  projectId="agmipnzb"
541
491
  videoId="vjsnuhvm"
542
492
  scriptUrl="https://host.vpplayer.tech/player/ptkzurnx.js"
543
- apiKey="YOUR_API_KEY"
544
493
  onVideoStarted={(videoData) => {
545
494
  // Fires on next/previous or auto-play
546
495
  // Full metadata fetched from API
@@ -594,7 +543,6 @@ const AdvancedPlayerComponent = () => {
594
543
  projectId="agmipnzb"
595
544
  playlistId="lzxikgjw"
596
545
  scriptUrl="https://host.vpplayer.tech/player/ptkzurnx.js"
597
- apiKey="YOUR_API_KEY"
598
546
  onPlaylistData={(videos) => {
599
547
  setPlaylistVideos(videos);
600
548
  console.log(`Playlist loaded: ${videos.length} videos`);
@@ -672,6 +620,44 @@ const handleAnalytics = (eventName: string, currentPosition?: number) => {
672
620
 
673
621
  ## Release Notes
674
622
 
623
+ ### v1.0.27
624
+ - **Fixes:**
625
+ - Fixed `getCurrentVideoData()` to support **2 data sources**: config-based playlist, and single video
626
+ - Fixed `onVideoStarted` callback to correctly return video data for config-based playlists
627
+ - **Features:**
628
+ - Improved video tracking for playlists passed directly via `config` prop
629
+
630
+ ### v1.0.26
631
+ - **Fixes:**
632
+ - Fixed **config-based playlist indexing** for vertical players - `onVideoStarted` now correctly reports video index on scroll.
633
+ - Fixed `getCurrentVideoData()` to properly handle playlists passed via `config.video.playlist.videos`.
634
+ - Improved `vpPlayerConfigBuilder` to use correct initial video based on `playlistVideoIndex`.
635
+ - **Refactor:**
636
+ - Removed `fetchedPlaylist` dependency from `useVPPlayerLogic` - all playlist data now flows through config.
637
+ - Cleaned up unused constants (`DEFAULT_PLAYLIST_ID` removed from exports).
638
+
639
+ ### v1.0.25 (unpublished)
640
+
641
+ ### v1.0.24
642
+ - **Fixes:**
643
+ - Fixed event tracking for vertical players with `isReels={false}`.
644
+ - Unified event listener setup logic - detection now based on `scriptUrl` instead of `isReels` prop.
645
+ - Fixed 400 Bad Request errors for horizontal player tracking by ensuring `projectId` is always included in config.
646
+ - Re-added `ready` and `playlistItem` event listeners for horizontal player navigation.
647
+ - **Features:**
648
+ - Full metadata fetching now works for both vertical and horizontal players.
649
+ - **Refactor:**
650
+ - Changed `DEFAULT_PROJECT_ID` to generic value for better reusability.
651
+ - Replaced `edge.vpplayer.tech` with `host.vpplayer.tech` for better performance.
652
+
653
+ ### v1.0.23
654
+ - **Features:**
655
+ - Enhanced **vertical player analytics** with improved event tracking.
656
+ - Added support for passing video arrays directly via `config.video.playlist.videos`.
657
+ - **Fixes:**
658
+ - Fixed duplicate event triggering in vertical player.
659
+ - Improved `player_start` and `player_play` event logic for `player_next`/`player_previous` actions.
660
+
675
661
  ### v1.0.22
676
662
  - **New Features:**
677
663
  - Added comprehensive **Analytics Event Callbacks** (`onPlayerStart`, `onPlayerPlay`, `onPlayerPause`, `onPlayerEnd`, etc.).