unified-video-framework 1.4.257 → 1.4.258
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.
- package/package.json +1 -1
- package/packages/core/src/interfaces/IVideoPlayer.ts +1 -1
- package/packages/web/dist/WebPlayer.d.ts +1 -0
- package/packages/web/dist/WebPlayer.d.ts.map +1 -1
- package/packages/web/dist/WebPlayer.js +61 -5
- package/packages/web/dist/WebPlayer.js.map +1 -1
- package/packages/web/src/WebPlayer.ts +81 -8
|
@@ -1184,7 +1184,7 @@ export class WebPlayer extends BasePlayer {
|
|
|
1184
1184
|
width: '100%',
|
|
1185
1185
|
height: '100%',
|
|
1186
1186
|
playerVars: {
|
|
1187
|
-
controls: this.config.youtubeNativeControls
|
|
1187
|
+
controls: this.config.youtubeNativeControls === true ? 1 : 0, // Native controls disabled by default for custom controls
|
|
1188
1188
|
disablekb: 0, // Allow keyboard controls
|
|
1189
1189
|
fs: 0, // Hide fullscreen button
|
|
1190
1190
|
iv_load_policy: 3, // Hide annotations
|
|
@@ -1401,8 +1401,8 @@ export class WebPlayer extends BasePlayer {
|
|
|
1401
1401
|
const videoData = this.youtubePlayer.getVideoData();
|
|
1402
1402
|
this.isYouTubeLive = videoData?.isLive || false;
|
|
1403
1403
|
|
|
1404
|
-
//
|
|
1405
|
-
this.useYouTubeNativeControls = this.config.youtubeNativeControls
|
|
1404
|
+
// Use custom controls by default, unless youtubeNativeControls is explicitly set to true
|
|
1405
|
+
this.useYouTubeNativeControls = this.config.youtubeNativeControls === true;
|
|
1406
1406
|
|
|
1407
1407
|
this.debugLog('YouTube Live status:', {
|
|
1408
1408
|
isLive: this.isYouTubeLive,
|
|
@@ -1416,7 +1416,7 @@ export class WebPlayer extends BasePlayer {
|
|
|
1416
1416
|
try {
|
|
1417
1417
|
const duration = this.youtubePlayer.getDuration();
|
|
1418
1418
|
this.isYouTubeLive = !duration || duration === 0;
|
|
1419
|
-
this.useYouTubeNativeControls = this.config.youtubeNativeControls
|
|
1419
|
+
this.useYouTubeNativeControls = this.config.youtubeNativeControls === true;
|
|
1420
1420
|
|
|
1421
1421
|
this.debugLog('YouTube Live detected via duration check:', {
|
|
1422
1422
|
duration,
|
|
@@ -1440,18 +1440,25 @@ export class WebPlayer extends BasePlayer {
|
|
|
1440
1440
|
// Hide custom controls and show YouTube native controls
|
|
1441
1441
|
controlsContainer.style.display = 'none';
|
|
1442
1442
|
|
|
1443
|
-
// Re-create YouTube player with native controls if
|
|
1444
|
-
|
|
1443
|
+
// Re-create YouTube player with native controls if the current player doesn't have them
|
|
1444
|
+
// This happens when the player was initially created with controls disabled
|
|
1445
|
+
if (this.config.youtubeNativeControls === false) {
|
|
1445
1446
|
this.recreateYouTubePlayerWithNativeControls();
|
|
1446
1447
|
}
|
|
1447
1448
|
|
|
1448
1449
|
this.debugLog('✅ YouTube native controls enabled', {
|
|
1449
1450
|
isLive: this.isYouTubeLive,
|
|
1450
|
-
reason: this.config.youtubeNativeControls
|
|
1451
|
+
reason: this.config.youtubeNativeControls === true ? 'Explicitly enabled in config' : 'Live stream detected'
|
|
1451
1452
|
});
|
|
1452
1453
|
} else {
|
|
1453
|
-
// Show custom controls
|
|
1454
|
+
// Show custom controls and ensure YouTube native controls are disabled
|
|
1454
1455
|
controlsContainer.style.display = 'flex';
|
|
1456
|
+
|
|
1457
|
+
// Re-create YouTube player without native controls if needed
|
|
1458
|
+
if (this.config.youtubeNativeControls === true) {
|
|
1459
|
+
this.recreateYouTubePlayerWithoutNativeControls();
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1455
1462
|
this.debugLog('✅ Custom controls enabled for YouTube video');
|
|
1456
1463
|
}
|
|
1457
1464
|
}
|
|
@@ -1520,6 +1527,72 @@ export class WebPlayer extends BasePlayer {
|
|
|
1520
1527
|
});
|
|
1521
1528
|
}
|
|
1522
1529
|
|
|
1530
|
+
/**
|
|
1531
|
+
* Recreate YouTube player without native controls enabled
|
|
1532
|
+
*/
|
|
1533
|
+
private recreateYouTubePlayerWithoutNativeControls(): void {
|
|
1534
|
+
if (!this.source?.metadata?.videoId) return;
|
|
1535
|
+
|
|
1536
|
+
const videoId = this.source.metadata.videoId;
|
|
1537
|
+
const currentTime = this.youtubePlayer?.getCurrentTime() || 0;
|
|
1538
|
+
|
|
1539
|
+
// Find the container
|
|
1540
|
+
const container = this.playerWrapper || this.video?.parentElement;
|
|
1541
|
+
if (!container) return;
|
|
1542
|
+
|
|
1543
|
+
// Destroy current player
|
|
1544
|
+
if (this.youtubePlayer) {
|
|
1545
|
+
this.youtubePlayer.destroy();
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
// Remove existing iframe container
|
|
1549
|
+
const existingContainer = container.querySelector(`#youtube-player-${videoId}`);
|
|
1550
|
+
if (existingContainer) {
|
|
1551
|
+
existingContainer.remove();
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
// Create new iframe container
|
|
1555
|
+
const iframeContainer = document.createElement('div');
|
|
1556
|
+
iframeContainer.id = `youtube-player-${videoId}`;
|
|
1557
|
+
iframeContainer.style.cssText = `
|
|
1558
|
+
position: absolute;
|
|
1559
|
+
top: 0;
|
|
1560
|
+
left: 0;
|
|
1561
|
+
width: 100%;
|
|
1562
|
+
height: 100%;
|
|
1563
|
+
z-index: 1;
|
|
1564
|
+
`;
|
|
1565
|
+
container.appendChild(iframeContainer);
|
|
1566
|
+
|
|
1567
|
+
// Create new player without native controls
|
|
1568
|
+
this.youtubePlayer = new window.YT.Player(iframeContainer.id, {
|
|
1569
|
+
videoId: videoId,
|
|
1570
|
+
width: '100%',
|
|
1571
|
+
height: '100%',
|
|
1572
|
+
playerVars: {
|
|
1573
|
+
autoplay: this.config.autoPlay ? 1 : 0,
|
|
1574
|
+
controls: 0, // Disable native controls
|
|
1575
|
+
disablekb: 0,
|
|
1576
|
+
fs: 0,
|
|
1577
|
+
iv_load_policy: 3,
|
|
1578
|
+
modestbranding: 1,
|
|
1579
|
+
rel: 0,
|
|
1580
|
+
showinfo: 0,
|
|
1581
|
+
playsinline: 1,
|
|
1582
|
+
start: Math.floor(currentTime)
|
|
1583
|
+
},
|
|
1584
|
+
events: {
|
|
1585
|
+
onReady: () => {
|
|
1586
|
+
this.youtubePlayerReady = true;
|
|
1587
|
+
this.debugLog('YouTube player without native controls ready');
|
|
1588
|
+
this.emit('onReady');
|
|
1589
|
+
},
|
|
1590
|
+
onStateChange: (event: any) => this.onYouTubePlayerStateChange(event),
|
|
1591
|
+
onError: (event: any) => this.onYouTubePlayerError(event)
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
|
|
1523
1596
|
/**
|
|
1524
1597
|
* Toggle between native and custom YouTube controls
|
|
1525
1598
|
*/
|