unified-video-framework 1.4.259 → 1.4.261
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
|
|
@@ -1202,7 +1206,10 @@ export class WebPlayer extends BasePlayer {
|
|
|
1202
1206
|
}
|
|
1203
1207
|
});
|
|
1204
1208
|
|
|
1205
|
-
|
|
1209
|
+
// Track the initial controls state
|
|
1210
|
+
this.currentYouTubeControlsState = this.config.youtubeNativeControls === true;
|
|
1211
|
+
|
|
1212
|
+
this.debugLog('YouTube player created with controls:', this.currentYouTubeControlsState);
|
|
1206
1213
|
}
|
|
1207
1214
|
|
|
1208
1215
|
private async loadYouTubeAPI(): Promise<void> {
|
|
@@ -1433,17 +1440,66 @@ export class WebPlayer extends BasePlayer {
|
|
|
1433
1440
|
* Update controls visibility based on YouTube Live status and config
|
|
1434
1441
|
*/
|
|
1435
1442
|
private updateControlsVisibility(): void {
|
|
1436
|
-
const controlsContainer = document.getElementById('uvf-controls
|
|
1437
|
-
if (!controlsContainer)
|
|
1443
|
+
const controlsContainer = document.getElementById('uvf-controls');
|
|
1444
|
+
if (!controlsContainer) {
|
|
1445
|
+
this.debugWarn('Controls container not found, looking for .uvf-controls-bar');
|
|
1446
|
+
const controlsBar = this.playerWrapper?.querySelector('.uvf-controls-bar') as HTMLElement;
|
|
1447
|
+
if (!controlsBar) {
|
|
1448
|
+
this.debugWarn('Controls bar not found either, cannot update controls visibility');
|
|
1449
|
+
return;
|
|
1450
|
+
}
|
|
1451
|
+
// Use the controls bar as fallback
|
|
1452
|
+
const controlsContainerFallback = controlsBar;
|
|
1453
|
+
|
|
1454
|
+
if (this.youtubePlayer && this.useYouTubeNativeControls) {
|
|
1455
|
+
// Hide custom controls
|
|
1456
|
+
controlsContainerFallback.style.display = 'none';
|
|
1457
|
+
// Also hide any other control elements
|
|
1458
|
+
const videoContainer = this.playerWrapper?.querySelector('.uvf-video-container') as HTMLElement;
|
|
1459
|
+
if (videoContainer) {
|
|
1460
|
+
const allControls = videoContainer.querySelectorAll('.uvf-top-gradient, .uvf-controls-gradient, .uvf-top-bar, .uvf-center-play-container, .uvf-shortcut-indicator');
|
|
1461
|
+
allControls.forEach(el => (el as HTMLElement).style.display = 'none');
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
// Only recreate YouTube player if it doesn't currently have native controls
|
|
1465
|
+
if (this.currentYouTubeControlsState !== true) {
|
|
1466
|
+
this.recreateYouTubePlayerWithNativeControls();
|
|
1467
|
+
this.currentYouTubeControlsState = true;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
this.debugLog('✅ YouTube native controls enabled', {
|
|
1471
|
+
isLive: this.isYouTubeLive,
|
|
1472
|
+
reason: this.config.youtubeNativeControls === true ? 'Explicitly enabled in config' : 'Live stream detected'
|
|
1473
|
+
});
|
|
1474
|
+
} else {
|
|
1475
|
+
// Show custom controls
|
|
1476
|
+
controlsContainerFallback.style.display = 'flex';
|
|
1477
|
+
// Also show other control elements
|
|
1478
|
+
const videoContainer = this.playerWrapper?.querySelector('.uvf-video-container') as HTMLElement;
|
|
1479
|
+
if (videoContainer) {
|
|
1480
|
+
const allControls = videoContainer.querySelectorAll('.uvf-top-gradient, .uvf-controls-gradient, .uvf-top-bar, .uvf-center-play-container, .uvf-shortcut-indicator');
|
|
1481
|
+
allControls.forEach(el => (el as HTMLElement).style.display = '');
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
// Only recreate YouTube player if it currently has native controls
|
|
1485
|
+
if (this.currentYouTubeControlsState !== false) {
|
|
1486
|
+
this.recreateYouTubePlayerWithoutNativeControls();
|
|
1487
|
+
this.currentYouTubeControlsState = false;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
this.debugLog('✅ Custom controls enabled for YouTube video');
|
|
1491
|
+
}
|
|
1492
|
+
return;
|
|
1493
|
+
}
|
|
1438
1494
|
|
|
1439
1495
|
if (this.youtubePlayer && this.useYouTubeNativeControls) {
|
|
1440
1496
|
// Hide custom controls and show YouTube native controls
|
|
1441
1497
|
controlsContainer.style.display = 'none';
|
|
1442
1498
|
|
|
1443
|
-
//
|
|
1444
|
-
|
|
1445
|
-
if (this.config.youtubeNativeControls === false) {
|
|
1499
|
+
// Only recreate YouTube player if it doesn't currently have native controls
|
|
1500
|
+
if (this.currentYouTubeControlsState !== true) {
|
|
1446
1501
|
this.recreateYouTubePlayerWithNativeControls();
|
|
1502
|
+
this.currentYouTubeControlsState = true;
|
|
1447
1503
|
}
|
|
1448
1504
|
|
|
1449
1505
|
this.debugLog('✅ YouTube native controls enabled', {
|
|
@@ -1454,9 +1510,10 @@ export class WebPlayer extends BasePlayer {
|
|
|
1454
1510
|
// Show custom controls and ensure YouTube native controls are disabled
|
|
1455
1511
|
controlsContainer.style.display = 'flex';
|
|
1456
1512
|
|
|
1457
|
-
//
|
|
1458
|
-
if (this.
|
|
1513
|
+
// Only recreate YouTube player if it currently has native controls
|
|
1514
|
+
if (this.currentYouTubeControlsState !== false) {
|
|
1459
1515
|
this.recreateYouTubePlayerWithoutNativeControls();
|
|
1516
|
+
this.currentYouTubeControlsState = false;
|
|
1460
1517
|
}
|
|
1461
1518
|
|
|
1462
1519
|
this.debugLog('✅ Custom controls enabled for YouTube video');
|
|
@@ -1650,6 +1707,7 @@ export class WebPlayer extends BasePlayer {
|
|
|
1650
1707
|
private youtubeTimeTrackingInterval: NodeJS.Timeout | null = null;
|
|
1651
1708
|
private isYouTubeLive: boolean = false;
|
|
1652
1709
|
private useYouTubeNativeControls: boolean = false;
|
|
1710
|
+
private currentYouTubeControlsState: boolean | null = null; // Track current YouTube player controls state
|
|
1653
1711
|
|
|
1654
1712
|
private startYouTubeTimeTracking(): void {
|
|
1655
1713
|
if (this.youtubeTimeTrackingInterval) {
|