saltfish 0.2.78 → 0.3.0

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.
@@ -3111,6 +3111,11 @@ class StateMachineActionHandler {
3111
3111
  this.managers.videoManager.loadVideo(videoUrl).then(() => {
3112
3112
  log("StateMachineActionHandler: Video loaded successfully, playing");
3113
3113
  loadTranscriptForStep();
3114
+ if (isAudioFallback) {
3115
+ this.managers.videoManager.startAudioVisualization();
3116
+ } else {
3117
+ this.managers.videoManager.initializeAudioForVideo();
3118
+ }
3114
3119
  this.managers.videoManager.play();
3115
3120
  const nextVideoUrl = this.findNextVideoUrl(currentStep);
3116
3121
  if (nextVideoUrl) {
@@ -3172,6 +3177,9 @@ class StateMachineActionHandler {
3172
3177
  this.managers.videoManager.hideAudioFallbackOverlay();
3173
3178
  }
3174
3179
  this.managers.videoManager.loadVideo(videoUrl).then(() => {
3180
+ if (isAudioFallback) {
3181
+ this.managers.videoManager.startAudioVisualization();
3182
+ }
3175
3183
  const videoElement = this.managers.videoManager.getVideoElement();
3176
3184
  if (videoElement) {
3177
3185
  videoElement.muted = true;
@@ -3771,7 +3779,7 @@ let ManagerOrchestrator = _ManagerOrchestrator;
3771
3779
  const baseResetCss = "/* \n * CSS Reset for the Saltfish playlist Player\n * Minimal reset for the Shadow DOM to ensure consistent rendering\n */\n\n:host {\n all: initial;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;\n box-sizing: border-box;\n}\n\n:host *,\n:host *::before,\n:host *::after {\n box-sizing: inherit;\n margin: 0;\n padding: 0;\n}\n\nbutton {\n background: none;\n border: none;\n cursor: pointer;\n font: inherit;\n outline: none;\n padding: 0;\n}\n\n/* Utility classes for CSP-compliant styling */\n.sf-hidden {\n display: none !important;\n} ";
3772
3780
  const baseVariablesCss = "/* \n * Variables for the Saltfish playlist Player\n * Defines all design tokens used throughout the application\n */\n\n:host {\n /* Colors */\n --sf-primary-color: #4a9bff;\n --sf-secondary-color: #6ccfff;\n --sf-background-color: #1e1e1e;\n --sf-text-color: #ffffff;\n --sf-button-bg: rgba(0, 0, 0, 0.5);\n --sf-button-hover-bg: rgba(0, 0, 0, 0.7);\n --sf-overlay-gradient: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, 0.7) 100%);\n --sf-progress-gradient: linear-gradient(90deg, var(--sf-primary-color), var(--sf-secondary-color));\n --sf-error-color: #ff4d4d;\n --sf-error-bg: rgba(255, 77, 77, 0.1);\n \n /* Spacing */\n --sf-spacing-xs: 4px;\n --sf-spacing-sm: 8px;\n --sf-spacing-md: 12px;\n --sf-spacing-lg: 16px;\n --sf-spacing-xl: 24px;\n \n /* Sizes */\n --sf-player-width: 240px;\n --sf-player-height: 336px;\n --sf-player-min-width: 80px;\n --sf-player-min-height: 80px;\n --sf-player-compact-width: 120px;\n --sf-player-compact-height: 120px;\n --sf-control-button-size: 24px;\n --sf-play-button-size: 60px;\n --sf-play-button-compact-size: 44px;\n --sf-minimize-button-size: 34px;\n --sf-mute-button-size: 32px;\n --sf-cc-button-size: 32px;\n --sf-cursor-size: 32px;\n \n /* Border radius */\n --sf-border-radius-sm: 4px;\n --sf-border-radius-md: 8px;\n --sf-border-radius-lg: 16px;\n --sf-border-radius-circle: 50%;\n \n /* Transitions */\n --sf-transition-fast: 0.1s ease;\n --sf-transition-normal: 0.2s ease;\n --sf-transition-slow: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n \n /* Shadows */\n --sf-shadow-small: 0 2px 5px rgba(0, 0, 0, 0.2);\n --sf-shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.15);\n --sf-shadow-large: 0 10px 25px rgba(0, 0, 0, 0.2);\n \n /* Z-index layering */\n --sf-z-index-base: 1;\n --sf-z-index-overlay: 2;\n --sf-z-index-controls: 10;\n --sf-z-index-cursor: 9999;\n --sf-z-index-player: 2147483648;\n \n /* Font sizes */\n --sf-font-size-sm: 14px;\n --sf-font-size-md: 16px;\n --sf-font-size-lg: 18px;\n --sf-font-size-xl: 24px;\n} \n\n/* Mobile device responsive adjustments - make player smaller for mobile screens */\n@media (max-width: 768px) {\n :host {\n /* Reduce player size on mobile for better space utilization */\n --sf-player-width: 180px; /* 25% smaller than desktop (240px -> 180px) */\n --sf-player-height: 252px; /* 25% smaller than desktop (336px -> 252px) */\n --sf-player-min-width: 60px; /* Smaller when minimized (80px -> 60px) */\n --sf-player-min-height: 60px; /* Smaller when minimized (80px -> 60px) */\n --sf-player-compact-width: 90px; /* Smaller compact mode for mobile (120px -> 90px) */\n --sf-player-compact-height: 90px; /* Smaller compact mode for mobile (120px -> 90px) */\n\n /* Keep controls touch-friendly despite smaller player size */\n --sf-play-button-size: 44px; /* Smaller but still touch-friendly (60px -> 44px) */\n --sf-play-button-compact-size: 36px; /* Touch-friendly compact play button */\n --sf-control-button-size: 28px; /* Keep larger for touch targets (24px -> 28px) */\n --sf-mute-button-size: 26px; /* Smaller for mobile (32px -> 26px) */\n --sf-cc-button-size: 26px; /* Smaller for mobile (32px -> 26px) */\n --sf-minimize-button-size: 26px; /* Match other mobile button sizes */\n }\n}\n\n/* Touch device specific adjustments (tablets and larger touch devices, excluding mobile) */\n@media (pointer: coarse) and (min-width: 769px) {\n :host {\n /* Ensure touch-friendly sizes even on larger touch devices */\n --sf-control-button-size: 28px;\n --sf-mute-button-size: 38px;\n --sf-cc-button-size: 38px;\n --sf-minimize-button-size: 38px; /* Match other touch device button sizes */\n }\n} ";
3773
3781
  const componentsPlayerCss = "/* \n * Player component styles for the Saltfish playlist Player\n * Following BEM naming convention\n */\n\n/* Main player container */\n.sf-player {\n border-radius: var(--sf-border-radius-lg);\n box-shadow: 0 25px 50px rgba(0, 0, 0, 0.45), 0 10px 20px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(255, 255, 255, 0.08);\n position: relative;\n backdrop-filter: blur(10px);\n -webkit-backdrop-filter: blur(10px);\n opacity: 0;\n /* Smooth transitions for size changes and opacity */\n transition: opacity 0.3s ease-in-out,\n width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),\n height 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),\n border-radius 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);\n}\n\n/* Player visible state - show with fade in */\n.sf-player--visible {\n opacity: 1;\n}\n\n/* Dark gradient overlay at bottom of player */\n.sf-player::before {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 33.33%; /* One third of player height */\n background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);\n pointer-events: none;\n z-index: var(--sf-z-index-overlay);\n border-radius: 8px;\n}\n\n/* Hide gradient overlay when minimized */\n.sf-player--minimized::before {\n display: none;\n}\n\n/* Full-size player state */\n.sf-player:not(.sf-player--minimized) {\n width: var(--sf-player-width);\n height: var(--sf-player-height);\n}\n\n/* Autoplay fallback state - ensure play button is visible */\n.sf-player--waiting-for-user-interaction .sf-controls-container__play-button {\n display: flex !important;\n opacity: 1 !important;\n visibility: visible !important;\n}\n\n/* Also show the center play button in autoplay fallback state */\n.sf-player--waiting-for-user-interaction .sf-player__center-play-button {\n display: flex !important;\n opacity: 1 !important;\n z-index: calc(var(--sf-z-index-controls) + 20) !important; /* Higher z-index to appear above overlay */\n}\n\n/* Make the autoplay fallback state more prominent to indicate need for interaction */\n.sf-player--waiting-for-user-interaction::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.3);\n pointer-events: none;\n z-index: var(--sf-z-index-overlay);\n}\n\n/* Player state: minimized */\n.sf-player--minimized {\n /* Equal width and height are essential for maintaining a perfect circle when using border-radius: 50% */\n width: var(--sf-player-min-width);\n height: var(--sf-player-min-height);\n border-radius: var(--sf-border-radius-circle);\n box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35), 0 5px 15px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.08);\n cursor: pointer;\n /* Force overriding any inline styles that might be applied */\n max-width: var(--sf-player-min-width) !important;\n max-height: var(--sf-player-min-height) !important;\n min-width: var(--sf-player-min-width) !important;\n min-height: var(--sf-player-min-height) !important;\n}\n\n/* Player state: compact (first step, small rounded) */\n.sf-player--compact {\n width: var(--sf-player-compact-width) !important;\n height: var(--sf-player-compact-height) !important;\n border-radius: var(--sf-border-radius-circle);\n box-shadow: 0 15px 30px rgba(0, 0, 0, 0.35), 0 5px 15px rgba(0, 0, 0, 0.25), 0 0 0 2px rgba(255, 255, 255, 0.08);\n /* Force overriding any inline styles that might be applied */\n max-width: var(--sf-player-compact-width) !important;\n max-height: var(--sf-player-compact-height) !important;\n min-width: var(--sf-player-compact-width) !important;\n min-height: var(--sf-player-compact-height) !important;\n}\n\n/* Adjust play button size in compact mode */\n.sf-player--compact .sf-player__center-play-button {\n width: var(--sf-play-button-compact-size);\n height: var(--sf-play-button-compact-size);\n}\n\n/* Hide elements in compact mode */\n.sf-player--compact .sf-player__logo,\n.sf-player--compact .sf-player__minimize-button {\n display: none;\n}\n\n/* Hide gradient overlay when in compact mode */\n.sf-player--compact::before {\n display: none;\n}\n\n/* Hide controls when minimized */\n.sf-player--minimized .sf-controls-container {\n display: none;\n}\n\n/* Hide controls when in compact mode */\n.sf-player--compact .sf-controls-container {\n display: none;\n}\n\n/* Only show the minimize button when hovering on minimized player */\n.sf-player--minimized .sf-player__minimize-button {\n opacity: 0;\n}\n\n.sf-player--minimized:hover .sf-player__minimize-button {\n opacity: 1;\n}\n\n/* Player root element */\n#sf-player-root {\n position: fixed;\n z-index: var(--sf-z-index-player);\n}\n\n/* Fixed positioning classes */\n.sf-player-root--bottom-left {\n bottom: 20px;\n left: 20px;\n}\n\n.sf-player-root--bottom-right {\n bottom: 20px;\n right: 20px;\n}\n\n/* Player error message */\n.sf-player__error {\n padding: var(--sf-spacing-md);\n color: var(--sf-error-color);\n background-color: var(--sf-error-bg);\n border-radius: var(--sf-border-radius-md);\n margin: var(--sf-spacing-sm);\n font-size: var(--sf-font-size-sm);\n border-left: 4px solid var(--sf-error-color);\n}\n\n/* Minimize button */\n.sf-player__minimize-button {\n position: absolute;\n top: 8px;\n right: 6px;\n width: var(--sf-minimize-button-size);\n height: var(--sf-minimize-button-size);\n background-color: transparent;\n border-radius: var(--sf-border-radius-circle);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: var(--sf-z-index-controls);\n color: white;\n border: none;\n font-size: calc(var(--sf-font-size-sm) + 4px);\n transition: all var(--sf-transition-normal);\n text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n opacity: 0;\n}\n\n/* Minimize button hover state */\n.sf-player__minimize-button:hover {\n transform: scale(1.1);\n}\n\n/* Show minimize button on player hover */\n.sf-player:hover .sf-player__minimize-button {\n opacity: 1;\n}\n\n/* Mobile and touch device overrides for minimize button visibility */\n/* Ensure minimize button is always visible on touch devices, even when minimized */\n@media (pointer: coarse) {\n .sf-player__minimize-button {\n opacity: 1 !important;\n z-index: calc(var(--sf-z-index-controls) + 50) !important; /* Much higher z-index for touch devices */\n }\n \n .sf-player--minimized .sf-player__minimize-button {\n opacity: 1 !important;\n z-index: calc(var(--sf-z-index-controls) + 50) !important; /* Much higher z-index for touch devices */\n }\n}\n\n/* Ensure minimize button is always visible on mobile screens under 768px */\n@media (max-width: 768px) {\n .sf-player__minimize-button {\n opacity: 1 !important;\n z-index: calc(var(--sf-z-index-controls) + 50) !important; /* Much higher z-index for mobile */\n /* Position closer to top right corner on mobile */\n top: var(--sf-spacing-xs) !important; /* 4px from top instead of 16px */\n right: var(--sf-spacing-xs) !important; /* 4px from right instead of 12px */\n }\n \n .sf-player--minimized .sf-player__minimize-button {\n opacity: 1 !important;\n z-index: calc(var(--sf-z-index-controls) + 50) !important; /* Much higher z-index for mobile */\n /* Position closer to top right corner on mobile */\n top: var(--sf-spacing-xs) !important; /* 4px from top instead of 16px */\n right: var(--sf-spacing-xs) !important; /* 4px from right instead of 12px */\n }\n}\n\n/* Player title */\n.sf-player__title {\n position: absolute;\n top: var(--sf-spacing-md);\n left: var(--sf-spacing-md);\n color: var(--sf-text-color);\n font-size: var(--sf-font-size-md);\n font-weight: 600;\n z-index: var(--sf-z-index-controls);\n text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);\n max-width: 70%;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n/* Centered play/pause button overlay */\n.sf-player__center-play-button {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: var(--sf-play-button-size);\n height: var(--sf-play-button-size);\n background-color: rgba(0, 0, 0, 0.5);\n border-radius: var(--sf-border-radius-circle);\n display: none; /* Hidden by default */\n justify-content: center;\n align-items: center;\n z-index: calc(var(--sf-z-index-controls) + 10); /* Ensure higher z-index than other elements */\n color: white;\n border: none;\n font-size: var(--sf-control-button-size);\n cursor: pointer;\n transition: transform var(--sf-transition-normal), background-color var(--sf-transition-normal);\n backdrop-filter: blur(3px);\n -webkit-backdrop-filter: blur(3px);\n box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5), 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(255, 255, 255, 0.08);\n pointer-events: auto; /* Enable pointer events to capture clicks */\n}\n\n/* Center play button visible state */\n.sf-player__center-play-button--visible {\n display: flex !important;\n}\n\n/* Center play button prominent state (for autoplay blocked, idle mode) */\n.sf-player__center-play-button--prominent {\n opacity: 1 !important;\n pointer-events: auto !important;\n}\n\n/* Center play button hover state */\n.sf-player__center-play-button:hover {\n transform: translate(-50%, -50%) scale(1.1);\n background-color: rgba(0, 0, 0, 0.7);\n}\n\n/* Hide center play button in minimized state */\n.sf-player--minimized .sf-player__center-play-button {\n display: none !important;\n}\n\n/* Center play button with adjustment for 3+ buttons */\n.sf-player__center-play-button--with-many-buttons {\n transform: translate(-50%, -85%) !important; /* Move up by adjusting Y offset */\n}\n\n/* Exit button for minimized mode */\n.sf-player__exit-button {\n position: absolute;\n top: -22px; /* Position it above the player */\n right: 0;\n width: 20px;\n height: 20px;\n background-color: var(--sf-button-bg);\n border-radius: var(--sf-border-radius-circle);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: var(--sf-z-index-controls);\n color: white;\n border: none;\n font-size: var(--sf-font-size-md);\n transition: all var(--sf-transition-normal);\n text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n box-shadow: 0 5px 15px rgba(0, 0, 0, 0.35);\n}\n\n/* Exit button hover state */\n.sf-player__exit-button:hover {\n transform: scale(1.1);\n background-color: var(--sf-button-hover-bg);\n}\n\n/* Show exit button on minimized player hover */\n.sf-player--minimized:hover .sf-player__exit-button {\n opacity: 1;\n}\n\n/* Saltfish logo */\n.sf-player__logo {\n position: absolute;\n bottom: var(--sf-spacing-xs);\n left: 0;\n right: 0;\n height: 18px;\n z-index: var(--sf-z-index-controls);\n opacity: 0.7;\n transition: opacity var(--sf-transition-normal);\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.sf-player__logo svg {\n width: 55px;\n height: 20px;\n}\n\n/* Logo hover state */\n.sf-player:hover .sf-player__logo {\n opacity: 0.9;\n}\n\n/* Hide logo when minimized */\n.sf-player--minimized .sf-player__logo {\n display: none;\n} ";
3774
- const componentsVideoCss = "/* \n * Video component styles for the Saltfish playlist Player\n * Following BEM naming convention\n */\n\n/* Video container */\n.sf-video-container {\n position: relative;\n width: 100%;\n height: 100%;\n border-radius: var(--sf-border-radius-md);\n overflow: hidden;\n pointer-events: auto; /* Ensure clicks on video container are captured */\n background-color: #000; /* Fallback background for audio-only mode */\n}\n\n/* Audio fallback poster image */\n.sf-video-container--audio-fallback {\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n background-image: var(--sf-audio-poster-url, none);\n}\n\n/* Audio fallback overlay */\n.sf-audio-fallback-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.6);\n z-index: 2;\n pointer-events: none;\n}\n\n/* Avatar mode overlay - no background, just container */\n.sf-audio-fallback-overlay--avatar {\n background: none;\n}\n\n.sf-audio-fallback-overlay__icon {\n width: 60px;\n height: 60px;\n margin-bottom: 16px;\n color: white;\n opacity: 0.9;\n}\n\n.sf-audio-fallback-overlay__text {\n color: white;\n font-size: 14px;\n text-align: center;\n padding: 0 20px;\n text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);\n opacity: 0.9;\n}\n\n.sf-audio-fallback-overlay__avatar {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: 1;\n}\n\n/* Semi-transparent overlay on top of avatar */\n.sf-audio-fallback-overlay__dim {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.3);\n z-index: 2;\n}\n\n/* Video element */\n.sf-video-container__video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n /* Ensure video is visible on mobile */\n display: block;\n /* Add explicit positioning to ensure video is visible */\n position: relative;\n z-index: 1;\n}\n\n/* Video blur effect (for end-of-video transitions) */\n.sf-video-container__video--blurred {\n filter: blur(3px);\n transition: filter 0.3s ease-out;\n}\n\n\n\n/* Mobile-specific video styles */\n@media (max-width: 768px) {\n \n .sf-video-container__video {\n /* Force video dimensions on mobile */\n width: 100% !important;\n height: 100% !important;\n object-fit: cover !important;\n /* Prevent video from being hidden */\n opacity: 1 !important;\n visibility: visible !important;\n /* Ensure video is above any potential overlays */\n z-index: 10 !important;\n position: relative !important;\n }\n \n /* Make controls more touch-friendly on mobile */\n .sf-video-container__controls {\n height: 5px; /* Thicker on mobile for easier touch */\n }\n \n .sf-video-container__mute-button {\n /* Use CSS variable for consistent sizing */\n min-width: var(--sf-mute-button-size) !important;\n min-height: var(--sf-mute-button-size) !important;\n opacity: 1; /* Always visible on mobile (no hover) */\n }\n \n .sf-video-container__cc-button {\n /* Use CSS variable for consistent sizing */\n min-width: var(--sf-cc-button-size) !important;\n min-height: var(--sf-cc-button-size) !important;\n opacity: 1; /* Always visible on mobile (no hover) */\n }\n}\n\n/* Touch device specific styles */\n@media (pointer: coarse) {\n .sf-video-container__controls:hover {\n height: 5px; /* Keep consistent height on touch devices */\n }\n \n .sf-video-container__mute-button {\n opacity: 1; /* Always show on touch devices */\n }\n \n .sf-video-container__cc-button {\n opacity: 1; /* Always show on touch devices */\n }\n \n .sf-video-container:hover .sf-video-container__mute-button {\n opacity: 1;\n }\n}\n\n/* Video in minimized state */\n.sf-player--minimized .sf-video-container {\n border-radius: var(--sf-border-radius-circle);\n cursor: pointer;\n z-index: var(--sf-z-index-base);\n width: 100%;\n height: 100%;\n}\n\n.sf-player--minimized .sf-video-container__video {\n border-radius: var(--sf-border-radius-circle);\n object-fit: cover;\n width: 100%;\n height: 100%;\n}\n\n/* Hide progress bar in minimized state */\n.sf-player--minimized .sf-video-container__controls {\n display: none !important;\n}\n\n/* Also hide mute button in minimized state */\n.sf-player--minimized .sf-video-container__mute-button {\n display: none !important;\n}\n\n/* Also hide CC button in minimized state */\n.sf-player--minimized .sf-video-container__cc-button {\n display: none !important;\n}\n\n/* Progress bar container */\n.sf-video-container__controls {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 3px;\n background-color: rgba(255, 255, 255, 0.25);\n z-index: var(--sf-z-index-controls);\n border-radius: var(--sf-border-radius-md) var(--sf-border-radius-md) 0 0;\n cursor: pointer;\n}\n\n/* Show slightly thicker progress bar on hover for better UX */\n.sf-video-container__controls:hover {\n height: 5px;\n}\n\n/* Progress indicator */\n.sf-video-container__progress {\n height: 100%;\n background: rgba(255, 255, 255, 0.8);\n width: 0%;\n transition: width 0.1s linear;\n border-radius: var(--sf-border-radius-md) 0 0 0;\n cursor: pointer;\n transform-origin: left;\n}\n\n/* Mute button */\n.sf-video-container__mute-button {\n position: absolute;\n top: calc(8px + var(--sf-minimize-button-size) + 6px);\n right: 6px;\n width: var(--sf-mute-button-size);\n height: var(--sf-mute-button-size);\n background-color: transparent;\n border-radius: var(--sf-border-radius-circle);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: var(--sf-z-index-controls);\n color: white;\n border: none;\n font-size: calc(var(--sf-font-size-md) + 2px);\n transition: all var(--sf-transition-normal);\n text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n opacity: 0;\n}\n\n/* Mute button hover state */\n.sf-video-container__mute-button:hover {\n transform: scale(1.1);\n}\n\n/* Show mute button on container hover */\n.sf-video-container:hover .sf-video-container__mute-button {\n opacity: 1;\n}\n\n/* CC button */\n.sf-video-container__cc-button {\n position: absolute;\n top: calc(8px + var(--sf-minimize-button-size) + 6px + var(--sf-mute-button-size) + 6px);\n right: 6px;\n width: var(--sf-cc-button-size);\n height: var(--sf-cc-button-size);\n background-color: transparent;\n border-radius: 50%; /* Ensure perfect circle */\n padding: 0; /* Remove default button padding */\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: var(--sf-z-index-controls);\n color: white;\n border: none;\n font-size: calc(var(--sf-font-size-md) + 2px);\n transition: all var(--sf-transition-normal);\n text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n opacity: 0;\n}\n\n.sf-video-container__cc-button svg {\n display: block;\n margin: auto;\n width: 60%;\n height: 60%;\n}\n\n/* CC button hover state */\n.sf-video-container__cc-button:hover {\n transform: scale(1.1);\n}\n\n/* Hide mute and cc buttons in autoplayBlocked and idleMode states */\n.sf-player--autoplayBlocked .sf-video-container__mute-button,\n.sf-player--autoplayBlocked .sf-video-container__cc-button,\n.sf-player--idleMode .sf-video-container__mute-button,\n.sf-player--idleMode .sf-video-container__cc-button {\n display: none !important;\n}\n\n/* Show mute and cc buttons on hover in playing/paused states */\n.sf-player--playing .sf-video-container:hover .sf-video-container__mute-button,\n.sf-player--playing .sf-video-container:hover .sf-video-container__cc-button,\n.sf-player--paused .sf-video-container:hover .sf-video-container__mute-button,\n.sf-player--paused .sf-video-container:hover .sf-video-container__cc-button {\n opacity: 1;\n} ";
3782
+ const componentsVideoCss = "/* \n * Video component styles for the Saltfish playlist Player\n * Following BEM naming convention\n */\n\n/* Video container */\n.sf-video-container {\n position: relative;\n width: 100%;\n height: 100%;\n border-radius: var(--sf-border-radius-md);\n overflow: hidden;\n pointer-events: auto; /* Ensure clicks on video container are captured */\n background-color: #000; /* Fallback background for audio-only mode */\n}\n\n/* Audio fallback poster image */\n.sf-video-container--audio-fallback {\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n background-image: var(--sf-audio-poster-url, none);\n}\n\n/* Audio fallback overlay */\n.sf-audio-fallback-overlay {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background: rgba(0, 0, 0, 0.6);\n z-index: 2;\n pointer-events: none;\n}\n\n/* Avatar mode overlay - no background, just container */\n.sf-audio-fallback-overlay--avatar {\n background: none;\n}\n\n.sf-audio-fallback-overlay__icon {\n width: 60px;\n height: 60px;\n margin-bottom: 16px;\n color: white;\n opacity: 0.9;\n}\n\n.sf-audio-fallback-overlay__text {\n color: white;\n font-size: 14px;\n text-align: center;\n padding: 0 20px;\n text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);\n opacity: 0.9;\n}\n\n.sf-audio-fallback-overlay__avatar {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: 1;\n}\n\n/* Semi-transparent overlay on top of avatar */\n.sf-audio-fallback-overlay__dim {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(0, 0, 0, 0.3);\n z-index: 2;\n}\n\n/* Soundbar-only mode overlay - dark background for soundbar visibility */\n.sf-audio-fallback-overlay--soundbar-only {\n background: rgba(0, 0, 0, 0.85);\n}\n\n/* Audio visualization soundbar container */\n.sf-audio-soundbar {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n height: 120px;\n width: auto;\n max-width: 300px;\n z-index: 3;\n position: relative;\n padding: 0 20px;\n}\n\n/* Individual soundbar frequency bar */\n.sf-audio-soundbar__bar {\n flex: 1;\n min-width: 8px;\n max-width: 20px;\n height: 10%; /* Default minimum height */\n background-color: hsla(180, 70%, 60%, 0.3);\n border-radius: 4px;\n transition: height 0.05s ease-out, background-color 0.1s ease-out;\n transform-origin: center;\n will-change: height, background-color;\n}\n\n/* Video element */\n.sf-video-container__video {\n width: 100%;\n height: 100%;\n object-fit: cover;\n /* Ensure video is visible on mobile */\n display: block;\n /* Add explicit positioning to ensure video is visible */\n position: relative;\n z-index: 1;\n}\n\n/* Video blur effect (for end-of-video transitions) */\n.sf-video-container__video--blurred {\n filter: blur(3px);\n transition: filter 0.3s ease-out;\n}\n\n\n\n/* Mobile-specific video styles */\n@media (max-width: 768px) {\n \n .sf-video-container__video {\n /* Force video dimensions on mobile */\n width: 100% !important;\n height: 100% !important;\n object-fit: cover !important;\n /* Prevent video from being hidden */\n opacity: 1 !important;\n visibility: visible !important;\n /* Ensure video is above any potential overlays */\n z-index: 10 !important;\n position: relative !important;\n }\n \n /* Make controls more touch-friendly on mobile */\n .sf-video-container__controls {\n height: 5px; /* Thicker on mobile for easier touch */\n }\n \n .sf-video-container__mute-button {\n /* Use CSS variable for consistent sizing */\n min-width: var(--sf-mute-button-size) !important;\n min-height: var(--sf-mute-button-size) !important;\n opacity: 1; /* Always visible on mobile (no hover) */\n }\n \n .sf-video-container__cc-button {\n /* Use CSS variable for consistent sizing */\n min-width: var(--sf-cc-button-size) !important;\n min-height: var(--sf-cc-button-size) !important;\n opacity: 1; /* Always visible on mobile (no hover) */\n }\n}\n\n/* Touch device specific styles */\n@media (pointer: coarse) {\n .sf-video-container__controls:hover {\n height: 5px; /* Keep consistent height on touch devices */\n }\n \n .sf-video-container__mute-button {\n opacity: 1; /* Always show on touch devices */\n }\n \n .sf-video-container__cc-button {\n opacity: 1; /* Always show on touch devices */\n }\n \n .sf-video-container:hover .sf-video-container__mute-button {\n opacity: 1;\n }\n}\n\n/* Video in minimized state */\n.sf-player--minimized .sf-video-container {\n border-radius: var(--sf-border-radius-circle);\n cursor: pointer;\n z-index: var(--sf-z-index-base);\n width: 100%;\n height: 100%;\n}\n\n.sf-player--minimized .sf-video-container__video {\n border-radius: var(--sf-border-radius-circle);\n object-fit: cover;\n width: 100%;\n height: 100%;\n}\n\n/* Hide progress bar in minimized state */\n.sf-player--minimized .sf-video-container__controls {\n display: none !important;\n}\n\n/* Also hide mute button in minimized state */\n.sf-player--minimized .sf-video-container__mute-button {\n display: none !important;\n}\n\n/* Also hide CC button in minimized state */\n.sf-player--minimized .sf-video-container__cc-button {\n display: none !important;\n}\n\n/* Progress bar container */\n.sf-video-container__controls {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 3px;\n background-color: rgba(255, 255, 255, 0.25);\n z-index: var(--sf-z-index-controls);\n border-radius: var(--sf-border-radius-md) var(--sf-border-radius-md) 0 0;\n cursor: pointer;\n}\n\n/* Show slightly thicker progress bar on hover for better UX */\n.sf-video-container__controls:hover {\n height: 5px;\n}\n\n/* Progress indicator */\n.sf-video-container__progress {\n height: 100%;\n background: rgba(255, 255, 255, 0.8);\n width: 0%;\n transition: width 0.1s linear;\n border-radius: var(--sf-border-radius-md) 0 0 0;\n cursor: pointer;\n transform-origin: left;\n}\n\n/* Mute button */\n.sf-video-container__mute-button {\n position: absolute;\n top: calc(8px + var(--sf-minimize-button-size) + 6px);\n right: 6px;\n width: var(--sf-mute-button-size);\n height: var(--sf-mute-button-size);\n background-color: transparent;\n border-radius: var(--sf-border-radius-circle);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: var(--sf-z-index-controls);\n color: white;\n border: none;\n font-size: calc(var(--sf-font-size-md) + 2px);\n transition: all var(--sf-transition-normal);\n text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n opacity: 0;\n}\n\n/* Mute button hover state */\n.sf-video-container__mute-button:hover {\n transform: scale(1.1);\n}\n\n/* Show mute button on container hover */\n.sf-video-container:hover .sf-video-container__mute-button {\n opacity: 1;\n}\n\n/* CC button */\n.sf-video-container__cc-button {\n position: absolute;\n top: calc(8px + var(--sf-minimize-button-size) + 6px + var(--sf-mute-button-size) + 6px);\n right: 6px;\n width: var(--sf-cc-button-size);\n height: var(--sf-cc-button-size);\n background-color: transparent;\n border-radius: 50%; /* Ensure perfect circle */\n padding: 0; /* Remove default button padding */\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: var(--sf-z-index-controls);\n color: white;\n border: none;\n font-size: calc(var(--sf-font-size-md) + 2px);\n transition: all var(--sf-transition-normal);\n text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n opacity: 0;\n}\n\n.sf-video-container__cc-button svg {\n display: block;\n margin: auto;\n width: 60%;\n height: 60%;\n}\n\n/* CC button hover state */\n.sf-video-container__cc-button:hover {\n transform: scale(1.1);\n}\n\n/* Hide mute and cc buttons in autoplayBlocked and idleMode states */\n.sf-player--autoplayBlocked .sf-video-container__mute-button,\n.sf-player--autoplayBlocked .sf-video-container__cc-button,\n.sf-player--idleMode .sf-video-container__mute-button,\n.sf-player--idleMode .sf-video-container__cc-button {\n display: none !important;\n}\n\n/* Show mute and cc buttons on hover in playing/paused states */\n.sf-player--playing .sf-video-container:hover .sf-video-container__mute-button,\n.sf-player--playing .sf-video-container:hover .sf-video-container__cc-button,\n.sf-player--paused .sf-video-container:hover .sf-video-container__mute-button,\n.sf-player--paused .sf-video-container:hover .sf-video-container__cc-button {\n opacity: 1;\n} ";
3775
3783
  const componentsControlsCss = "/* \n * Controls component styles for the Saltfish playlist Player\n * Following BEM naming convention\n */\n\n/* Main controls container */\n.sf-controls-container {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: transparent;\n z-index: var(--sf-z-index-controls);\n pointer-events: auto;\n}\n\n/* Play button */\n.sf-controls-container__play-button {\n background-color: rgba(0, 0, 0, 0.6);\n border: none;\n color: var(--sf-text-color);\n font-size: var(--sf-control-button-size);\n cursor: pointer;\n width: var(--sf-play-button-size);\n height: var(--sf-play-button-size);\n border-radius: var(--sf-border-radius-circle);\n display: flex;\n justify-content: center;\n align-items: center;\n transition: transform var(--sf-transition-normal), background-color var(--sf-transition-normal);\n padding-left: 4px; /* Optical centering for play icon */\n}\n\n/* Button hover state */\n.sf-controls-container__play-button:hover {\n background-color: rgba(0, 0, 0, 0.4);\n transform: scale(1.1);\n}\n\n/* Button container for interactive buttons */\n.sf-controls-container__buttons {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: var(--sf-spacing-md);\n}\n\n/* Interactive button */\n.sf-controls-container__interactive-button {\n background-color: rgba(255, 255, 255, 0.2);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n color: white;\n border: none;\n border-radius: var(--sf-border-radius-md);\n padding: var(--sf-spacing-xs) var(--sf-spacing-md);\n font-size: var(--sf-font-size-sm);\n cursor: pointer;\n transition: background-color var(--sf-transition-normal), transform var(--sf-transition-fast);\n box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);\n}\n\n.sf-controls-container__interactive-button:hover {\n background-color: rgba(255, 255, 255, 0.3);\n transform: translateY(-2px);\n}\n\n/* \n * Choice buttons container and buttons - positioned inside player\n */\n\n/* Choice buttons container - positioned inside the player at the bottom */\n.sf-choice-buttons-container {\n position: absolute;\n bottom: var(--sf-spacing-xl);\n left: 50%;\n transform: translateX(-50%);\n width: calc(100% - var(--sf-spacing-lg));\n max-width: calc(100% - var(--sf-spacing-lg));\n z-index: calc(var(--sf-z-index-controls) + 1);\n gap: var(--sf-spacing-sm);\n pointer-events: auto;\n align-items: center;\n display: flex;\n flex-direction: column;\n /* Ensure container is fully transparent */\n background: transparent;\n border: none;\n outline: none;\n}\n\n/* Choice buttons container with scrolling for 4+ buttons */\n.sf-choice-buttons-container--scrollable {\n max-height: 132px; /* Show ~3 buttons with gaps (3 * 36px button + 3 * 8px gap) */\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: thin; /* Show thin scrollbar in Firefox */\n scrollbar-color: rgba(255, 255, 255, 0.2) transparent; /* More transparent Firefox scrollbar */\n scroll-behavior: smooth;\n /* Important: Use block display for scrollable container */\n display: block !important;\n}\n\n/* Style webkit scrollbar to be visible but subtle */\n.sf-choice-buttons-container--scrollable::-webkit-scrollbar {\n width: 4px;\n}\n\n.sf-choice-buttons-container--scrollable::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.sf-choice-buttons-container--scrollable::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.2); /* More transparent */\n border-radius: 2px;\n}\n\n.sf-choice-buttons-container--scrollable::-webkit-scrollbar-thumb:hover {\n background: rgba(255, 255, 255, 0.4); /* Still subtle on hover */\n}\n\n/* Removed fade gradient to keep container fully transparent */\n\n/* Choice button styles - solid rounded buttons matching the image */\n.sf-choice-button {\n width: 100%;\n max-width: none;\n background: rgba(0, 0, 0, 4);\n backdrop-filter: blur(8px);\n -webkit-backdrop-filter: blur(8px);\n color: white;\n border: none;\n border-radius: 24px; /* More rounded for pill shape */\n padding: var(--sf-spacing-md) var(--sf-spacing-md);\n font-size: 12px;\n cursor: pointer;\n transition: all 0.2s ease;\n text-align: center;\n outline: none;\n font-family: inherit;\n margin-bottom: 0;\n position: relative;\n overflow: hidden;\n opacity: 0; /* Start hidden for animation */\n pointer-events: none;\n /* Animation will be triggered by JavaScript when video reaches 90% */\n}\n\n/* Add margin between buttons in scrollable container */\n.sf-choice-buttons-container--scrollable .sf-choice-button {\n margin-bottom: var(--sf-spacing-sm);\n}\n\n/* Remove margin from last button */\n.sf-choice-buttons-container--scrollable .sf-choice-button:last-child {\n margin-bottom: 0;\n}\n\n/* Hover state for buttons */\n.sf-choice-button:hover {\n background: rgba(0, 0, 0, 0.9);\n transform: translateY(-2px);\n box-shadow: 0 6px 16px rgba(0, 0, 0, 0.8);\n}\n\n/* Active state for all buttons */\n.sf-choice-button:active {\n transform: translateY(0) scale(0.98);\n transition: all 0.1s ease;\n}\n\n/* Remove specific action type styling - use consistent dark buttons */\n.sf-choice-button--goto,\n.sf-choice-button--url,\n.sf-choice-button--next,\n.sf-choice-button--dom,\n.sf-choice-button--function {\n background: rgba(0, 0, 0, 0.4);\n border: none;\n}\n\n.sf-choice-button--goto:hover,\n.sf-choice-button--url:hover,\n.sf-choice-button--next:hover,\n.sf-choice-button--dom:hover,\n.sf-choice-button--function:hover {\n background: rgba(0, 0, 0, 0.9);\n transform: translateY(-2px);\n box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);\n}\n\n/* Hide choice buttons in minimized state */\n.sf-player--minimized .sf-choice-buttons-container {\n display: none;\n}\n\n/* Hide choice buttons in autoplayBlocked and idleMode states */\n.sf-player--autoplayBlocked .sf-choice-buttons-container,\n.sf-player--idleMode .sf-choice-buttons-container {\n display: none !important;\n}\n\n/* Smaller mobile screens - maintain same layout but with tighter spacing */\n@media (max-width: 480px) {\n .sf-choice-buttons-container {\n bottom: var(--sf-spacing-sm);\n width: calc(100% - var(--sf-spacing-md));\n max-width: calc(100% - var(--sf-spacing-md));\n gap: calc(var(--sf-spacing-xs) + 2px);\n }\n \n .sf-choice-button {\n padding: var(--sf-spacing-sm) var(--sf-spacing-sm);\n font-size: 11px;\n border-radius: 20px;\n }\n}\n\n/* Touch device specific adjustments */\n@media (pointer: coarse) {\n .sf-choice-buttons-container {\n gap: var(--sf-spacing-sm);\n }\n \n .sf-choice-button {\n min-height: 44px; /* Apple's recommended minimum touch target size */\n padding: var(--sf-spacing-md) var(--sf-spacing-md);\n }\n}\n\n/* Button fade-in animation */\n@keyframes buttonFadeIn {\n from {\n opacity: 0;\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n/* Animation class that will be added by JavaScript at 90% video progress */\n.sf-choice-button.sf-show-button {\n animation: buttonFadeIn 0.3s ease-out forwards;\n pointer-events: auto;\n}\n\n/* Staggered animation delays for multiple buttons when shown */\n.sf-choice-button.sf-show-button:nth-child(1) {\n animation-delay: 0s;\n}\n\n.sf-choice-button.sf-show-button:nth-child(2) {\n animation-delay: 0.15s;\n}\n\n.sf-choice-button.sf-show-button:nth-child(3) {\n animation-delay: 0.3s;\n}\n\n.sf-choice-button.sf-show-button:nth-child(4) {\n animation-delay: 0.45s;\n}\n\n.sf-choice-button.sf-show-button:nth-child(5) {\n animation-delay: 0.6s;\n}\n\n.sf-choice-button.sf-show-button:nth-child(6) {\n animation-delay: 0.75s;\n}\n\n.sf-choice-button.sf-show-button:nth-child(7) {\n animation-delay: 0.9s;\n}\n\n.sf-choice-button.sf-show-button:nth-child(8) {\n animation-delay: 1.05s;\n}\n\n/* Scroll indicator arrow */\n.sf-scroll-indicator {\n position: absolute;\n bottom: calc(var(--sf-spacing-xl) - 25px);\n left: 50%;\n transform: translateX(-50%);\n color: rgba(255, 255, 255, 0.6);\n font-size: 20px;\n pointer-events: none;\n z-index: calc(var(--sf-z-index-controls) + 2);\n transition: opacity 0.3s ease;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n opacity: 0; /* Start hidden */\n}\n\n/* Show scroll indicator with animation - appears after buttons */\n.sf-scroll-indicator.sf-show-scroll-indicator {\n animation: scrollIndicatorFadeIn 0.4s ease-out 1.2s forwards, bounceArrow 1.5s ease-in-out 1.6s infinite;\n}\n\n/* Hide arrow when scrolled to bottom */\n.sf-scroll-indicator--hidden {\n opacity: 0;\n}\n\n/* Fade in animation for scroll indicator */\n@keyframes scrollIndicatorFadeIn {\n from {\n opacity: 0;\n transform: translateX(-50%) translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateX(-50%) translateY(0);\n }\n}\n\n/* Bounce animation for the arrow */\n@keyframes bounceArrow {\n 0%, 100% {\n transform: translateX(-50%) translateY(0);\n }\n 50% {\n transform: translateX(-50%) translateY(5px);\n }\n}\n\n/* Hide scroll indicator in minimized state */\n.sf-player--minimized .sf-scroll-indicator {\n display: none;\n}\n\n/* Hide scroll indicator in autoplayBlocked and idleMode states */\n.sf-player--autoplayBlocked .sf-scroll-indicator,\n.sf-player--idleMode .sf-scroll-indicator {\n display: none !important;\n} ";
3776
3784
  const componentsTranscriptCss = "/* \n * Transcript component styles for the Saltfish Playlist Player\n * Following BEM naming convention\n */\n\n/* Transcript container */\n.sf-transcript {\n position: absolute;\n bottom: 40px; /* Above the progress bar */\n left: 0;\n right: 0;\n max-height: 200px;\n background: transparent;\n margin: 0 var(--sf-spacing-md);\n overflow: hidden;\n z-index: var(--sf-z-index-overlay);\n opacity: 0;\n transform: translateY(20px);\n transition: all 0.3s ease-out;\n pointer-events: none;\n}\n\n/* Visible state */\n.sf-transcript--visible {\n opacity: 1;\n transform: translateY(0);\n pointer-events: auto;\n}\n\n/* Transcript content */\n.sf-transcript__content {\n max-height: 180px;\n overflow: visible;\n padding: 0;\n}\n\n/* Webkit scrollbar styling */\n.sf-transcript__content::-webkit-scrollbar {\n width: 4px;\n}\n\n.sf-transcript__content::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.sf-transcript__content::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.3);\n border-radius: 2px;\n}\n\n.sf-transcript__content::-webkit-scrollbar-thumb:hover {\n background: rgba(255, 255, 255, 0.5);\n}\n\n/* Word-by-word display container */\n.sf-transcript__word-container {\n display: flex;\n justify-content: center;\n align-items: center;\n gap: 0; /* Remove flex gap - spacing handled by margin on preview word */\n min-height: 60px;\n padding: 0;\n}\n\n/* Individual word styling */\n.sf-transcript__word {\n color: rgba(255, 255, 255, 0.9);\n font-size: var(--sf-font-size-lg);\n font-weight: 600;\n line-height: 1.2;\n transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);\n transform: translateY(0);\n filter: blur(0px);\n opacity: 1;\n text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);\n}\n\n/* Active word (currently speaking) */\n.sf-transcript__word--active {\n opacity: 1;\n filter: blur(0px);\n transform: translateY(0) scale(1);\n color: rgba(255, 255, 255, 1);\n font-weight: 600;\n}\n\n/* Preview word (clean, unblurred when shown) */\n.sf-transcript__word--preview {\n opacity: 0.8;\n filter: blur(0px);\n transform: translateY(0) scale(0.98);\n color: rgba(255, 255, 255, 0.8);\n font-weight: 400;\n margin-left: 0.2em; /* Minimal spacing - just enough for a natural gap */\n}\n\n/* Legacy segment styling (kept for compatibility) */\n.sf-transcript__segment {\n color: rgba(255, 255, 255);\n font-size: var(--sf-font-size-sm);\n line-height: 1.4;\n padding: var(--sf-spacing-xs) 0;\n cursor: pointer;\n transition: all 0.2s ease;\n padding-left: var(--sf-spacing-xs);\n padding-right: var(--sf-spacing-xs);\n}\n\n/* CC button styling removed - now handled via icon toggling */\n\n/* Mobile responsive styles */\n@media (max-width: 768px) {\n .sf-transcript {\n bottom: 50px; /* More space on mobile */\n margin: 0 var(--sf-spacing-sm);\n max-height: 150px; /* Smaller on mobile */\n }\n \n .sf-transcript__content {\n max-height: 130px;\n padding: var(--sf-spacing-sm);\n }\n \n .sf-transcript__word-container {\n min-height: 50px;\n padding: var(--sf-spacing-sm);\n gap: var(--sf-spacing-xs);\n }\n \n .sf-transcript__word {\n font-size: var(--sf-font-size-md);\n font-weight: 500;\n }\n \n .sf-transcript__segment {\n font-size: var(--sf-font-size-xs);\n padding: var(--sf-spacing-xs) var(--sf-spacing-sm);\n }\n}\n\n/* Touch device optimizations */\n@media (pointer: coarse) {\n .sf-transcript__segment {\n padding: var(--sf-spacing-sm) var(--sf-spacing-xs);\n min-height: 44px; /* Larger touch target */\n display: flex;\n align-items: center;\n }\n}\n\n/* Hide transcript in minimized state */\n.sf-player--minimized .sf-transcript {\n display: none !important;\n}\n\n/* Hide transcript in autoplayBlocked and idleMode states */\n.sf-player--autoplayBlocked .sf-transcript,\n.sf-player--idleMode .sf-transcript {\n display: none !important;\n}\n\n/* Animation for transcript appearance */\n@keyframes transcriptFadeIn {\n from {\n opacity: 0;\n transform: translateY(20px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n\n@keyframes transcriptFadeOut {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(20px);\n }\n}";
3777
3785
  const componentsErrorCss = "/* \n * Error Display component styles for the Saltfish playlist Player\n * Clean and subtle full-widget error overlay\n */\n\n/* Error display overlay - covers full widget */\n.sf-error-display {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: rgba(0, 0, 0, 0.75);\n backdrop-filter: blur(6px);\n -webkit-backdrop-filter: blur(6px);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: calc(var(--sf-z-index-controls) + 30);\n border-radius: var(--sf-border-radius-lg);\n opacity: 0;\n transition: opacity var(--sf-transition-slow);\n pointer-events: auto;\n}\n\n/* Error display visible state */\n.sf-error-display--visible {\n opacity: 1;\n}\n\n/* Error content container */\n.sf-error-display__content {\n background-color: rgba(20, 20, 20, 0.9);\n border-radius: var(--sf-border-radius-md);\n padding: var(--sf-spacing-lg) var(--sf-spacing-xl);\n backdrop-filter: blur(10px);\n -webkit-backdrop-filter: blur(10px);\n border: 1px solid rgba(255, 255, 255, 0.08);\n transform: translateY(8px);\n transition: transform var(--sf-transition-slow);\n max-width: 85%;\n text-align: center;\n}\n\n/* Error content visible animation */\n.sf-error-display--visible .sf-error-display__content {\n transform: translateY(0);\n}\n\n/* Error message */\n.sf-error-display__message {\n color: rgba(255, 255, 255, 0.95);\n font-size: var(--sf-font-size-md);\n line-height: 1.5;\n margin: 0;\n text-align: center;\n font-weight: 500;\n}\n\n/* Mobile responsive adjustments */\n@media (max-width: 768px) {\n .sf-error-display__content {\n padding: var(--sf-spacing-md) var(--sf-spacing-lg);\n max-width: 90%;\n }\n\n .sf-error-display__message {\n font-size: var(--sf-font-size-sm);\n }\n}\n\n/* Minimized player state adjustments */\n.sf-player--minimized .sf-error-display__content {\n padding: var(--sf-spacing-sm) var(--sf-spacing-md);\n max-width: 80%;\n}\n\n.sf-player--minimized .sf-error-display__message {\n font-size: var(--sf-font-size-sm);\n font-weight: 400;\n}\n\n/* High contrast mode support */\n@media (prefers-contrast: high) {\n .sf-error-display__content {\n background-color: rgba(0, 0, 0, 0.95);\n border: 2px solid rgba(255, 255, 255, 0.3);\n }\n\n .sf-error-display__message {\n color: rgba(255, 255, 255, 0.95);\n }\n}\n\n/* Reduced motion support */\n@media (prefers-reduced-motion: reduce) {\n .sf-error-display,\n .sf-error-display__content {\n transition: none;\n }\n}";
@@ -4968,6 +4976,345 @@ class VideoControlsUI {
4968
4976
  return this.ccButton;
4969
4977
  }
4970
4978
  }
4979
+ class AudioVisualizationManager {
4980
+ constructor() {
4981
+ __publicField(this, "audioContext", null);
4982
+ __publicField(this, "analyser", null);
4983
+ __publicField(this, "sourceVideo1", null);
4984
+ __publicField(this, "sourceVideo2", null);
4985
+ __publicField(this, "activeSource", null);
4986
+ __publicField(this, "videoElement1", null);
4987
+ __publicField(this, "videoElement2", null);
4988
+ __publicField(this, "dataArray", null);
4989
+ __publicField(this, "animationId", null);
4990
+ __publicField(this, "isInitialized", false);
4991
+ __publicField(this, "useFallbackMode", false);
4992
+ // Use animated fallback if Web Audio fails
4993
+ __publicField(this, "isPaused", false);
4994
+ // Pause state - when true, bars stay at minimal height
4995
+ // Configuration
4996
+ __publicField(this, "fftSize", 2048);
4997
+ __publicField(this, "barCount", 12);
4998
+ // Moderate detail (10-15 range)
4999
+ __publicField(this, "smoothingTimeConstant", 0.75);
5000
+ // Smooth out rapid changes
5001
+ // Fallback animation state
5002
+ __publicField(this, "fallbackTime", 0);
5003
+ // CORS detection - wait for multiple frames before declaring failure
5004
+ __publicField(this, "zeroDataFrameCount", 0);
5005
+ __publicField(this, "maxZeroFramesBeforeFallback", 60);
5006
+ }
5007
+ // ~1 second at 60fps
5008
+ /**
5009
+ * Initializes the Web Audio API context and connects to the video element
5010
+ * Handles dual video element system by creating sources for both elements
5011
+ * @param videoElement - The video/audio element to analyze
5012
+ */
5013
+ initialize(videoElement) {
5014
+ try {
5015
+ if (!this.isInitialized) {
5016
+ const AudioContextClass = window.AudioContext || window.webkitAudioContext;
5017
+ this.audioContext = new AudioContextClass();
5018
+ this.analyser = this.audioContext.createAnalyser();
5019
+ this.analyser.fftSize = this.fftSize;
5020
+ this.analyser.smoothingTimeConstant = this.smoothingTimeConstant;
5021
+ const bufferLength = this.analyser.frequencyBinCount;
5022
+ this.dataArray = new Uint8Array(bufferLength);
5023
+ this.analyser.connect(this.audioContext.destination);
5024
+ this.isInitialized = true;
5025
+ this.useFallbackMode = false;
5026
+ this.zeroDataFrameCount = 0;
5027
+ }
5028
+ if (this.videoElement1 === videoElement) {
5029
+ this.resumeAudioContext();
5030
+ this.switchToSource(this.sourceVideo1);
5031
+ return;
5032
+ }
5033
+ if (this.videoElement2 === videoElement) {
5034
+ this.resumeAudioContext();
5035
+ this.switchToSource(this.sourceVideo2);
5036
+ return;
5037
+ }
5038
+ this.resumeAudioContext();
5039
+ const newSource = this.audioContext.createMediaElementSource(videoElement);
5040
+ if (!this.videoElement1) {
5041
+ this.videoElement1 = videoElement;
5042
+ this.sourceVideo1 = newSource;
5043
+ this.switchToSource(newSource);
5044
+ } else if (!this.videoElement2) {
5045
+ this.videoElement2 = videoElement;
5046
+ this.sourceVideo2 = newSource;
5047
+ this.switchToSource(newSource);
5048
+ } else {
5049
+ console.warn("AudioVisualizationManager: More than 2 video elements detected - this should not happen with dual video system");
5050
+ }
5051
+ this.zeroDataFrameCount = 0;
5052
+ } catch (error2) {
5053
+ console.warn("AudioVisualizationManager: Web Audio API failed, using fallback animation", error2);
5054
+ this.isInitialized = true;
5055
+ this.useFallbackMode = true;
5056
+ }
5057
+ }
5058
+ /**
5059
+ * Switches active source and connects it to the analyser
5060
+ * Disconnects previous source to avoid audio doubling
5061
+ */
5062
+ switchToSource(source) {
5063
+ if (this.activeSource && this.activeSource !== source) {
5064
+ this.activeSource.disconnect();
5065
+ }
5066
+ source.connect(this.analyser);
5067
+ this.activeSource = source;
5068
+ }
5069
+ /**
5070
+ * Gets frequency data for visualization bars
5071
+ * Maps lower frequencies to left bars (bass) and higher frequencies to right bars (treble)
5072
+ * Falls back to animated visualization if Web Audio API fails or CORS blocks analysis
5073
+ * Returns flat bars when paused
5074
+ * @returns Array of normalized bar heights (0-1) for each bar
5075
+ */
5076
+ getBarHeights() {
5077
+ if (this.isPaused) {
5078
+ return this.getFlatBarHeights();
5079
+ }
5080
+ if (this.useFallbackMode || !this.analyser || !this.dataArray) {
5081
+ return this.getFallbackBarHeights();
5082
+ }
5083
+ this.analyser.getByteFrequencyData(this.dataArray);
5084
+ const hasNonZeroData = this.dataArray.some((value) => value > 0);
5085
+ if (!hasNonZeroData) {
5086
+ this.zeroDataFrameCount++;
5087
+ if (this.zeroDataFrameCount >= this.maxZeroFramesBeforeFallback) {
5088
+ if (!this.useFallbackMode) {
5089
+ console.warn(
5090
+ "AudioVisualizationManager: Detected CORS blocking audio analysis after",
5091
+ this.zeroDataFrameCount,
5092
+ "frames, switching to fallback animation"
5093
+ );
5094
+ this.useFallbackMode = true;
5095
+ }
5096
+ }
5097
+ return this.getFallbackBarHeights();
5098
+ }
5099
+ this.zeroDataFrameCount = 0;
5100
+ if (this.useFallbackMode && hasNonZeroData) {
5101
+ this.useFallbackMode = false;
5102
+ }
5103
+ const halfBarCount = Math.floor(this.barCount / 2);
5104
+ const barHeights = [];
5105
+ const bufferLength = this.dataArray.length;
5106
+ const samplesPerBar = Math.floor(bufferLength / this.barCount);
5107
+ for (let i = 0; i < halfBarCount; i++) {
5108
+ let sum = 0;
5109
+ const startIndex = i * samplesPerBar;
5110
+ const endIndex = startIndex + samplesPerBar;
5111
+ for (let j = startIndex; j < endIndex && j < bufferLength; j++) {
5112
+ sum += this.dataArray[j];
5113
+ }
5114
+ const average = sum / samplesPerBar;
5115
+ const normalized = average / 255;
5116
+ barHeights.push(normalized);
5117
+ }
5118
+ const reversedBars = [...barHeights].reverse();
5119
+ reversedBars.pop();
5120
+ const mirroredBars = reversedBars.concat(barHeights);
5121
+ return mirroredBars;
5122
+ }
5123
+ /**
5124
+ * Generates animated bar heights as fallback when Web Audio API is unavailable
5125
+ * Creates a wave-like pattern that looks like audio visualization
5126
+ * Mirrors the first 50% to match real audio visualization
5127
+ * @returns Array of normalized bar heights (0-1) for animated effect
5128
+ */
5129
+ getFallbackBarHeights() {
5130
+ const halfBarCount = Math.floor(this.barCount / 2);
5131
+ const barHeights = [];
5132
+ for (let i = 0; i < halfBarCount; i++) {
5133
+ const wave1 = Math.sin(this.fallbackTime * 3e-3 + i * 0.5) * 0.3;
5134
+ const wave2 = Math.sin(this.fallbackTime * 5e-3 + i * 0.3) * 0.2;
5135
+ const wave3 = Math.sin(this.fallbackTime * 2e-3 + i * 0.7) * 0.15;
5136
+ let height = 0.3 + (wave1 + wave2 + wave3);
5137
+ height = Math.max(0, Math.min(1, height));
5138
+ barHeights.push(height);
5139
+ }
5140
+ const reversedBars = [...barHeights].reverse();
5141
+ reversedBars.pop();
5142
+ const mirroredBars = reversedBars.concat(barHeights);
5143
+ return mirroredBars;
5144
+ }
5145
+ /**
5146
+ * Returns flat bar heights for paused state
5147
+ * All bars at minimal height for visual presence
5148
+ * @returns Array of normalized bar heights (0-1) all at minimal value
5149
+ */
5150
+ getFlatBarHeights() {
5151
+ const halfBarCount = Math.floor(this.barCount / 2);
5152
+ const barHeights = [];
5153
+ for (let i = 0; i < halfBarCount; i++) {
5154
+ barHeights.push(0.1);
5155
+ }
5156
+ const reversedBars = [...barHeights].reverse();
5157
+ reversedBars.pop();
5158
+ const mirroredBars = reversedBars.concat(barHeights);
5159
+ return mirroredBars;
5160
+ }
5161
+ /**
5162
+ * Gets the average amplitude across all frequencies
5163
+ * Used for dynamic color intensity
5164
+ * Falls back to animated value if Web Audio API fails
5165
+ * @returns Normalized amplitude value (0-1)
5166
+ */
5167
+ getAverageAmplitude() {
5168
+ if (this.useFallbackMode || !this.analyser || !this.dataArray) {
5169
+ return 0.5 + Math.sin(this.fallbackTime * 2e-3) * 0.3;
5170
+ }
5171
+ this.analyser.getByteFrequencyData(this.dataArray);
5172
+ let sum = 0;
5173
+ for (let i = 0; i < this.dataArray.length; i++) {
5174
+ sum += this.dataArray[i];
5175
+ }
5176
+ const average = sum / this.dataArray.length;
5177
+ const normalized = average / 255;
5178
+ if (normalized === 0) {
5179
+ return 0.5 + Math.sin(this.fallbackTime * 2e-3) * 0.3;
5180
+ }
5181
+ return normalized;
5182
+ }
5183
+ /**
5184
+ * Starts the animation loop for continuous visualization updates
5185
+ * @param callback - Function called on each animation frame with bar heights and amplitude
5186
+ */
5187
+ startVisualization(callback) {
5188
+ if (!this.isInitialized) {
5189
+ console.warn("AudioVisualizationManager: Cannot start visualization - not initialized");
5190
+ return;
5191
+ }
5192
+ if (this.animationId !== null) {
5193
+ this.stopVisualization();
5194
+ }
5195
+ if (this.audioContext && this.audioContext.state === "suspended") {
5196
+ this.audioContext.resume();
5197
+ }
5198
+ this.fallbackTime = 0;
5199
+ this.zeroDataFrameCount = 0;
5200
+ const animate = () => {
5201
+ this.fallbackTime += 16;
5202
+ const barHeights = this.getBarHeights();
5203
+ const amplitude = this.getAverageAmplitude();
5204
+ callback(barHeights, amplitude);
5205
+ this.animationId = requestAnimationFrame(animate);
5206
+ };
5207
+ animate();
5208
+ }
5209
+ /**
5210
+ * Stops the visualization animation loop
5211
+ */
5212
+ stopVisualization() {
5213
+ if (this.animationId !== null) {
5214
+ cancelAnimationFrame(this.animationId);
5215
+ this.animationId = null;
5216
+ }
5217
+ }
5218
+ /**
5219
+ * Pauses the visualization - bars will stay at minimal height
5220
+ * Animation loop continues but returns flat bars
5221
+ */
5222
+ pause() {
5223
+ this.isPaused = true;
5224
+ }
5225
+ /**
5226
+ * Resumes the visualization - bars will react to audio again
5227
+ */
5228
+ resume() {
5229
+ this.isPaused = false;
5230
+ }
5231
+ /**
5232
+ * Resumes the AudioContext if it's suspended
5233
+ * Safe to call multiple times - will only resume if needed
5234
+ * MUST be called after user interaction for audio to work
5235
+ */
5236
+ resumeAudioContext() {
5237
+ if (this.audioContext && this.audioContext.state === "suspended") {
5238
+ this.audioContext.resume().catch((error2) => {
5239
+ console.warn("AudioVisualizationManager: Failed to resume AudioContext", error2);
5240
+ });
5241
+ }
5242
+ }
5243
+ /**
5244
+ * Checks if visualization is currently initialized
5245
+ */
5246
+ getIsInitialized() {
5247
+ return this.isInitialized;
5248
+ }
5249
+ /**
5250
+ * Resets video element references for playlist restart
5251
+ * Keeps AudioContext and analyser intact but clears video element tracking
5252
+ * This allows new video elements to be assigned when playlist restarts
5253
+ */
5254
+ reset() {
5255
+ this.stopVisualization();
5256
+ if (this.sourceVideo1) {
5257
+ try {
5258
+ this.sourceVideo1.disconnect();
5259
+ } catch (e) {
5260
+ }
5261
+ }
5262
+ if (this.sourceVideo2) {
5263
+ try {
5264
+ this.sourceVideo2.disconnect();
5265
+ } catch (e) {
5266
+ }
5267
+ }
5268
+ this.videoElement1 = null;
5269
+ this.videoElement2 = null;
5270
+ this.sourceVideo1 = null;
5271
+ this.sourceVideo2 = null;
5272
+ this.activeSource = null;
5273
+ this.useFallbackMode = false;
5274
+ this.isPaused = false;
5275
+ this.fallbackTime = 0;
5276
+ this.zeroDataFrameCount = 0;
5277
+ }
5278
+ /**
5279
+ * Cleans up Web Audio resources
5280
+ * Important to call this to prevent memory leaks
5281
+ * WARNING: Only call this when truly destroying - not when switching video elements!
5282
+ */
5283
+ cleanup() {
5284
+ this.stopVisualization();
5285
+ if (this.sourceVideo1) {
5286
+ this.sourceVideo1.disconnect();
5287
+ }
5288
+ if (this.sourceVideo2) {
5289
+ this.sourceVideo2.disconnect();
5290
+ }
5291
+ if (this.analyser) {
5292
+ this.analyser.disconnect();
5293
+ }
5294
+ if (this.audioContext && this.audioContext.state !== "closed") {
5295
+ this.audioContext.close();
5296
+ }
5297
+ this.audioContext = null;
5298
+ this.analyser = null;
5299
+ this.sourceVideo1 = null;
5300
+ this.sourceVideo2 = null;
5301
+ this.activeSource = null;
5302
+ this.videoElement1 = null;
5303
+ this.videoElement2 = null;
5304
+ this.dataArray = null;
5305
+ this.isInitialized = false;
5306
+ this.useFallbackMode = false;
5307
+ this.isPaused = false;
5308
+ this.fallbackTime = 0;
5309
+ this.zeroDataFrameCount = 0;
5310
+ }
5311
+ /**
5312
+ * Destroys the manager and releases all resources
5313
+ */
5314
+ destroy() {
5315
+ this.cleanup();
5316
+ }
5317
+ }
4971
5318
  class VideoManager {
4972
5319
  constructor() {
4973
5320
  // Dual video elements for seamless transitions
@@ -4980,6 +5327,8 @@ class VideoManager {
4980
5327
  __publicField(this, "transcriptManager");
4981
5328
  __publicField(this, "preloadedVideos", /* @__PURE__ */ new Map());
4982
5329
  __publicField(this, "audioFallbackOverlay", null);
5330
+ __publicField(this, "audioVisualizationManager");
5331
+ __publicField(this, "soundbarElement", null);
4983
5332
  // Track the current video URL and position
4984
5333
  __publicField(this, "currentVideoUrl", "");
4985
5334
  __publicField(this, "nextVideoUrl", "");
@@ -5053,6 +5402,7 @@ class VideoManager {
5053
5402
  const deviceInfo = DeviceDetector.getDeviceInfo();
5054
5403
  this.deviceHandler = createDevicePlaybackHandler(deviceInfo);
5055
5404
  this.transcriptManager = new TranscriptManager();
5405
+ this.audioVisualizationManager = new AudioVisualizationManager();
5056
5406
  this.deviceChangeCleanup = DeviceDetector.onDeviceChange((newDeviceInfo) => {
5057
5407
  this.deviceHandler.updateDeviceInfo(newDeviceInfo);
5058
5408
  });
@@ -5081,10 +5431,12 @@ class VideoManager {
5081
5431
  container.appendChild(this.container);
5082
5432
  this.currentVideo = document.createElement("video");
5083
5433
  this.currentVideo.className = "sf-video-container__video sf-video-container__video--current";
5434
+ this.currentVideo.crossOrigin = "anonymous";
5084
5435
  this.deviceHandler.configureVideoElement(this.currentVideo);
5085
5436
  this.container.appendChild(this.currentVideo);
5086
5437
  this.nextVideo = document.createElement("video");
5087
5438
  this.nextVideo.className = "sf-video-container__video sf-video-container__video--next sf-hidden";
5439
+ this.nextVideo.crossOrigin = "anonymous";
5088
5440
  this.deviceHandler.configureVideoElement(this.nextVideo);
5089
5441
  this.container.appendChild(this.nextVideo);
5090
5442
  const store = useSaltfishStore.getState();
@@ -5349,10 +5701,16 @@ class VideoManager {
5349
5701
  }
5350
5702
  }
5351
5703
  activeVideo.loop = false;
5704
+ if (this.audioVisualizationManager.getIsInitialized()) {
5705
+ this.audioVisualizationManager.resumeAudioContext();
5706
+ }
5352
5707
  if (!activeVideo.paused) {
5353
5708
  if (this.controls) {
5354
5709
  this.controls.startProgressTracking();
5355
5710
  }
5711
+ if (this.audioVisualizationManager.getIsInitialized()) {
5712
+ this.audioVisualizationManager.resume();
5713
+ }
5356
5714
  return;
5357
5715
  }
5358
5716
  this.deviceHandler.handlePlayAttempt(activeVideo, this.hasUserInteracted).then((playSucceeded) => {
@@ -5363,6 +5721,9 @@ class VideoManager {
5363
5721
  if (this.controls) {
5364
5722
  this.controls.startProgressTracking();
5365
5723
  }
5724
+ if (this.audioVisualizationManager.getIsInitialized()) {
5725
+ this.audioVisualizationManager.resume();
5726
+ }
5366
5727
  } else {
5367
5728
  store.setAutoplayFallback();
5368
5729
  if (this.isMobileDevice()) {
@@ -5398,6 +5759,9 @@ class VideoManager {
5398
5759
  this.controls.updateProgressImmediate(activeVideo.currentTime, activeVideo.duration);
5399
5760
  }
5400
5761
  activeVideo.pause();
5762
+ if (this.audioVisualizationManager.getIsInitialized()) {
5763
+ this.audioVisualizationManager.pause();
5764
+ }
5401
5765
  if (this.controls) {
5402
5766
  this.controls.stopProgressTracking();
5403
5767
  }
@@ -5464,13 +5828,21 @@ class VideoManager {
5464
5828
  this.videoEndedCallback = null;
5465
5829
  this.transcriptManager.reset();
5466
5830
  this.hideAudioFallbackOverlay();
5831
+ const isWebAudioActive = this.audioVisualizationManager.getIsInitialized();
5832
+ if (isWebAudioActive) {
5833
+ this.audioVisualizationManager.reset();
5834
+ }
5467
5835
  if (this.currentVideo) {
5468
- this.currentVideo.src = "";
5836
+ if (!isWebAudioActive) {
5837
+ this.currentVideo.src = "";
5838
+ }
5469
5839
  this.currentVideo.currentTime = 0;
5470
5840
  this.currentVideo.pause();
5471
5841
  }
5472
5842
  if (this.nextVideo) {
5473
- this.nextVideo.src = "";
5843
+ if (!isWebAudioActive) {
5844
+ this.nextVideo.src = "";
5845
+ }
5474
5846
  this.nextVideo.currentTime = 0;
5475
5847
  this.nextVideo.pause();
5476
5848
  }
@@ -5657,8 +6029,24 @@ class VideoManager {
5657
6029
  loadTranscript(transcript, initiallyVisible = true) {
5658
6030
  this.transcriptManager.loadTranscript(transcript, initiallyVisible);
5659
6031
  }
6032
+ /**
6033
+ * Creates a soundbar visualization element with 11 frequency bars (mirrored with single center)
6034
+ * @returns HTMLElement containing the soundbar visualization
6035
+ */
6036
+ createSoundbar() {
6037
+ const soundbar = document.createElement("div");
6038
+ soundbar.className = "sf-audio-soundbar";
6039
+ for (let i = 0; i < 11; i++) {
6040
+ const bar = document.createElement("div");
6041
+ bar.className = "sf-audio-soundbar__bar";
6042
+ bar.dataset.barIndex = i.toString();
6043
+ soundbar.appendChild(bar);
6044
+ }
6045
+ return soundbar;
6046
+ }
5660
6047
  /**
5661
6048
  * Shows audio fallback overlay with optional poster image or avatar thumbnail
6049
+ * Includes real-time audio visualization soundbar
5662
6050
  * @param posterUrl - Optional URL for poster image (e.g., GIF)
5663
6051
  * @param avatarThumbnailUrl - Optional URL for avatar thumbnail to display instead of icon/text
5664
6052
  */
@@ -5684,36 +6072,79 @@ class VideoManager {
5684
6072
  this.audioFallbackOverlay.appendChild(avatar);
5685
6073
  this.audioFallbackOverlay.appendChild(overlay);
5686
6074
  } else {
5687
- this.audioFallbackOverlay.className = "sf-audio-fallback-overlay";
5688
- const icon = document.createElement("div");
5689
- icon.className = "sf-audio-fallback-overlay__icon";
5690
- icon.innerHTML = `
5691
- <svg viewBox="0 0 24 24" fill="currentColor">
5692
- <path d="M12 3v10.55c-.59-.34-1.27-.55-2-.55-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4V7h4V3h-6z"/>
5693
- </svg>
5694
- `;
5695
- const text = document.createElement("div");
5696
- text.className = "sf-audio-fallback-overlay__text";
5697
- text.textContent = "Video is being generated";
5698
- this.audioFallbackOverlay.appendChild(icon);
5699
- this.audioFallbackOverlay.appendChild(text);
6075
+ this.audioFallbackOverlay.className = "sf-audio-fallback-overlay sf-audio-fallback-overlay--soundbar-only";
5700
6076
  }
6077
+ this.soundbarElement = this.createSoundbar();
6078
+ this.audioFallbackOverlay.appendChild(this.soundbarElement);
5701
6079
  this.container.appendChild(this.audioFallbackOverlay);
5702
6080
  }
5703
6081
  }
6082
+ /**
6083
+ * Starts audio visualization for the active video element
6084
+ * Should be called AFTER video is loaded and ready to play
6085
+ */
6086
+ startAudioVisualization() {
6087
+ if (!this.soundbarElement) {
6088
+ return;
6089
+ }
6090
+ const activeVideo = this.getActiveVideo();
6091
+ if (!activeVideo) {
6092
+ return;
6093
+ }
6094
+ try {
6095
+ this.audioVisualizationManager.initialize(activeVideo);
6096
+ this.audioVisualizationManager.startVisualization((barHeights, _amplitude) => {
6097
+ if (!this.soundbarElement) return;
6098
+ const bars = this.soundbarElement.querySelectorAll(".sf-audio-soundbar__bar");
6099
+ bars.forEach((bar, index) => {
6100
+ const height = barHeights[index] || 0;
6101
+ const htmlBar = bar;
6102
+ const heightPercent = Math.max(10, height * 100);
6103
+ htmlBar.style.height = `${heightPercent}%`;
6104
+ const center = 5;
6105
+ const distanceFromCenter = Math.abs(index - center);
6106
+ const maxDistance = 5;
6107
+ const hue = 180 + distanceFromCenter / maxDistance * 120;
6108
+ const opacity = 1;
6109
+ htmlBar.style.backgroundColor = `hsla(${hue}, 70%, 60%, ${opacity})`;
6110
+ });
6111
+ });
6112
+ } catch (error2) {
6113
+ console.error("VideoManager: Failed to initialize audio visualization", error2);
6114
+ }
6115
+ }
6116
+ /**
6117
+ * Initializes/switches Web Audio source for regular video nodes
6118
+ * Does NOT start visualization - only ensures audio routing
6119
+ * Must be called after video loads for proper audio routing once Web Audio is initialized
6120
+ */
6121
+ initializeAudioForVideo() {
6122
+ const activeVideo = this.getActiveVideo();
6123
+ if (!activeVideo) {
6124
+ return;
6125
+ }
6126
+ try {
6127
+ this.audioVisualizationManager.initialize(activeVideo);
6128
+ } catch (error2) {
6129
+ console.error("VideoManager: Failed to initialize audio for video", error2);
6130
+ }
6131
+ }
5704
6132
  /**
5705
6133
  * Hides audio fallback overlay and removes poster image
6134
+ * Note: Does not cleanup Web Audio connections - they must persist for audio playback
5706
6135
  */
5707
6136
  hideAudioFallbackOverlay() {
5708
6137
  if (!this.container) {
5709
6138
  return;
5710
6139
  }
6140
+ this.audioVisualizationManager.stopVisualization();
5711
6141
  this.container.style.removeProperty("--sf-audio-poster-url");
5712
6142
  this.container.classList.remove("sf-video-container--audio-fallback");
5713
6143
  if (this.audioFallbackOverlay && this.audioFallbackOverlay.parentNode) {
5714
6144
  this.audioFallbackOverlay.parentNode.removeChild(this.audioFallbackOverlay);
5715
6145
  this.audioFallbackOverlay = null;
5716
6146
  }
6147
+ this.soundbarElement = null;
5717
6148
  }
5718
6149
  }
5719
6150
  class CursorManager {
@@ -10784,7 +11215,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
10784
11215
  __proto__: null,
10785
11216
  SaltfishPlayer
10786
11217
  }, Symbol.toStringTag, { value: "Module" }));
10787
- const version = "0.2.78";
11218
+ const version = "0.3.0";
10788
11219
  const packageJson = {
10789
11220
  version
10790
11221
  };