myetv-player 1.6.3 → 1.6.5
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/README.md +1 -0
- package/css/myetv-player.css +451 -466
- package/css/myetv-player.min.css +1 -1
- package/dist/myetv-player.js +259 -148
- package/dist/myetv-player.min.js +183 -117
- package/package.json +3 -1
- package/plugins/youtube/myetv-player-youtube-plugin.js +52 -45
package/dist/myetv-player.js
CHANGED
|
@@ -655,6 +655,7 @@ constructor(videoElement, options = {}) {
|
|
|
655
655
|
showPictureInPicture: true, // Enable PiP button
|
|
656
656
|
showSubtitles: true, // Enable subtitles button
|
|
657
657
|
subtitlesEnabled: false, // Enable subtitles by default if available
|
|
658
|
+
showSettingsMenu: true, // Show settings menu in top bar
|
|
658
659
|
autoHide: true, // auto-hide controls when idle
|
|
659
660
|
autoHideDelay: 3000, // hide controls after ... seconds of inactivity (specificed in milliseconds)
|
|
660
661
|
hideCursor: true, // hide mouse cursor when idle
|
|
@@ -1304,10 +1305,6 @@ createPlayerStructure() {
|
|
|
1304
1305
|
this.createControls();
|
|
1305
1306
|
this.createBrandLogo();
|
|
1306
1307
|
this.detectPlaylist();
|
|
1307
|
-
|
|
1308
|
-
if (this.options.showTitleOverlay) {
|
|
1309
|
-
this.createTitleOverlay();
|
|
1310
|
-
}
|
|
1311
1308
|
this.createTopBar();
|
|
1312
1309
|
}
|
|
1313
1310
|
|
|
@@ -1332,37 +1329,6 @@ createLoadingOverlay() {
|
|
|
1332
1329
|
this.loadingOverlay = overlay;
|
|
1333
1330
|
}
|
|
1334
1331
|
|
|
1335
|
-
createTitleOverlay() {
|
|
1336
|
-
const overlay = document.createElement('div');
|
|
1337
|
-
overlay.className = 'title-overlay';
|
|
1338
|
-
overlay.id = 'titleOverlay-' + this.getUniqueId();
|
|
1339
|
-
|
|
1340
|
-
const titleText = document.createElement('h2');
|
|
1341
|
-
titleText.className = 'title-text';
|
|
1342
|
-
titleText.textContent = this.decodeHTMLEntities(this.options.videoTitle) || '';
|
|
1343
|
-
overlay.appendChild(titleText);
|
|
1344
|
-
|
|
1345
|
-
// add subtitles
|
|
1346
|
-
if (this.options.videoSubtitle) {
|
|
1347
|
-
const subtitleText = document.createElement('p');
|
|
1348
|
-
subtitleText.className = 'subtitle-text';
|
|
1349
|
-
subtitleText.textContent = this.decodeHTMLEntities(this.options.videoSubtitle);
|
|
1350
|
-
overlay.appendChild(subtitleText);
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
if (this.controls) {
|
|
1354
|
-
this.container.insertBefore(overlay, this.controls);
|
|
1355
|
-
} else {
|
|
1356
|
-
this.container.appendChild(overlay);
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
this.titleOverlay = overlay;
|
|
1360
|
-
|
|
1361
|
-
if (this.options.persistentTitle && this.options.videoTitle) {
|
|
1362
|
-
this.showTitleOverlay();
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
1332
|
updateTooltips() {
|
|
1367
1333
|
if (!this.controls) return;
|
|
1368
1334
|
|
|
@@ -1405,27 +1371,44 @@ setLanguage(lang) {
|
|
|
1405
1371
|
return false;
|
|
1406
1372
|
}
|
|
1407
1373
|
|
|
1374
|
+
/**
|
|
1375
|
+
* Set video title
|
|
1376
|
+
* @param {string} title - Video title
|
|
1377
|
+
* @returns {Object} this
|
|
1378
|
+
*/
|
|
1408
1379
|
setVideoTitle(title) {
|
|
1409
|
-
this.options.videoTitle = title
|
|
1380
|
+
this.options.videoTitle = title;
|
|
1410
1381
|
|
|
1411
|
-
if (this.
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1382
|
+
if (this.topBarTitle) {
|
|
1383
|
+
this.topBarTitle.textContent = this.decodeHTMLEntities(title);
|
|
1384
|
+
|
|
1385
|
+
// show top bar if title overlay is enabled
|
|
1386
|
+
if (title && this.options.showTitleOverlay) {
|
|
1387
|
+
const titleSection = this.topBar.querySelector('.top-bar-title');
|
|
1388
|
+
if (titleSection) {
|
|
1389
|
+
titleSection.style.display = '';
|
|
1390
|
+
}
|
|
1415
1391
|
}
|
|
1392
|
+
} else if (this.topBar && title) {
|
|
1393
|
+
// create title section
|
|
1394
|
+
const titleSection = this.topBar.querySelector('.top-bar-title');
|
|
1395
|
+
if (!titleSection) {
|
|
1396
|
+
const newTitleSection = document.createElement('div');
|
|
1397
|
+
newTitleSection.className = 'top-bar-title';
|
|
1416
1398
|
|
|
1417
|
-
|
|
1418
|
-
|
|
1399
|
+
const titleElement = document.createElement('h3');
|
|
1400
|
+
titleElement.className = 'video-title';
|
|
1401
|
+
titleElement.textContent = this.decodeHTMLEntities(title);
|
|
1402
|
+
newTitleSection.appendChild(titleElement);
|
|
1419
1403
|
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
}, 3000);
|
|
1425
|
-
}
|
|
1404
|
+
const settingsControl = this.topBar.querySelector('.settings-control');
|
|
1405
|
+
this.topBar.insertBefore(newTitleSection, settingsControl);
|
|
1406
|
+
|
|
1407
|
+
this.topBarTitle = titleElement;
|
|
1426
1408
|
}
|
|
1427
1409
|
}
|
|
1428
1410
|
|
|
1411
|
+
if (this.options.debug) console.log('Video title set:', title);
|
|
1429
1412
|
return this;
|
|
1430
1413
|
}
|
|
1431
1414
|
|
|
@@ -1434,23 +1417,23 @@ getVideoTitle() {
|
|
|
1434
1417
|
}
|
|
1435
1418
|
|
|
1436
1419
|
setVideoSubtitle(subtitle) {
|
|
1437
|
-
this.options.videoSubtitle = subtitle
|
|
1420
|
+
this.options.videoSubtitle = subtitle;
|
|
1438
1421
|
|
|
1439
|
-
if (this.
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
subtitleElement.remove();
|
|
1422
|
+
if (this.topBarSubtitle) {
|
|
1423
|
+
this.topBarSubtitle.textContent = subtitle;
|
|
1424
|
+
} else if (subtitle && this.topBar) {
|
|
1425
|
+
// Create subtitle element
|
|
1426
|
+
const titleSection = this.topBar.querySelector('.top-bar-title');
|
|
1427
|
+
if (titleSection) {
|
|
1428
|
+
const subtitleEl = document.createElement('span');
|
|
1429
|
+
subtitleEl.className = 'video-subtitle';
|
|
1430
|
+
subtitleEl.textContent = subtitle;
|
|
1431
|
+
titleSection.appendChild(subtitleEl);
|
|
1432
|
+
this.topBarSubtitle = subtitleEl;
|
|
1451
1433
|
}
|
|
1452
1434
|
}
|
|
1453
1435
|
|
|
1436
|
+
if (this.options.debug) console.log('Video subtitle set:', subtitle);
|
|
1454
1437
|
return this;
|
|
1455
1438
|
}
|
|
1456
1439
|
|
|
@@ -1458,41 +1441,65 @@ getVideoSubtitle() {
|
|
|
1458
1441
|
return this.options.videoSubtitle;
|
|
1459
1442
|
}
|
|
1460
1443
|
|
|
1444
|
+
/**
|
|
1445
|
+
* Set persistent title (always visible)
|
|
1446
|
+
* @param {boolean} persistent - If true, title stays visible
|
|
1447
|
+
* @returns {Object} this
|
|
1448
|
+
*/
|
|
1461
1449
|
setPersistentTitle(persistent) {
|
|
1462
1450
|
this.options.persistentTitle = persistent;
|
|
1463
1451
|
|
|
1464
|
-
if (this.
|
|
1452
|
+
if (this.topBar) {
|
|
1465
1453
|
if (persistent) {
|
|
1466
|
-
this.
|
|
1467
|
-
this.clearTitleTimeout();
|
|
1454
|
+
this.topBar.classList.add('persistent');
|
|
1468
1455
|
} else {
|
|
1469
|
-
this.
|
|
1470
|
-
if (this.titleOverlay.classList.contains('show')) {
|
|
1471
|
-
this.clearTitleTimeout();
|
|
1472
|
-
this.titleTimeout = setTimeout(() => {
|
|
1473
|
-
this.hideTitleOverlay();
|
|
1474
|
-
}, 3000);
|
|
1475
|
-
}
|
|
1456
|
+
this.topBar.classList.remove('persistent');
|
|
1476
1457
|
}
|
|
1477
1458
|
}
|
|
1478
1459
|
|
|
1479
1460
|
return this;
|
|
1480
1461
|
}
|
|
1481
1462
|
|
|
1463
|
+
/**
|
|
1464
|
+
* Enable title overlay (shows top bar with title)
|
|
1465
|
+
* @returns {Object} this
|
|
1466
|
+
*/
|
|
1482
1467
|
enableTitleOverlay() {
|
|
1483
|
-
if (!this.
|
|
1484
|
-
this.options.
|
|
1485
|
-
this
|
|
1468
|
+
if (!this.topBar) {
|
|
1469
|
+
if (this.options.debug) console.warn('Top bar not available');
|
|
1470
|
+
return this;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
this.options.showTitleOverlay = true;
|
|
1474
|
+
|
|
1475
|
+
// show top bar
|
|
1476
|
+
if (this.options.videoTitle) {
|
|
1477
|
+
const titleSection = this.topBar.querySelector('.top-bar-title');
|
|
1478
|
+
if (titleSection) {
|
|
1479
|
+
titleSection.style.display = '';
|
|
1480
|
+
}
|
|
1486
1481
|
}
|
|
1482
|
+
|
|
1483
|
+
if (this.options.debug) console.log('Title overlay enabled');
|
|
1487
1484
|
return this;
|
|
1488
1485
|
}
|
|
1489
1486
|
|
|
1487
|
+
/**
|
|
1488
|
+
* Disable title overlay (hides top bar)
|
|
1489
|
+
* @returns {Object} this
|
|
1490
|
+
*/
|
|
1490
1491
|
disableTitleOverlay() {
|
|
1491
|
-
if (this.
|
|
1492
|
-
|
|
1493
|
-
this.titleOverlay = null;
|
|
1494
|
-
}
|
|
1492
|
+
if (!this.topBar) return this;
|
|
1493
|
+
|
|
1495
1494
|
this.options.showTitleOverlay = false;
|
|
1495
|
+
|
|
1496
|
+
// hide top bar
|
|
1497
|
+
const titleSection = this.topBar.querySelector('.top-bar-title');
|
|
1498
|
+
if (titleSection) {
|
|
1499
|
+
titleSection.style.display = 'none';
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
if (this.options.debug) console.log('Title overlay disabled');
|
|
1496
1503
|
return this;
|
|
1497
1504
|
}
|
|
1498
1505
|
|
|
@@ -1619,8 +1626,7 @@ setupMenuToggles() {
|
|
|
1619
1626
|
|
|
1620
1627
|
/**
|
|
1621
1628
|
* Create integrated top bar with settings menu
|
|
1622
|
-
*
|
|
1623
|
-
* This does NOT replace the existing title-overlay system
|
|
1629
|
+
* Respects showTitleOverlay, videoTitle, videoSubtitle, persistentTitle options
|
|
1624
1630
|
* @returns {void}
|
|
1625
1631
|
*/
|
|
1626
1632
|
createTopBar() {
|
|
@@ -1629,49 +1635,56 @@ createTopBar() {
|
|
|
1629
1635
|
// Create top bar element
|
|
1630
1636
|
const topBar = document.createElement('div');
|
|
1631
1637
|
topBar.className = 'player-top-bar';
|
|
1632
|
-
topBar.id = `
|
|
1638
|
+
topBar.id = `topBar${this.getUniqueId()}`;
|
|
1633
1639
|
|
|
1634
|
-
//
|
|
1635
|
-
if (this.options.showTitleOverlay
|
|
1636
|
-
|
|
1637
|
-
|
|
1640
|
+
// Apply background class based on showTitleOverlay option
|
|
1641
|
+
if (!this.options.showTitleOverlay) {
|
|
1642
|
+
topBar.classList.add('no-title-background');
|
|
1643
|
+
}
|
|
1638
1644
|
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
titleElement.textContent = this.decodeHTMLEntities(this.options.videoTitle);
|
|
1643
|
-
titleSection.appendChild(titleElement);
|
|
1645
|
+
// Left section - Title (ALWAYS create structure)
|
|
1646
|
+
const titleSection = document.createElement('div');
|
|
1647
|
+
titleSection.className = 'top-bar-title';
|
|
1644
1648
|
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
titleSection.appendChild(subtitleElement);
|
|
1651
|
-
}
|
|
1649
|
+
// Main title
|
|
1650
|
+
const titleElement = document.createElement('h3');
|
|
1651
|
+
titleElement.className = 'video-title';
|
|
1652
|
+
titleElement.textContent = this.options.videoTitle ? this.decodeHTMLEntities(this.options.videoTitle) : '';
|
|
1653
|
+
titleSection.appendChild(titleElement);
|
|
1652
1654
|
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1655
|
+
// Optional subtitle (if present)
|
|
1656
|
+
if (this.options.videoSubtitle) {
|
|
1657
|
+
const subtitleElement = document.createElement('span');
|
|
1658
|
+
subtitleElement.className = 'video-subtitle';
|
|
1659
|
+
subtitleElement.textContent = this.decodeHTMLEntities(this.options.videoSubtitle);
|
|
1660
|
+
titleSection.appendChild(subtitleElement);
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
// Hide title section if showTitleOverlay is false
|
|
1664
|
+
if (!this.options.showTitleOverlay || !this.options.videoTitle) {
|
|
1665
|
+
titleSection.style.display = 'none';
|
|
1659
1666
|
}
|
|
1660
1667
|
|
|
1661
|
-
|
|
1668
|
+
topBar.appendChild(titleSection);
|
|
1669
|
+
|
|
1670
|
+
// spacer element
|
|
1671
|
+
const spacer = document.createElement('div');
|
|
1672
|
+
spacer.className = 'top-bar-spacer';
|
|
1673
|
+
spacer.style.flex = '1';
|
|
1674
|
+
topBar.appendChild(spacer);
|
|
1675
|
+
|
|
1676
|
+
// Right section - Settings control
|
|
1662
1677
|
const settingsControl = document.createElement('div');
|
|
1663
1678
|
settingsControl.className = 'settings-control settings-top-bar';
|
|
1664
1679
|
|
|
1665
1680
|
// Settings button
|
|
1666
1681
|
const settingsBtn = document.createElement('button');
|
|
1667
1682
|
settingsBtn.className = 'control-btn settings-btn';
|
|
1668
|
-
settingsBtn.setAttribute('data-tooltip', '
|
|
1683
|
+
settingsBtn.setAttribute('data-tooltip', 'settingsmenu');
|
|
1669
1684
|
|
|
1670
1685
|
const icon = document.createElement('span');
|
|
1671
1686
|
icon.className = 'icon';
|
|
1672
|
-
icon.innerHTML = `<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"
|
|
1673
|
-
<path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"/>
|
|
1674
|
-
</svg>`;
|
|
1687
|
+
icon.innerHTML = `<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"/></svg>`;
|
|
1675
1688
|
settingsBtn.appendChild(icon);
|
|
1676
1689
|
|
|
1677
1690
|
// Settings menu
|
|
@@ -1680,8 +1693,19 @@ createTopBar() {
|
|
|
1680
1693
|
|
|
1681
1694
|
settingsControl.appendChild(settingsBtn);
|
|
1682
1695
|
settingsControl.appendChild(settingsMenu);
|
|
1696
|
+
|
|
1697
|
+
// hide settings control if showSettingsMenu is false
|
|
1698
|
+
if (this.options.showSettingsMenu === false) {
|
|
1699
|
+
settingsControl.style.display = 'none';
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1683
1702
|
topBar.appendChild(settingsControl);
|
|
1684
1703
|
|
|
1704
|
+
// Add persistent class if persistentTitle is enabled
|
|
1705
|
+
if (this.options.persistentTitle) {
|
|
1706
|
+
topBar.classList.add('persistent');
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1685
1709
|
// Insert top bar as first child in container
|
|
1686
1710
|
this.container.insertBefore(topBar, this.container.firstChild);
|
|
1687
1711
|
|
|
@@ -1691,7 +1715,13 @@ createTopBar() {
|
|
|
1691
1715
|
this.topBarSubtitle = topBar.querySelector('.video-subtitle');
|
|
1692
1716
|
|
|
1693
1717
|
if (this.options.debug) {
|
|
1694
|
-
console.log('
|
|
1718
|
+
console.log('Top bar created with integrated settings', {
|
|
1719
|
+
showTitle: this.options.showTitleOverlay,
|
|
1720
|
+
showSettings: this.options.showSettingsMenu, // ✅ AGGIUNGI nel log
|
|
1721
|
+
persistent: this.options.persistentTitle,
|
|
1722
|
+
opacity: this.options.titleOverlayOpacity,
|
|
1723
|
+
hasBackground: !topBar.classList.contains('no-title-background') // ✅ AGGIUNGI nel log
|
|
1724
|
+
});
|
|
1695
1725
|
}
|
|
1696
1726
|
}
|
|
1697
1727
|
|
|
@@ -3501,10 +3531,8 @@ resetAutoHideTimer() {
|
|
|
3501
3531
|
return;
|
|
3502
3532
|
}
|
|
3503
3533
|
|
|
3504
|
-
//
|
|
3505
|
-
// Don't block if paused due to autoplay blocked (currentTime === 0 and no interaction yet)
|
|
3534
|
+
// Allow timer if video is paused at start (autoplay blocked)
|
|
3506
3535
|
if (this.video && this.video.paused) {
|
|
3507
|
-
// Allow timer if this is initial pause (autoplay blocked scenario)
|
|
3508
3536
|
const isInitialPause = this.video.currentTime === 0 && !this.video.ended;
|
|
3509
3537
|
|
|
3510
3538
|
if (!isInitialPause) {
|
|
@@ -3513,17 +3541,21 @@ resetAutoHideTimer() {
|
|
|
3513
3541
|
}
|
|
3514
3542
|
|
|
3515
3543
|
if (this.autoHideDebug && this.options.debug) {
|
|
3516
|
-
console.log('Video paused but at start - allowing timer (autoplay blocked
|
|
3544
|
+
console.log('Video paused but at start - allowing timer (autoplay blocked)');
|
|
3517
3545
|
}
|
|
3518
3546
|
}
|
|
3519
3547
|
|
|
3520
|
-
// Start timer
|
|
3548
|
+
// Start timer
|
|
3521
3549
|
this.autoHideTimer = setTimeout(() => {
|
|
3522
|
-
if (this.autoHideDebug && this.options.debug)
|
|
3550
|
+
if (this.autoHideDebug && this.options.debug) {
|
|
3551
|
+
console.log(`Timer expired after ${this.options.autoHideDelay}ms - hiding controls`);
|
|
3552
|
+
}
|
|
3523
3553
|
this.hideControlsNow();
|
|
3524
3554
|
}, this.options.autoHideDelay);
|
|
3525
3555
|
|
|
3526
|
-
if (this.autoHideDebug && this.options.debug)
|
|
3556
|
+
if (this.autoHideDebug && this.options.debug) {
|
|
3557
|
+
console.log(`Auto-hide timer started (${this.options.autoHideDelay}ms)`);
|
|
3558
|
+
}
|
|
3527
3559
|
}
|
|
3528
3560
|
|
|
3529
3561
|
showControlsNow() {
|
|
@@ -3617,9 +3649,7 @@ clearControlsTimeout() {
|
|
|
3617
3649
|
|
|
3618
3650
|
// Default controlbar styles injection
|
|
3619
3651
|
injectDefaultControlbarStyles() {
|
|
3620
|
-
if (document.getElementById('default-controlbar-styles'))
|
|
3621
|
-
return;
|
|
3622
|
-
}
|
|
3652
|
+
if (document.getElementById('default-controlbar-styles')) return;
|
|
3623
3653
|
|
|
3624
3654
|
const controlBarOpacity = Math.max(0, Math.min(1, this.options.controlBarOpacity));
|
|
3625
3655
|
const titleOverlayOpacity = Math.max(0, Math.min(1, this.options.titleOverlayOpacity));
|
|
@@ -3641,7 +3671,7 @@ injectDefaultControlbarStyles() {
|
|
|
3641
3671
|
min-height: 60px;
|
|
3642
3672
|
padding-bottom: 10px;
|
|
3643
3673
|
}
|
|
3644
|
-
|
|
3674
|
+
|
|
3645
3675
|
.video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .title-overlay {
|
|
3646
3676
|
background: linear-gradient(
|
|
3647
3677
|
to bottom,
|
|
@@ -3656,8 +3686,12 @@ injectDefaultControlbarStyles() {
|
|
|
3656
3686
|
min-height: 80px;
|
|
3657
3687
|
padding-top: 20px;
|
|
3658
3688
|
}
|
|
3689
|
+
|
|
3690
|
+
/* ✅ NEW: Set CSS custom property for top bar opacity */
|
|
3691
|
+
.video-wrapper {
|
|
3692
|
+
--player-topbar-opacity: ${titleOverlayOpacity};
|
|
3693
|
+
}
|
|
3659
3694
|
`;
|
|
3660
|
-
|
|
3661
3695
|
document.head.appendChild(style);
|
|
3662
3696
|
}
|
|
3663
3697
|
|
|
@@ -4032,7 +4066,7 @@ populateSettingsMenu() {
|
|
|
4032
4066
|
const currentTrack = this.currentSubtitleTrack;
|
|
4033
4067
|
const currentLabel = this.subtitlesEnabled ?
|
|
4034
4068
|
(currentTrack ? currentTrack.label : 'Unknown') :
|
|
4035
|
-
this.t('
|
|
4069
|
+
this.t('subtitlesoff');
|
|
4036
4070
|
|
|
4037
4071
|
menuHTML += `
|
|
4038
4072
|
<div class="settings-expandable-wrapper">
|
|
@@ -4042,7 +4076,7 @@ populateSettingsMenu() {
|
|
|
4042
4076
|
</div>
|
|
4043
4077
|
<div class="settings-expandable-content" style="display: none;">`;
|
|
4044
4078
|
|
|
4045
|
-
menuHTML += `<div class="settings-suboption ${!this.subtitlesEnabled ? 'active' : ''}" data-track="off">${this.t('
|
|
4079
|
+
menuHTML += `<div class="settings-suboption ${!this.subtitlesEnabled ? 'active' : ''}" data-track="off">${this.t('subtitlesoff')}</div>`;
|
|
4046
4080
|
|
|
4047
4081
|
this.textTracks.forEach((trackData, index) => {
|
|
4048
4082
|
const isActive = this.currentSubtitleTrack === trackData.track;
|
|
@@ -4630,7 +4664,74 @@ optimizeButtonsForSmallHeight() {
|
|
|
4630
4664
|
}
|
|
4631
4665
|
}
|
|
4632
4666
|
|
|
4633
|
-
|
|
4667
|
+
/**
|
|
4668
|
+
* Update CSS opacity variables dynamically
|
|
4669
|
+
* @returns {Object} this
|
|
4670
|
+
*/
|
|
4671
|
+
updateOpacityVariables() {
|
|
4672
|
+
if (!this.controls) return this;
|
|
4673
|
+
|
|
4674
|
+
// Update control bar opacity
|
|
4675
|
+
if (this.controls) {
|
|
4676
|
+
this.controls.style.setProperty('--control-bar-opacity', this.options.controlBarOpacity || 0.95);
|
|
4677
|
+
}
|
|
4678
|
+
|
|
4679
|
+
// Update title overlay opacity
|
|
4680
|
+
if (this.topBar) {
|
|
4681
|
+
this.topBar.style.setProperty('--title-overlay-opacity', this.options.titleOverlayOpacity || 0.95);
|
|
4682
|
+
}
|
|
4683
|
+
|
|
4684
|
+
if (this.options.debug) {
|
|
4685
|
+
console.log('Opacity variables updated:', {
|
|
4686
|
+
controlBar: this.options.controlBarOpacity,
|
|
4687
|
+
titleOverlay: this.options.titleOverlayOpacity
|
|
4688
|
+
});
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4691
|
+
return this;
|
|
4692
|
+
}
|
|
4693
|
+
|
|
4694
|
+
/**
|
|
4695
|
+
* Show settings menu button
|
|
4696
|
+
* @returns {Object} this
|
|
4697
|
+
*/
|
|
4698
|
+
showSettingsMenu() {
|
|
4699
|
+
if (!this.topBar) return this;
|
|
4700
|
+
|
|
4701
|
+
const settingsControl = this.topBar.querySelector('.settings-control');
|
|
4702
|
+
if (settingsControl) {
|
|
4703
|
+
settingsControl.style.display = '';
|
|
4704
|
+
this.options.showSettingsMenu = true;
|
|
4705
|
+
|
|
4706
|
+
if (this.options.debug) {
|
|
4707
|
+
console.log('Settings menu enabled');
|
|
4708
|
+
}
|
|
4709
|
+
}
|
|
4710
|
+
|
|
4711
|
+
return this;
|
|
4712
|
+
}
|
|
4713
|
+
|
|
4714
|
+
/**
|
|
4715
|
+
* Hide settings menu button
|
|
4716
|
+
* @returns {Object} this
|
|
4717
|
+
*/
|
|
4718
|
+
hideSettingsMenu() {
|
|
4719
|
+
if (!this.topBar) return this;
|
|
4720
|
+
|
|
4721
|
+
const settingsControl = this.topBar.querySelector('.settings-control');
|
|
4722
|
+
if (settingsControl) {
|
|
4723
|
+
settingsControl.style.display = 'none';
|
|
4724
|
+
this.options.showSettingsMenu = false;
|
|
4725
|
+
|
|
4726
|
+
if (this.options.debug) {
|
|
4727
|
+
console.log('Settings menu disabled');
|
|
4728
|
+
}
|
|
4729
|
+
}
|
|
4730
|
+
|
|
4731
|
+
return this;
|
|
4732
|
+
}
|
|
4733
|
+
|
|
4734
|
+
/* Controls methods for main class */
|
|
4634
4735
|
|
|
4635
4736
|
initializeQualityMonitoring() {
|
|
4636
4737
|
this.qualityMonitorInterval = setInterval(() => {
|
|
@@ -6620,35 +6721,35 @@ bindChapterEvents() {
|
|
|
6620
6721
|
}
|
|
6621
6722
|
|
|
6622
6723
|
/**
|
|
6623
|
-
* Update chapter name in
|
|
6724
|
+
* Update chapter name in top bar subtitle dynamically
|
|
6725
|
+
* Shows current chapter title as subtitle in the top bar
|
|
6624
6726
|
*/
|
|
6625
6727
|
updateChapterInTitleOverlay() {
|
|
6626
6728
|
if (!this.video || !this.chapters || this.chapters.length === 0) return;
|
|
6627
6729
|
|
|
6628
|
-
|
|
6629
|
-
if (!
|
|
6630
|
-
|
|
6631
|
-
// Find or create
|
|
6632
|
-
let
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
`;
|
|
6646
|
-
titleOverlay.appendChild(chapterElement);
|
|
6730
|
+
// Use topBar instead of old titleOverlay
|
|
6731
|
+
if (!this.topBar) return;
|
|
6732
|
+
|
|
6733
|
+
// Find or create subtitle element in top bar
|
|
6734
|
+
let subtitleElement = this.topBar.querySelector('.video-subtitle');
|
|
6735
|
+
|
|
6736
|
+
if (!subtitleElement) {
|
|
6737
|
+
// Create subtitle element if it doesn't exist
|
|
6738
|
+
const titleSection = this.topBar.querySelector('.top-bar-title');
|
|
6739
|
+
if (!titleSection) return;
|
|
6740
|
+
|
|
6741
|
+
subtitleElement = document.createElement('span');
|
|
6742
|
+
subtitleElement.className = 'video-subtitle';
|
|
6743
|
+
titleSection.appendChild(subtitleElement);
|
|
6744
|
+
|
|
6745
|
+
// Save reference
|
|
6746
|
+
this.topBarSubtitle = subtitleElement;
|
|
6647
6747
|
}
|
|
6648
6748
|
|
|
6649
6749
|
// Find current chapter
|
|
6650
6750
|
const currentTime = this.video.currentTime;
|
|
6651
6751
|
let currentChapter = null;
|
|
6752
|
+
|
|
6652
6753
|
for (let i = this.chapters.length - 1; i >= 0; i--) {
|
|
6653
6754
|
if (currentTime >= this.chapters[i].time) {
|
|
6654
6755
|
currentChapter = this.chapters[i];
|
|
@@ -6656,12 +6757,22 @@ updateChapterInTitleOverlay() {
|
|
|
6656
6757
|
}
|
|
6657
6758
|
}
|
|
6658
6759
|
|
|
6659
|
-
// Update or hide chapter
|
|
6760
|
+
// Update subtitle with chapter title or hide if no chapter
|
|
6660
6761
|
if (currentChapter) {
|
|
6661
|
-
|
|
6662
|
-
|
|
6762
|
+
subtitleElement.textContent = currentChapter.title;
|
|
6763
|
+
subtitleElement.style.display = 'block';
|
|
6663
6764
|
} else {
|
|
6664
|
-
|
|
6765
|
+
// Se non c'è un capitolo attivo, mostra il sottotitolo originale o nascondi
|
|
6766
|
+
if (this.options.videoSubtitle) {
|
|
6767
|
+
subtitleElement.textContent = this.options.videoSubtitle;
|
|
6768
|
+
subtitleElement.style.display = 'block';
|
|
6769
|
+
} else {
|
|
6770
|
+
subtitleElement.style.display = 'none';
|
|
6771
|
+
}
|
|
6772
|
+
}
|
|
6773
|
+
|
|
6774
|
+
if (this.options.debug) {
|
|
6775
|
+
console.log('Chapter overlay updated:', currentChapter ? currentChapter.title : 'No chapter');
|
|
6665
6776
|
}
|
|
6666
6777
|
}
|
|
6667
6778
|
|