unified-video-framework 1.4.260 → 1.4.262
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.
|
@@ -179,9 +179,13 @@ export class WebPlayer extends BasePlayer {
|
|
|
179
179
|
console.log('WebPlayer.initialize called with config:', config);
|
|
180
180
|
|
|
181
181
|
// Set useCustomControls based on config before calling parent initialize
|
|
182
|
+
// Check both customControls (specific) and controls (standard) options
|
|
182
183
|
if (config && config.customControls !== undefined) {
|
|
183
184
|
this.useCustomControls = config.customControls;
|
|
184
|
-
console.log('Custom controls set to:', this.useCustomControls);
|
|
185
|
+
console.log('Custom controls set via customControls to:', this.useCustomControls);
|
|
186
|
+
} else if (config && config.controls !== undefined) {
|
|
187
|
+
this.useCustomControls = config.controls;
|
|
188
|
+
console.log('Custom controls set via controls to:', this.useCustomControls);
|
|
185
189
|
}
|
|
186
190
|
|
|
187
191
|
// Configure settings menu options
|
|
@@ -1150,16 +1154,18 @@ export class WebPlayer extends BasePlayer {
|
|
|
1150
1154
|
this.video.style.display = 'none';
|
|
1151
1155
|
}
|
|
1152
1156
|
|
|
1153
|
-
// Create iframe container
|
|
1157
|
+
// Create iframe container with proper z-index based on controls configuration
|
|
1154
1158
|
const iframeContainer = document.createElement('div');
|
|
1155
1159
|
iframeContainer.id = `youtube-player-${videoId}`;
|
|
1160
|
+
const useNativeControls = this.config.youtubeNativeControls === true;
|
|
1156
1161
|
iframeContainer.style.cssText = `
|
|
1157
1162
|
position: absolute;
|
|
1158
1163
|
top: 0;
|
|
1159
1164
|
left: 0;
|
|
1160
1165
|
width: 100%;
|
|
1161
1166
|
height: 100%;
|
|
1162
|
-
z-index: 1;
|
|
1167
|
+
z-index: ${useNativeControls ? '1' : '0'};
|
|
1168
|
+
pointer-events: ${useNativeControls ? 'auto' : 'none'};
|
|
1163
1169
|
`;
|
|
1164
1170
|
|
|
1165
1171
|
// Remove existing YouTube player if any
|
|
@@ -1265,6 +1271,8 @@ export class WebPlayer extends BasePlayer {
|
|
|
1265
1271
|
setTimeout(() => {
|
|
1266
1272
|
this.updateMetadataUI();
|
|
1267
1273
|
this.updateControlsVisibility();
|
|
1274
|
+
// Ensure UI elements have correct z-index for YouTube integration
|
|
1275
|
+
this.ensureUILayering();
|
|
1268
1276
|
}, 500);
|
|
1269
1277
|
}
|
|
1270
1278
|
|
|
@@ -1432,17 +1440,127 @@ export class WebPlayer extends BasePlayer {
|
|
|
1432
1440
|
}
|
|
1433
1441
|
}
|
|
1434
1442
|
|
|
1443
|
+
/**
|
|
1444
|
+
* Ensure all UI elements have correct z-index for proper layering
|
|
1445
|
+
*/
|
|
1446
|
+
private ensureUILayering(): void {
|
|
1447
|
+
if (!this.youtubePlayer) return;
|
|
1448
|
+
|
|
1449
|
+
const videoContainer = this.playerWrapper?.querySelector('.uvf-video-container') as HTMLElement;
|
|
1450
|
+
if (!videoContainer) return;
|
|
1451
|
+
|
|
1452
|
+
// Ensure all custom UI elements are above the YouTube iframe
|
|
1453
|
+
const uiElements = videoContainer.querySelectorAll('.uvf-top-gradient, .uvf-controls-gradient, .uvf-top-bar, .uvf-center-play-container, .uvf-shortcut-indicator, .uvf-controls-bar');
|
|
1454
|
+
uiElements.forEach(el => {
|
|
1455
|
+
const element = el as HTMLElement;
|
|
1456
|
+
element.style.zIndex = '2';
|
|
1457
|
+
element.style.position = 'relative';
|
|
1458
|
+
});
|
|
1459
|
+
|
|
1460
|
+
this.debugLog('UI layering ensured for YouTube player');
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1435
1463
|
/**
|
|
1436
1464
|
* Update controls visibility based on YouTube Live status and config
|
|
1437
1465
|
*/
|
|
1438
1466
|
private updateControlsVisibility(): void {
|
|
1439
|
-
const controlsContainer = document.getElementById('uvf-controls
|
|
1440
|
-
if (!controlsContainer)
|
|
1467
|
+
const controlsContainer = document.getElementById('uvf-controls');
|
|
1468
|
+
if (!controlsContainer) {
|
|
1469
|
+
this.debugWarn('Controls container not found, looking for .uvf-controls-bar');
|
|
1470
|
+
const controlsBar = this.playerWrapper?.querySelector('.uvf-controls-bar') as HTMLElement;
|
|
1471
|
+
if (!controlsBar) {
|
|
1472
|
+
this.debugWarn('Controls bar not found either, cannot update controls visibility');
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
// Use the controls bar as fallback
|
|
1476
|
+
const controlsContainerFallback = controlsBar;
|
|
1477
|
+
|
|
1478
|
+
if (this.youtubePlayer && this.useYouTubeNativeControls) {
|
|
1479
|
+
// Hide custom controls
|
|
1480
|
+
controlsContainerFallback.style.display = 'none';
|
|
1481
|
+
|
|
1482
|
+
// Lower YouTube wrapper z-index and pointer events appropriately
|
|
1483
|
+
const videoId = this.source?.metadata?.videoId;
|
|
1484
|
+
if (videoId) {
|
|
1485
|
+
const ytWrapper = this.playerWrapper?.querySelector(`#youtube-player-${videoId}`) as HTMLElement;
|
|
1486
|
+
if (ytWrapper) {
|
|
1487
|
+
ytWrapper.style.zIndex = '1';
|
|
1488
|
+
ytWrapper.style.pointerEvents = 'auto';
|
|
1489
|
+
ytWrapper.style.position = 'absolute';
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
// Also hide any other control elements
|
|
1494
|
+
const videoContainer = this.playerWrapper?.querySelector('.uvf-video-container') as HTMLElement;
|
|
1495
|
+
if (videoContainer) {
|
|
1496
|
+
const allControls = videoContainer.querySelectorAll('.uvf-top-gradient, .uvf-controls-gradient, .uvf-top-bar, .uvf-center-play-container, .uvf-shortcut-indicator');
|
|
1497
|
+
allControls.forEach(el => (el as HTMLElement).style.display = 'none');
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
// Only recreate YouTube player if it doesn't currently have native controls
|
|
1501
|
+
if (this.currentYouTubeControlsState !== true) {
|
|
1502
|
+
this.recreateYouTubePlayerWithNativeControls();
|
|
1503
|
+
this.currentYouTubeControlsState = true;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
this.debugLog('✅ YouTube native controls enabled', {
|
|
1507
|
+
isLive: this.isYouTubeLive,
|
|
1508
|
+
reason: this.config.youtubeNativeControls === true ? 'Explicitly enabled in config' : 'Live stream detected'
|
|
1509
|
+
});
|
|
1510
|
+
} else {
|
|
1511
|
+
// Show custom controls
|
|
1512
|
+
controlsContainerFallback.style.display = 'flex';
|
|
1513
|
+
controlsContainerFallback.style.zIndex = '2';
|
|
1514
|
+
|
|
1515
|
+
// Raise YouTube wrapper below UI and disable pointer events so UI is clickable
|
|
1516
|
+
const videoId = this.source?.metadata?.videoId;
|
|
1517
|
+
if (videoId) {
|
|
1518
|
+
const ytWrapper = this.playerWrapper?.querySelector(`#youtube-player-${videoId}`) as HTMLElement;
|
|
1519
|
+
if (ytWrapper) {
|
|
1520
|
+
ytWrapper.style.zIndex = '0';
|
|
1521
|
+
ytWrapper.style.pointerEvents = 'none';
|
|
1522
|
+
ytWrapper.style.position = 'absolute';
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
// Also show other control elements and ensure they are above the iframe
|
|
1527
|
+
const videoContainer = this.playerWrapper?.querySelector('.uvf-video-container') as HTMLElement;
|
|
1528
|
+
if (videoContainer) {
|
|
1529
|
+
const allControls = videoContainer.querySelectorAll('.uvf-top-gradient, .uvf-controls-gradient, .uvf-top-bar, .uvf-center-play-container, .uvf-shortcut-indicator');
|
|
1530
|
+
allControls.forEach(el => {
|
|
1531
|
+
const elh = el as HTMLElement;
|
|
1532
|
+
elh.style.display = '';
|
|
1533
|
+
elh.style.zIndex = '2';
|
|
1534
|
+
elh.style.position = 'relative';
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
// Only recreate YouTube player if it currently has native controls
|
|
1539
|
+
if (this.currentYouTubeControlsState !== false) {
|
|
1540
|
+
this.recreateYouTubePlayerWithoutNativeControls();
|
|
1541
|
+
this.currentYouTubeControlsState = false;
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
this.debugLog('✅ Custom controls enabled for YouTube video');
|
|
1545
|
+
}
|
|
1546
|
+
return;
|
|
1547
|
+
}
|
|
1441
1548
|
|
|
1442
1549
|
if (this.youtubePlayer && this.useYouTubeNativeControls) {
|
|
1443
1550
|
// Hide custom controls and show YouTube native controls
|
|
1444
1551
|
controlsContainer.style.display = 'none';
|
|
1445
1552
|
|
|
1553
|
+
// Lower YouTube wrapper z-index and enable pointer events
|
|
1554
|
+
const videoId = this.source?.metadata?.videoId;
|
|
1555
|
+
if (videoId) {
|
|
1556
|
+
const ytWrapper = this.playerWrapper?.querySelector(`#youtube-player-${videoId}`) as HTMLElement;
|
|
1557
|
+
if (ytWrapper) {
|
|
1558
|
+
ytWrapper.style.zIndex = '1';
|
|
1559
|
+
ytWrapper.style.pointerEvents = 'auto';
|
|
1560
|
+
ytWrapper.style.position = 'absolute';
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1446
1564
|
// Only recreate YouTube player if it doesn't currently have native controls
|
|
1447
1565
|
if (this.currentYouTubeControlsState !== true) {
|
|
1448
1566
|
this.recreateYouTubePlayerWithNativeControls();
|
|
@@ -1456,6 +1574,30 @@ export class WebPlayer extends BasePlayer {
|
|
|
1456
1574
|
} else {
|
|
1457
1575
|
// Show custom controls and ensure YouTube native controls are disabled
|
|
1458
1576
|
controlsContainer.style.display = 'flex';
|
|
1577
|
+
controlsContainer.style.zIndex = '2';
|
|
1578
|
+
controlsContainer.style.position = 'relative';
|
|
1579
|
+
|
|
1580
|
+
// Ensure YouTube iframe is behind controls and disable pointer events
|
|
1581
|
+
const videoId = this.source?.metadata?.videoId;
|
|
1582
|
+
if (videoId) {
|
|
1583
|
+
const ytWrapper = this.playerWrapper?.querySelector(`#youtube-player-${videoId}`) as HTMLElement;
|
|
1584
|
+
if (ytWrapper) {
|
|
1585
|
+
ytWrapper.style.zIndex = '0';
|
|
1586
|
+
ytWrapper.style.pointerEvents = 'none';
|
|
1587
|
+
ytWrapper.style.position = 'absolute';
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
// Ensure other UI elements are also above the iframe
|
|
1592
|
+
const videoContainer = this.playerWrapper?.querySelector('.uvf-video-container') as HTMLElement;
|
|
1593
|
+
if (videoContainer) {
|
|
1594
|
+
const allControls = videoContainer.querySelectorAll('.uvf-top-gradient, .uvf-controls-gradient, .uvf-top-bar, .uvf-center-play-container, .uvf-shortcut-indicator');
|
|
1595
|
+
allControls.forEach(el => {
|
|
1596
|
+
const elh = el as HTMLElement;
|
|
1597
|
+
elh.style.zIndex = '2';
|
|
1598
|
+
elh.style.position = 'relative';
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1459
1601
|
|
|
1460
1602
|
// Only recreate YouTube player if it currently has native controls
|
|
1461
1603
|
if (this.currentYouTubeControlsState !== false) {
|
|
@@ -1564,7 +1706,8 @@ export class WebPlayer extends BasePlayer {
|
|
|
1564
1706
|
left: 0;
|
|
1565
1707
|
width: 100%;
|
|
1566
1708
|
height: 100%;
|
|
1567
|
-
z-index:
|
|
1709
|
+
z-index: 0;
|
|
1710
|
+
pointer-events: none;
|
|
1568
1711
|
`;
|
|
1569
1712
|
container.appendChild(iframeContainer);
|
|
1570
1713
|
|