unified-video-framework 1.4.450 → 1.4.452

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.
@@ -1733,34 +1733,73 @@ export class WebPlayer extends BasePlayer {
1733
1733
 
1734
1734
  container.appendChild(iframeContainer);
1735
1735
 
1736
- // Create transparent overlay to block YouTube's native controls (when custom controls are enabled)
1737
- if (!this.youtubeNativeControls) {
1736
+ // Create transparent overlay for YouTube videos
1737
+ // When youtubeNativeControls=false: blocks YouTube controls and handles play/pause
1738
+ // When youtubeNativeControls=true with customControls=true: allows hover detection for our controls
1739
+ if (!this.youtubeNativeControls || this.useCustomControls) {
1738
1740
  const overlay = document.createElement('div');
1739
1741
  overlay.className = 'uvf-youtube-overlay';
1740
- // Styles are handled in CSS, just set essentials here
1741
- overlay.style.cssText = `
1742
- position: absolute;
1743
- top: 0;
1744
- left: 0;
1745
- width: 100%;
1746
- z-index: 2;
1747
- `;
1748
1742
 
1749
- // Handle click to toggle play/pause
1750
- overlay.addEventListener('click', () => {
1751
- this.togglePlayPause();
1743
+ // Different behavior based on mode
1744
+ if (!this.youtubeNativeControls) {
1745
+ // Full blocking mode - block all YouTube controls
1746
+ // Note: Don't set height inline - let CSS class .uvf-youtube-overlay handle it
1747
+ // CSS sets height: calc(100% - 60px) normally, and 100% when not hovered
1748
+ overlay.style.cssText = `
1749
+ position: absolute;
1750
+ top: 0;
1751
+ left: 0;
1752
+ width: 100%;
1753
+ z-index: 2;
1754
+ pointer-events: auto;
1755
+ cursor: pointer;
1756
+ `;
1757
+
1758
+ // Handle click to toggle play/pause
1759
+ overlay.addEventListener('click', () => {
1760
+ this.togglePlayPause();
1761
+ });
1762
+
1763
+ // Handle double-click for fullscreen
1764
+ overlay.addEventListener('dblclick', () => {
1765
+ if (this.isFullscreen()) {
1766
+ this.exitFullscreen();
1767
+ } else {
1768
+ this.enterFullscreen();
1769
+ }
1770
+ });
1771
+ } else {
1772
+ // Hybrid mode - transparent overlay just for hover detection, allow YouTube controls through
1773
+ overlay.style.cssText = `
1774
+ position: absolute;
1775
+ top: 0;
1776
+ left: 0;
1777
+ width: 100%;
1778
+ height: 100%;
1779
+ z-index: 2;
1780
+ pointer-events: none;
1781
+ `;
1782
+ }
1783
+
1784
+ // Always add mousemove listener for hover detection
1785
+ overlay.addEventListener('mouseenter', () => {
1786
+ this.playerWrapper?.classList.add('controls-visible');
1752
1787
  });
1753
1788
 
1754
- // Handle double-click for fullscreen
1755
- overlay.addEventListener('dblclick', () => {
1756
- if (this.isFullscreen()) {
1757
- this.exitFullscreen();
1758
- } else {
1759
- this.enterFullscreen();
1760
- }
1789
+ overlay.addEventListener('mouseleave', () => {
1790
+ this.playerWrapper?.classList.remove('controls-visible');
1761
1791
  });
1762
1792
 
1763
1793
  container.appendChild(overlay);
1794
+
1795
+ // Also add listeners to the container for fallback hover detection
1796
+ container.addEventListener('mouseenter', () => {
1797
+ this.playerWrapper?.classList.add('controls-visible');
1798
+ });
1799
+
1800
+ container.addEventListener('mouseleave', () => {
1801
+ this.playerWrapper?.classList.remove('controls-visible');
1802
+ });
1764
1803
  }
1765
1804
 
1766
1805
  // Load YouTube IFrame API if not loaded
@@ -1851,6 +1890,17 @@ export class WebPlayer extends BasePlayer {
1851
1890
  this.hideCustomControls();
1852
1891
  } else if (this.youtubeNativeControls && this.useCustomControls) {
1853
1892
  this.debugLog('[YouTube] Hybrid mode - both YouTube native controls and custom controls enabled');
1893
+ } else if (!this.youtubeNativeControls && this.useCustomControls && this.playerWrapper) {
1894
+ // Custom controls only mode - ensure custom controls are visible
1895
+ this.debugLog('[YouTube] Custom controls only mode - showing custom controls, hiding YouTube native controls');
1896
+ this.playerWrapper.classList.remove('youtube-native-controls-mode');
1897
+ this.playerWrapper.classList.add('youtube-custom-controls-mode');
1898
+ this.showCustomControls();
1899
+ } else if (!this.youtubeNativeControls && !this.useCustomControls && this.playerWrapper) {
1900
+ // No controls mode - both YouTube native and custom controls are hidden
1901
+ this.debugLog('[YouTube] No controls mode - all controls hidden');
1902
+ this.playerWrapper.classList.add('youtube-native-controls-mode');
1903
+ this.hideCustomControls();
1854
1904
  }
1855
1905
 
1856
1906
  // Set initial volume
@@ -2026,6 +2076,33 @@ export class WebPlayer extends BasePlayer {
2026
2076
  }
2027
2077
  }
2028
2078
 
2079
+ private showCustomControls(): void {
2080
+ // Show all custom control elements for YouTube videos when custom controls are enabled
2081
+ const controlsBar = document.getElementById('uvf-controls') as HTMLElement;
2082
+ if (controlsBar) {
2083
+ controlsBar.style.display = '';
2084
+ controlsBar.style.visibility = '';
2085
+ controlsBar.style.opacity = '';
2086
+ controlsBar.style.pointerEvents = '';
2087
+ }
2088
+
2089
+ const topBar = document.querySelector('.uvf-top-bar') as HTMLElement;
2090
+ if (topBar) {
2091
+ topBar.style.display = '';
2092
+ topBar.style.visibility = '';
2093
+ topBar.style.opacity = '';
2094
+ topBar.style.pointerEvents = '';
2095
+ }
2096
+
2097
+ const centerPlayContainer = document.querySelector('.uvf-center-play-container') as HTMLElement;
2098
+ if (centerPlayContainer) {
2099
+ centerPlayContainer.style.display = '';
2100
+ centerPlayContainer.style.visibility = '';
2101
+ centerPlayContainer.style.opacity = '';
2102
+ centerPlayContainer.style.pointerEvents = '';
2103
+ }
2104
+ }
2105
+
2029
2106
  private youtubeTimeTrackingInterval: NodeJS.Timeout | null = null;
2030
2107
 
2031
2108
  private startYouTubeTimeTracking(): void {
@@ -5450,14 +5527,14 @@ export class WebPlayer extends BasePlayer {
5450
5527
  top: 0;
5451
5528
  height: 120px;
5452
5529
  background: linear-gradient(to bottom, var(--uvf-overlay-medium), var(--uvf-overlay-transparent));
5453
- z-index: 6;
5530
+ z-index: 96;
5454
5531
  }
5455
-
5532
+
5456
5533
  .uvf-controls-gradient {
5457
5534
  bottom: 0;
5458
5535
  height: 150px;
5459
5536
  background: linear-gradient(to top, var(--uvf-overlay-strong), var(--uvf-overlay-transparent));
5460
- z-index: 9;
5537
+ z-index: 97;
5461
5538
  }
5462
5539
 
5463
5540
  .uvf-player-wrapper:hover .uvf-top-gradient,
@@ -5511,7 +5588,7 @@ export class WebPlayer extends BasePlayer {
5511
5588
  align-items: center;
5512
5589
  justify-content: center;
5513
5590
  pointer-events: none;
5514
- z-index: 8;
5591
+ z-index: 99;
5515
5592
  }
5516
5593
 
5517
5594
  /* Center Play Button */
@@ -5581,7 +5658,7 @@ export class WebPlayer extends BasePlayer {
5581
5658
  left: 0;
5582
5659
  right: 0;
5583
5660
  padding: 20px;
5584
- z-index: 10;
5661
+ z-index: 100;
5585
5662
  opacity: 0;
5586
5663
  transform: translateY(10px);
5587
5664
  transition: all 0.3s ease;
@@ -6970,7 +7047,7 @@ export class WebPlayer extends BasePlayer {
6970
7047
  left: 0;
6971
7048
  right: 0;
6972
7049
  padding: 20px;
6973
- z-index: 7;
7050
+ z-index: 98;
6974
7051
  display: flex;
6975
7052
  justify-content: space-between;
6976
7053
  align-items: flex-start;
@@ -8757,7 +8834,26 @@ export class WebPlayer extends BasePlayer {
8757
8834
  opacity: 0 !important;
8758
8835
  pointer-events: none !important;
8759
8836
  }
8760
-
8837
+
8838
+ /* YouTube custom controls mode - show our custom controls for YouTube videos */
8839
+ .uvf-player-wrapper.youtube-custom-controls-mode .uvf-controls-bar {
8840
+ display: flex !important;
8841
+ visibility: visible !important;
8842
+ pointer-events: auto !important;
8843
+ }
8844
+
8845
+ .uvf-player-wrapper.youtube-custom-controls-mode .uvf-top-bar {
8846
+ display: flex !important;
8847
+ visibility: visible !important;
8848
+ pointer-events: auto !important;
8849
+ }
8850
+
8851
+ .uvf-player-wrapper.youtube-custom-controls-mode .uvf-center-play-container {
8852
+ display: flex !important;
8853
+ visibility: visible !important;
8854
+ pointer-events: auto !important;
8855
+ }
8856
+
8761
8857
  /* Override any inline styles */
8762
8858
  .controls-disabled .uvf-controls-bar,
8763
8859
  .controls-disabled .uvf-top-bar,