unified-video-framework 1.4.356 → 1.4.358

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 (35) hide show
  1. package/package.json +1 -1
  2. package/packages/core/dist/interfaces/IVideoPlayer.d.ts +1 -0
  3. package/packages/core/dist/interfaces/IVideoPlayer.d.ts.map +1 -1
  4. package/packages/core/dist/interfaces.d.ts +1 -1
  5. package/packages/core/dist/interfaces.d.ts.map +1 -1
  6. package/packages/core/src/interfaces/IVideoPlayer.ts +2 -1
  7. package/packages/core/src/interfaces.ts +3 -2
  8. package/packages/web/dist/WebPlayer.d.ts.map +1 -1
  9. package/packages/web/dist/WebPlayer.js +13 -0
  10. package/packages/web/dist/WebPlayer.js.map +1 -1
  11. package/packages/web/dist/chapters/ChapterManager.d.ts +3 -0
  12. package/packages/web/dist/chapters/ChapterManager.d.ts.map +1 -1
  13. package/packages/web/dist/chapters/ChapterManager.js +21 -1
  14. package/packages/web/dist/chapters/ChapterManager.js.map +1 -1
  15. package/packages/web/dist/chapters/SkipButtonController.d.ts +4 -1
  16. package/packages/web/dist/chapters/SkipButtonController.d.ts.map +1 -1
  17. package/packages/web/dist/chapters/SkipButtonController.js +87 -19
  18. package/packages/web/dist/chapters/SkipButtonController.js.map +1 -1
  19. package/packages/web/dist/chapters/types/ChapterTypes.d.ts +13 -0
  20. package/packages/web/dist/chapters/types/ChapterTypes.d.ts.map +1 -1
  21. package/packages/web/dist/chapters/types/ChapterTypes.js.map +1 -1
  22. package/packages/web/dist/react/WebPlayerView.d.ts +10 -0
  23. package/packages/web/dist/react/WebPlayerView.d.ts.map +1 -1
  24. package/packages/web/dist/react/WebPlayerView.js +5 -1
  25. package/packages/web/dist/react/WebPlayerView.js.map +1 -1
  26. package/packages/web/dist/react/components/SkipButton.d.ts +2 -0
  27. package/packages/web/dist/react/components/SkipButton.d.ts.map +1 -1
  28. package/packages/web/dist/react/components/SkipButton.js +30 -13
  29. package/packages/web/dist/react/components/SkipButton.js.map +1 -1
  30. package/packages/web/src/WebPlayer.ts +8862 -8847
  31. package/packages/web/src/chapters/ChapterManager.ts +62 -17
  32. package/packages/web/src/chapters/SkipButtonController.ts +116 -30
  33. package/packages/web/src/chapters/types/ChapterTypes.ts +53 -32
  34. package/packages/web/src/react/WebPlayerView.tsx +14 -1
  35. package/packages/web/src/react/components/SkipButton.tsx +82 -24
@@ -45,6 +45,12 @@ export interface SkipButtonProps {
45
45
 
46
46
  /** Auto-skip delay in seconds */
47
47
  autoSkipDelay?: number;
48
+
49
+ /** Secondary action label (e.g., "Watch Credits") */
50
+ secondaryLabel?: string;
51
+
52
+ /** Callback for secondary action */
53
+ onSecondaryAction?: (segment: VideoSegment) => void;
48
54
  }
49
55
 
