@devix-technologies/react-gjirafa-vp-player 1.0.31-beta.3 → 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/dist/index.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  import { CurrentVideoData as CurrentVideoData_2 } from '../../../../../../../src/types';
2
2
  import { DetailedHTMLProps } from 'react';
3
+ import { ForwardRefExoticComponent } from 'react';
3
4
  import { HTMLAttributes } from 'react';
4
- import { JSX } from 'react/jsx-runtime';
5
+ import { RefAttributes } from 'react';
5
6
  import { RefObject } from 'react';
6
7
  import { StyledComponent } from '@emotion/styled';
7
8
  import { Theme } from '@emotion/react';
8
9
  import { VPPlayerInstance as VPPlayerInstance_2 } from '../../../../../../../src/interfaces';
9
10
  import { VPPlayerProps as VPPlayerProps_2 } from '../../../../../../../src/interfaces';
11
+ import { VPPlayerRef as VPPlayerRef_2 } from '../../../../../../../src/interfaces';
10
12
 
11
13
  /**
12
14
  * Appends the divId query parameter to a script URL.
@@ -386,6 +388,23 @@ export declare const VP_PLAYER_BASE_URL = "https://host.vpplayer.tech";
386
388
  * />
387
389
  * ```
388
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
+ *
389
408
  * ## Manual Playlist Mode (Vertical Player)
390
409
  *
391
410
  * For vertical player with custom videos array:
@@ -422,7 +441,7 @@ export declare const VP_PLAYER_BASE_URL = "https://host.vpplayer.tech";
422
441
  *
423
442
  * @param props - VPPlayer configuration props
424
443
  */
425
- export declare const VPPlayer: ({ scriptId, videoId, scriptUrl, projectId, playlist, playerId, isVertical, isReels, thumbnailUrl, onClose, className, hiddenClasses, onReady, onPlay, onPause, onResume, onComplete, onError, onVideoStarted, onTimeUpdate, onQuartile25, onQuartile50, onQuartile75, onNext, onPrevious, onProgress10s, onProgress20s, }: VPPlayerProps_2) => JSX.Element;
444
+ export declare const VPPlayer: ForwardRefExoticComponent<VPPlayerProps_2 & RefAttributes<VPPlayerRef_2>>;
426
445
 
427
446
  /**
428
447
  * VP Player Configuration Types (v2.0.0)
@@ -456,8 +475,12 @@ export declare interface VPPlayerAdsConfig {
456
475
 
457
476
  /**
458
477
  * Interface representing an instance of the VP Player.
459
- * Based on VP Player API Reference: https://vp.gjirafa.tech/documentation/docs/web-player/api-reference
460
- * And VP Vertical Player API Reference: https://vp.gjirafa.tech/documentation/docs/vertical-player/api-reference
478
+ *
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.
481
+ *
482
+ * @see https://vp.gjirafa.tech/documentation/docs/web-player/api-reference
483
+ * @see https://vp.gjirafa.tech/documentation/docs/vertical-player/api-reference
461
484
  *
462
485
  * @interface VPPlayerInstance
463
486
  */
@@ -476,8 +499,6 @@ export declare interface VPPlayerInstance {
476
499
  exitFullScreen?: () => void;
477
500
  enterFullscreen?: () => void;
478
501
  exitFullscreen?: () => void;
479
- enterPictureInPicture?: () => void;
480
- exitPictureInPicture?: () => void;
481
502
  togglePlay?: () => void;
482
503
  toggleMute?: () => void;
483
504
  isMuted?: () => boolean;
@@ -669,4 +690,42 @@ export declare interface VPPlayerProps {
669
690
  onProgress20s?: (seconds: number) => void;
670
691
  }
671
692
 
693
+ /**
694
+ * Interface for the imperative handle exposed by VPPlayer via ref.
695
+ * Use this to call player methods from parent components.
696
+ *
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
+ }
730
+
672
731
  export { }