50
56
  export const SkipButton: React.FC<SkipButtonProps> = ({
@@ -59,7 +65,9 @@ export const SkipButton: React.FC<SkipButtonProps> = ({
59
65
  className = '',
60
66
  style = {},
61
67
  enableAutoSkip = false,
62
- autoSkipDelay = 10
68
+ autoSkipDelay = 10,
69
+ secondaryLabel,
70
+ onSecondaryAction
63
71
  }) => {
64
72
  // State
65
73
  const [isVisible, setIsVisible] = useState(visible);
@@ -130,6 +138,33 @@ export const SkipButton: React.FC<SkipButtonProps> = ({
130
138
  handleHide('user-action');
131
139
  };
132
140
 
141
+ /**
142
+ * Handle secondary button click
143
+ */
144
+ const handleSecondary = (e: React.MouseEvent) => {
145
+ e.stopPropagation(); // Prevent bubbling
146
+ if (!segment) return;
147
+
148
+ // Stop auto-skip and countdown
149
+ clearTimeouts();
150
+ setIsAutoSkip(false);
151
+ setCountdown(null);
152
+
153
+ // Call callback
154
+ onSecondaryAction?.(segment);
155
+
156
+ // We DON'T hide the button immediately for "Watch Credits",
157
+ // we just stop the auto-skip countdown. User can still click "Next Episode" later.
158
+ // But typically "Watch Credits" implies dismissing the "Next Episode" urgency.
159
+ // If we want to hide it:
160
+ // handleHide('user-secondary-action');
161
+
162
+ // For now, let's keep it visible but stop the countdown so they can click 'Next' later if they want,
163
+ // OR we can hide it if that's the desired UX.
164
+ // Based on Netflix UX: "Watch Credits" usually minimizes the overlay.
165
+ // Here we'll just stop the auto-skip.
166
+ };
167
+
133
168
  /**
134
169
  * Handle button show
135
170
  */
@@ -248,31 +283,54 @@ export const SkipButton: React.FC<SkipButtonProps> = ({
248
283
  }
249
284
 
250
285
  return (
251
- <button
252
- type="button"
253
- className={buttonClasses}
254
- style={defaultStyles}
255
- onClick={handleSkip}
256
- aria-label={`${buttonText} - ${segment.title || segment.type}`}
257
- >
258
- {displayText}
259
-
260
- {/* Progress bar for auto-skip countdown */}
261
- {isAutoSkip && countdown !== null && (
262
- <div
263
- className="uvf-skip-countdown-progress"
286
+ <div className={`uvf-skip-container ${positionClass} ${className}`} style={defaultStyles}>
287
+ {/* Secondary Button (Watch Credits) */}
288
+ {secondaryLabel && (
289
+ <button
290
+ type="button"
291
+ className="uvf-skip-button uvf-skip-secondary"
292
+ onClick={handleSecondary}
264
293
  style={{
265
- position: 'absolute',
266
- bottom: 0,
267
- left: 0,
268
- height: '3px',
269
- backgroundColor: 'currentColor',
270
- width: `${((autoSkipDelay - countdown) / autoSkipDelay) * 100}%`,
271
- transition: 'width 1s linear',
272
- borderRadius: '0 0 6px 6px'
294
+ marginRight: '10px',
295
+ backgroundColor: 'rgba(0, 0, 0, 0.7)',
296
+ border: '1px solid rgba(255, 255, 255, 0.5)',
297
+ color: '#fff',
298
+ ...style
273
299
  }}
274
- />
300
+ >
301
+ {secondaryLabel}
302
+ </button>
275
303
  )}
276
- </button>
304
+
305
+ {/* Primary Button (Next Episode / Skip) */}
306
+ <button
307
+ type="button"
308
+ className={buttonClasses}
309
+ // style is applied to container now, but we keep button specific classes
310
+ // We need to adjust styles since we are wrapping in a div now
311
+ style={{ pointerEvents: 'auto' }}
312
+ onClick={handleSkip}
313
+ aria-label={`${buttonText} - ${segment.title || segment.type}`}
314
+ >
315
+ {displayText}
316
+
317
+ {/* Progress bar for auto-skip countdown */}
318
+ {isAutoSkip && countdown !== null && (
319
+ <div
320
+ className="uvf-skip-countdown-progress"
321
+ style={{
322
+ position: 'absolute',
323
+ bottom: 0,
324
+ left: 0,
325
+ height: '3px',
326
+ backgroundColor: 'currentColor',
327
+ width: `${((autoSkipDelay - countdown) / autoSkipDelay) * 100}%`,
328
+ transition: 'width 1s linear',
329
+ borderRadius: '0 0 6px 6px'
330
+ }}
331
+ />
332
+ )}
333
+ </button>
334
+ </div>
277
335
  );
278
336
  };