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.
@@ -610,6 +610,7 @@ constructor(videoElement, options = {}) {
610
610
  showPictureInPicture: true, // Enable PiP button
611
611
  showSubtitles: true, // Enable subtitles button
612
612
  subtitlesEnabled: false, // Enable subtitles by default if available
613
+ showSettingsMenu: true, // Show settings menu in top bar
613
614
  autoHide: true, // auto-hide controls when idle
614
615
  autoHideDelay: 3000, // hide controls after ... seconds of inactivity (specificed in milliseconds)
615
616
  hideCursor: true, // hide mouse cursor when idle
@@ -1218,10 +1219,6 @@ createPlayerStructure() {
1218
1219
  this.createControls();
1219
1220
  this.createBrandLogo();
1220
1221
  this.detectPlaylist();
1221
-
1222
- if (this.options.showTitleOverlay) {
1223
- this.createTitleOverlay();
1224
- }
1225
1222
  this.createTopBar();
1226
1223
  }
1227
1224
 
@@ -1246,36 +1243,6 @@ createLoadingOverlay() {
1246
1243
  this.loadingOverlay = overlay;
1247
1244
  }
1248
1245
 
1249
- createTitleOverlay() {
1250
- const overlay = document.createElement('div');
1251
- overlay.className = 'title-overlay';
1252
- overlay.id = 'titleOverlay-' + this.getUniqueId();
1253
-
1254
- const titleText = document.createElement('h2');
1255
- titleText.className = 'title-text';
1256
- titleText.textContent = this.decodeHTMLEntities(this.options.videoTitle) || '';
1257
- overlay.appendChild(titleText);
1258
-
1259
- if (this.options.videoSubtitle) {
1260
- const subtitleText = document.createElement('p');
1261
- subtitleText.className = 'subtitle-text';
1262
- subtitleText.textContent = this.decodeHTMLEntities(this.options.videoSubtitle);
1263
- overlay.appendChild(subtitleText);
1264
- }
1265
-
1266
- if (this.controls) {
1267
- this.container.insertBefore(overlay, this.controls);
1268
- } else {
1269
- this.container.appendChild(overlay);
1270
- }
1271
-
1272
- this.titleOverlay = overlay;
1273
-
1274
- if (this.options.persistentTitle && this.options.videoTitle) {
1275
- this.showTitleOverlay();
1276
- }
1277
- }
1278
-
1279
1246
  updateTooltips() {
1280
1247
  if (!this.controls) return;
1281
1248
 
@@ -1317,26 +1284,37 @@ setLanguage(lang) {
1317
1284
  }
1318
1285
 
1319
1286
  setVideoTitle(title) {
1320
- this.options.videoTitle = title || '';
1287
+ this.options.videoTitle = title;
1321
1288
 
1322
- if (this.titleOverlay) {
1323
- const titleElement = this.titleOverlay.querySelector('.title-text');
1324
- if (titleElement) {
1325
- titleElement.textContent = this.decodeHTMLEntities(this.options.videoTitle);
1289
+ if (this.topBarTitle) {
1290
+ this.topBarTitle.textContent = this.decodeHTMLEntities(title);
1291
+
1292
+ if (title && this.options.showTitleOverlay) {
1293
+ const titleSection = this.topBar.querySelector('.top-bar-title');
1294
+ if (titleSection) {
1295
+ titleSection.style.display = '';
1296
+ }
1326
1297
  }
1298
+ } else if (this.topBar && title) {
1327
1299
 
1328
- if (title) {
1329
- this.showTitleOverlay();
1300
+ const titleSection = this.topBar.querySelector('.top-bar-title');
1301
+ if (!titleSection) {
1302
+ const newTitleSection = document.createElement('div');
1303
+ newTitleSection.className = 'top-bar-title';
1330
1304
 
1331
- if (!this.options.persistentTitle) {
1332
- this.clearTitleTimeout();
1333
- this.titleTimeout = setTimeout(() => {
1334
- this.hideTitleOverlay();
1335
- }, 3000);
1336
- }
1305
+ const titleElement = document.createElement('h3');
1306
+ titleElement.className = 'video-title';
1307
+ titleElement.textContent = this.decodeHTMLEntities(title);
1308
+ newTitleSection.appendChild(titleElement);
1309
+
1310
+ const settingsControl = this.topBar.querySelector('.settings-control');
1311
+ this.topBar.insertBefore(newTitleSection, settingsControl);
1312
+
1313
+ this.topBarTitle = titleElement;
1337
1314
  }
1338
1315
  }
1339
1316
 
1317
+ if (this.options.debug) console.log('Video title set:', title);
1340
1318
  return this;
1341
1319
  }
1342
1320
 
@@ -1345,23 +1323,23 @@ getVideoTitle() {
1345
1323
  }
1346
1324
 
1347
1325
  setVideoSubtitle(subtitle) {
1348
- this.options.videoSubtitle = subtitle || '';
1326
+ this.options.videoSubtitle = subtitle;
1349
1327
 
1350
- if (this.titleOverlay) {
1351
- let subtitleElement = this.titleOverlay.querySelector('.subtitle-text');
1328
+ if (this.topBarSubtitle) {
1329
+ this.topBarSubtitle.textContent = subtitle;
1330
+ } else if (subtitle && this.topBar) {
1352
1331
 
1353
- if (subtitle) {
1354
- if (!subtitleElement) {
1355
- subtitleElement = document.createElement('p');
1356
- subtitleElement.className = 'subtitle-text';
1357
- this.titleOverlay.appendChild(subtitleElement);
1358
- }
1359
- subtitleElement.textContent = subtitle;
1360
- } else if (subtitleElement) {
1361
- subtitleElement.remove();
1332
+ const titleSection = this.topBar.querySelector('.top-bar-title');
1333
+ if (titleSection) {
1334
+ const subtitleEl = document.createElement('span');
1335
+ subtitleEl.className = 'video-subtitle';
1336
+ subtitleEl.textContent = subtitle;
1337
+ titleSection.appendChild(subtitleEl);
1338
+ this.topBarSubtitle = subtitleEl;
1362
1339
  }
1363
1340
  }
1364
1341
 
1342
+ if (this.options.debug) console.log('Video subtitle set:', subtitle);
1365
1343
  return this;
1366
1344
  }
1367
1345
 
@@ -1372,18 +1350,11 @@ getVideoSubtitle() {
1372
1350
  setPersistentTitle(persistent) {
1373
1351
  this.options.persistentTitle = persistent;
1374
1352
 
1375
- if (this.titleOverlay && this.options.videoTitle) {
1353
+ if (this.topBar) {
1376
1354
  if (persistent) {
1377
- this.showTitleOverlay();
1378
- this.clearTitleTimeout();
1355
+ this.topBar.classList.add('persistent');
1379
1356
  } else {
1380
- this.titleOverlay.classList.remove('persistent');
1381
- if (this.titleOverlay.classList.contains('show')) {
1382
- this.clearTitleTimeout();
1383
- this.titleTimeout = setTimeout(() => {
1384
- this.hideTitleOverlay();
1385
- }, 3000);
1386
- }
1357
+ this.topBar.classList.remove('persistent');
1387
1358
  }
1388
1359
  }
1389
1360
 
@@ -1391,19 +1362,35 @@ setPersistentTitle(persistent) {
1391
1362
  }
1392
1363
 
1393
1364
  enableTitleOverlay() {
1394
- if (!this.titleOverlay && !this.options.showTitleOverlay) {
1365
+ if (!this.topBar) {
1366
+ if (this.options.debug) console.warn('Top bar not available');
1367
+ return this;
1368
+ }
1369
+
1395
1370
  this.options.showTitleOverlay = true;
1396
- this.createTitleOverlay();
1371
+
1372
+ if (this.options.videoTitle) {
1373
+ const titleSection = this.topBar.querySelector('.top-bar-title');
1374
+ if (titleSection) {
1375
+ titleSection.style.display = '';
1376
+ }
1397
1377
  }
1378
+
1379
+ if (this.options.debug) console.log('Title overlay enabled');
1398
1380
  return this;
1399
1381
  }
1400
1382
 
1401
1383
  disableTitleOverlay() {
1402
- if (this.titleOverlay) {
1403
- this.titleOverlay.remove();
1404
- this.titleOverlay = null;
1405
- }
1384
+ if (!this.topBar) return this;
1385
+
1406
1386
  this.options.showTitleOverlay = false;
1387
+
1388
+ const titleSection = this.topBar.querySelector('.top-bar-title');
1389
+ if (titleSection) {
1390
+ titleSection.style.display = 'none';
1391
+ }
1392
+
1393
+ if (this.options.debug) console.log('Title overlay disabled');
1407
1394
  return this;
1408
1395
  }
1409
1396
 
@@ -1530,15 +1517,18 @@ createTopBar() {
1530
1517
 
1531
1518
  const topBar = document.createElement('div');
1532
1519
  topBar.className = 'player-top-bar';
1533
- topBar.id = `topBar_${this.getUniqueId()}`;
1520
+ topBar.id = `topBar${this.getUniqueId()}`;
1521
+
1522
+ if (!this.options.showTitleOverlay) {
1523
+ topBar.classList.add('no-title-background');
1524
+ }
1534
1525
 
1535
- if (this.options.showTitleOverlay && this.options.videoTitle) {
1536
1526
  const titleSection = document.createElement('div');
1537
1527
  titleSection.className = 'top-bar-title';
1538
1528
 
1539
1529
  const titleElement = document.createElement('h3');
1540
1530
  titleElement.className = 'video-title';
1541
- titleElement.textContent = this.decodeHTMLEntities(this.options.videoTitle);
1531
+ titleElement.textContent = this.options.videoTitle ? this.decodeHTMLEntities(this.options.videoTitle) : '';
1542
1532
  titleSection.appendChild(titleElement);
1543
1533
 
1544
1534
  if (this.options.videoSubtitle) {
@@ -1548,26 +1538,27 @@ createTopBar() {
1548
1538
  titleSection.appendChild(subtitleElement);
1549
1539
  }
1550
1540
 
1541
+ if (!this.options.showTitleOverlay || !this.options.videoTitle) {
1542
+ titleSection.style.display = 'none';
1543
+ }
1544
+
1551
1545
  topBar.appendChild(titleSection);
1552
- } else {
1553
1546
 
1554
1547
  const spacer = document.createElement('div');
1555
1548
  spacer.className = 'top-bar-spacer';
1549
+ spacer.style.flex = '1';
1556
1550
  topBar.appendChild(spacer);
1557
- }
1558
1551
 
1559
1552
  const settingsControl = document.createElement('div');
1560
1553
  settingsControl.className = 'settings-control settings-top-bar';
1561
1554
 
1562
1555
  const settingsBtn = document.createElement('button');
1563
1556
  settingsBtn.className = 'control-btn settings-btn';
1564
- settingsBtn.setAttribute('data-tooltip', 'settings_menu'); // ✅ Correct: underscore
1557
+ settingsBtn.setAttribute('data-tooltip', 'settingsmenu');
1565
1558
 
1566
1559
  const icon = document.createElement('span');
1567
1560
  icon.className = 'icon';
1568
- icon.innerHTML = `<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor">
1569
- <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"/>
1570
- </svg>`;
1561
+ 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>`;
1571
1562
  settingsBtn.appendChild(icon);
1572
1563
 
1573
1564
  const settingsMenu = document.createElement('div');
@@ -1575,8 +1566,17 @@ createTopBar() {
1575
1566
 
1576
1567
  settingsControl.appendChild(settingsBtn);
1577
1568
  settingsControl.appendChild(settingsMenu);
1569
+
1570
+ if (this.options.showSettingsMenu === false) {
1571
+ settingsControl.style.display = 'none';
1572
+ }
1573
+
1578
1574
  topBar.appendChild(settingsControl);
1579
1575
 
1576
+ if (this.options.persistentTitle) {
1577
+ topBar.classList.add('persistent');
1578
+ }
1579
+
1580
1580
  this.container.insertBefore(topBar, this.container.firstChild);
1581
1581
 
1582
1582
  this.topBar = topBar;
@@ -1584,7 +1584,13 @@ createTopBar() {
1584
1584
  this.topBarSubtitle = topBar.querySelector('.video-subtitle');
1585
1585
 
1586
1586
  if (this.options.debug) {
1587
- console.log('Top bar created with integrated settings');
1587
+ console.log('Top bar created with integrated settings', {
1588
+ showTitle: this.options.showTitleOverlay,
1589
+ showSettings: this.options.showSettingsMenu, // ✅ AGGIUNGI nel log
1590
+ persistent: this.options.persistentTitle,
1591
+ opacity: this.options.titleOverlayOpacity,
1592
+ hasBackground: !topBar.classList.contains('no-title-background') // ✅ AGGIUNGI nel log
1593
+ });
1588
1594
  }
1589
1595
  }
1590
1596
 
@@ -3180,7 +3186,6 @@ resetAutoHideTimer() {
3180
3186
  }
3181
3187
 
3182
3188
  if (this.video && this.video.paused) {
3183
-
3184
3189
  const isInitialPause = this.video.currentTime === 0 && !this.video.ended;
3185
3190
 
3186
3191
  if (!isInitialPause) {
@@ -3189,16 +3194,20 @@ resetAutoHideTimer() {
3189
3194
  }
3190
3195
 
3191
3196
  if (this.autoHideDebug && this.options.debug) {
3192
- console.log('Video paused but at start - allowing timer (autoplay blocked scenario)');
3197
+ console.log('Video paused but at start - allowing timer (autoplay blocked)');
3193
3198
  }
3194
3199
  }
3195
3200
 
3196
3201
  this.autoHideTimer = setTimeout(() => {
3197
- if (this.autoHideDebug && this.options.debug) console.log(`Timer expired after ${this.options.autoHideDelay}ms - hiding controls`);
3202
+ if (this.autoHideDebug && this.options.debug) {
3203
+ console.log(`Timer expired after ${this.options.autoHideDelay}ms - hiding controls`);
3204
+ }
3198
3205
  this.hideControlsNow();
3199
3206
  }, this.options.autoHideDelay);
3200
3207
 
3201
- if (this.autoHideDebug && this.options.debug) console.log(`Auto-hide timer started (${this.options.autoHideDelay}ms)`);
3208
+ if (this.autoHideDebug && this.options.debug) {
3209
+ console.log(`Auto-hide timer started (${this.options.autoHideDelay}ms)`);
3210
+ }
3202
3211
  }
3203
3212
 
3204
3213
  showControlsNow() {
@@ -3282,9 +3291,7 @@ clearControlsTimeout() {
3282
3291
  }
3283
3292
 
3284
3293
  injectDefaultControlbarStyles() {
3285
- if (document.getElementById('default-controlbar-styles')) {
3286
- return;
3287
- }
3294
+ if (document.getElementById('default-controlbar-styles')) return;
3288
3295
 
3289
3296
  const controlBarOpacity = Math.max(0, Math.min(1, this.options.controlBarOpacity));
3290
3297
  const titleOverlayOpacity = Math.max(0, Math.min(1, this.options.titleOverlayOpacity));
@@ -3306,7 +3313,7 @@ injectDefaultControlbarStyles() {
3306
3313
  min-height: 60px;
3307
3314
  padding-bottom: 10px;
3308
3315
  }
3309
-
3316
+
3310
3317
  .video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .title-overlay {
3311
3318
  background: linear-gradient(
3312
3319
  to bottom,
@@ -3321,8 +3328,11 @@ injectDefaultControlbarStyles() {
3321
3328
  min-height: 80px;
3322
3329
  padding-top: 20px;
3323
3330
  }
3324
- `;
3325
3331
 
3332
+ .video-wrapper {
3333
+ --player-topbar-opacity: ${titleOverlayOpacity};
3334
+ }
3335
+ `;
3326
3336
  document.head.appendChild(style);
3327
3337
  }
3328
3338
 
@@ -3674,7 +3684,7 @@ populateSettingsMenu() {
3674
3684
  const currentTrack = this.currentSubtitleTrack;
3675
3685
  const currentLabel = this.subtitlesEnabled ?
3676
3686
  (currentTrack ? currentTrack.label : 'Unknown') :
3677
- this.t('subtitles_off'); //
3687
+ this.t('subtitlesoff');
3678
3688
 
3679
3689
  menuHTML += `
3680
3690
  <div class="settings-expandable-wrapper">
@@ -3684,7 +3694,7 @@ populateSettingsMenu() {
3684
3694
  </div>
3685
3695
  <div class="settings-expandable-content" style="display: none;">`;
3686
3696
 
3687
- menuHTML += `<div class="settings-suboption ${!this.subtitlesEnabled ? 'active' : ''}" data-track="off">${this.t('subtitles_off')}</div>`;
3697
+ menuHTML += `<div class="settings-suboption ${!this.subtitlesEnabled ? 'active' : ''}" data-track="off">${this.t('subtitlesoff')}</div>`;
3688
3698
 
3689
3699
  this.textTracks.forEach((trackData, index) => {
3690
3700
  const isActive = this.currentSubtitleTrack === trackData.track;
@@ -4213,6 +4223,59 @@ optimizeButtonsForSmallHeight() {
4213
4223
  }
4214
4224
  }
4215
4225
 
4226
+ updateOpacityVariables() {
4227
+ if (!this.controls) return this;
4228
+
4229
+ if (this.controls) {
4230
+ this.controls.style.setProperty('--control-bar-opacity', this.options.controlBarOpacity || 0.95);
4231
+ }
4232
+
4233
+ if (this.topBar) {
4234
+ this.topBar.style.setProperty('--title-overlay-opacity', this.options.titleOverlayOpacity || 0.95);
4235
+ }
4236
+
4237
+ if (this.options.debug) {
4238
+ console.log('Opacity variables updated:', {
4239
+ controlBar: this.options.controlBarOpacity,
4240
+ titleOverlay: this.options.titleOverlayOpacity
4241
+ });
4242
+ }
4243
+
4244
+ return this;
4245
+ }
4246
+
4247
+ showSettingsMenu() {
4248
+ if (!this.topBar) return this;
4249
+
4250
+ const settingsControl = this.topBar.querySelector('.settings-control');
4251
+ if (settingsControl) {
4252
+ settingsControl.style.display = '';
4253
+ this.options.showSettingsMenu = true;
4254
+
4255
+ if (this.options.debug) {
4256
+ console.log('Settings menu enabled');
4257
+ }
4258
+ }
4259
+
4260
+ return this;
4261
+ }
4262
+
4263
+ hideSettingsMenu() {
4264
+ if (!this.topBar) return this;
4265
+
4266
+ const settingsControl = this.topBar.querySelector('.settings-control');
4267
+ if (settingsControl) {
4268
+ settingsControl.style.display = 'none';
4269
+ this.options.showSettingsMenu = false;
4270
+
4271
+ if (this.options.debug) {
4272
+ console.log('Settings menu disabled');
4273
+ }
4274
+ }
4275
+
4276
+ return this;
4277
+ }
4278
+
4216
4279
  initializeQualityMonitoring() {
4217
4280
  this.qualityMonitorInterval = setInterval(() => {
4218
4281
  if (!this.isChangingQuality) {
@@ -6024,28 +6087,22 @@ bindChapterEvents() {
6024
6087
  }
6025
6088
 
6026
6089
  updateChapterInTitleOverlay() {
6027
- if (!this.video || !this.chapters || this.chapters.length === 0) return;
6090
+ if (!this.video || !this.chapters || this.chapters.length === 0) return;
6091
+ if (!this.topBar) return;
6092
+ let subtitleElement = this.topBar.querySelector('.video-subtitle');
6028
6093
 
6029
- const titleOverlay = this.container ? this.container.querySelector('.title-overlay') : null;
6030
- if (!titleOverlay) return;
6031
- let chapterElement = titleOverlay.querySelector('.chapter-name');
6032
- if (!chapterElement) {
6033
- chapterElement = document.createElement('div');
6034
- chapterElement.className = 'chapter-name';
6035
- chapterElement.style.cssText = `
6036
- font-size: 13px;
6037
- font-weight: 500;
6038
- color: rgba(255, 255, 255, 0.9);
6039
- margin-top: 6px;
6040
- max-width: 400px;
6041
- overflow: hidden;
6042
- text-overflow: ellipsis;
6043
- white-space: nowrap;
6044
- `;
6045
- titleOverlay.appendChild(chapterElement);
6094
+ if (!subtitleElement) {
6095
+ const titleSection = this.topBar.querySelector('.top-bar-title');
6096
+ if (!titleSection) return;
6097
+
6098
+ subtitleElement = document.createElement('span');
6099
+ subtitleElement.className = 'video-subtitle';
6100
+ titleSection.appendChild(subtitleElement);
6101
+ this.topBarSubtitle = subtitleElement;
6046
6102
  }
6047
6103
  const currentTime = this.video.currentTime;
6048
6104
  let currentChapter = null;
6105
+
6049
6106
  for (let i = this.chapters.length - 1; i >= 0; i--) {
6050
6107
  if (currentTime >= this.chapters[i].time) {
6051
6108
  currentChapter = this.chapters[i];
@@ -6053,10 +6110,19 @@ updateChapterInTitleOverlay() {
6053
6110
  }
6054
6111
  }
6055
6112
  if (currentChapter) {
6056
- chapterElement.textContent = currentChapter.title;
6057
- chapterElement.style.display = 'block';
6113
+ subtitleElement.textContent = currentChapter.title;
6114
+ subtitleElement.style.display = 'block';
6115
+ } else {
6116
+ if (this.options.videoSubtitle) {
6117
+ subtitleElement.textContent = this.options.videoSubtitle;
6118
+ subtitleElement.style.display = 'block';
6058
6119
  } else {
6059
- chapterElement.style.display = 'none';
6120
+ subtitleElement.style.display = 'none';
6121
+ }
6122
+ }
6123
+
6124
+ if (this.options.debug) {
6125
+ console.log('Chapter overlay updated:', currentChapter ? currentChapter.title : 'No chapter');
6060
6126
  }
6061
6127
  }
6062
6128
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myetv-player",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "MYETV Video Player - Modular HTML5 video player with plugin support for YouTube, Vimeo, Twitch, Facebook, Cloudflare Stream and streaming protocols (HLS/DASH)",
5
5
  "main": "dist/myetv-player.js",
6
6
  "files": [
@@ -64,3 +64,5 @@
64
64
 
65
65
 
66
66
 
67
+
68
+
@@ -372,23 +372,29 @@
372
372
  subtitlesBtn.style.display = 'none';
373
373
  }
374
374
 
375
- // Hide original speed menu option from settings (if exists)
376
- if (settingsMenu) {
377
- // Hide old non-expandable speed option
378
- const originalSpeedOption = settingsMenu.querySelector('[data-action="speed"]');
379
- if (originalSpeedOption) {
380
- originalSpeedOption.style.display = 'none';
381
- }
382
-
383
- // Hide new expandable speed option
384
- const expandableSpeedWrapper = settingsMenu.querySelector('[data-action="speed-expand"]');
385
- if (expandableSpeedWrapper) {
386
- const wrapper = expandableSpeedWrapper.closest('.settings-expandable-wrapper');
375
+ // Remove ONLY the original player speed (not YouTube speed)
376
+ if (settingsMenu) {
377
+ // Find and remove ONLY options with data-action="speed" or "speed-expand"
378
+ // that are NOT inside .yt-speed-wrapper
379
+ const speedOptions = settingsMenu.querySelectorAll('[data-action="speed"], [data-action="speed_expand"]');
380
+
381
+ speedOptions.forEach(option => {
382
+ // Check if this option is NOT inside YouTube speed wrapper
383
+ if (!option.closest('.yt-speed-wrapper')) {
384
+ // It's the original player speed - remove it
385
+ const wrapper = option.closest('.settings-expandable-wrapper');
387
386
  if (wrapper) {
388
- wrapper.style.display = 'none';
387
+ wrapper.remove(); // Remove the whole wrapper
388
+ } else {
389
+ option.remove(); // Remove just the option
390
+ }
391
+
392
+ if (this.api.player.options.debug) {
393
+ console.log('YT Plugin: Removed original player speed option');
389
394
  }
390
395
  }
391
- }
396
+ });
397
+ }
392
398
 
393
399
  // Add subtitles option to settings menu
394
400
  if (settingsMenu) {
@@ -4681,42 +4687,36 @@
4681
4687
  }
4682
4688
 
4683
4689
  /**
4684
- * Initialize chapter display in title overlay
4685
- */
4690
+ * Initialize chapter display in top bar subtitle (instead of title overlay)
4691
+ */
4686
4692
  initChapterDisplayInOverlay() {
4687
4693
  if (!this.chapters || this.chapters.length === 0) return;
4688
4694
 
4689
- const titleOverlay = this.api.container.querySelector('.title-overlay');
4690
- if (!titleOverlay) return;
4691
-
4692
- // Remove existing chapter element if present
4693
- let chapterElement = titleOverlay.querySelector('.chapter-name');
4694
- if (chapterElement) {
4695
- chapterElement.remove();
4696
- }
4697
-
4698
- // Create chapter name element
4699
- chapterElement = document.createElement('div');
4700
- chapterElement.className = 'chapter-name';
4701
- chapterElement.style.cssText = `
4702
- font-size: 13px;
4703
- font-weight: 500;
4704
- color: rgba(255, 255, 255, 0.9);
4705
- margin-top: 6px;
4706
- max-width: 400px;
4707
- overflow: hidden;
4708
- text-overflow: ellipsis;
4709
- white-space: nowrap;
4710
- `;
4695
+ // Use topBar instead of old title-overlay
4696
+ const topBar = this.api.container.querySelector('.player-top-bar');
4697
+ if (!topBar) return;
4698
+
4699
+ // Find or create subtitle element in top bar
4700
+ let subtitleElement = topBar.querySelector('.video-subtitle');
4701
+
4702
+ if (!subtitleElement) {
4703
+ // Create subtitle element if it doesn't exist
4704
+ const titleSection = topBar.querySelector('.top-bar-title');
4705
+ if (!titleSection) return;
4711
4706
 
4712
- // Append to title overlay
4713
- titleOverlay.appendChild(chapterElement);
4707
+ subtitleElement = document.createElement('span');
4708
+ subtitleElement.className = 'video-subtitle chapter-name';
4709
+ titleSection.appendChild(subtitleElement);
4710
+ } else {
4711
+ // Add chapter-name class to existing subtitle
4712
+ subtitleElement.classList.add('chapter-name');
4713
+ }
4714
4714
 
4715
4715
  // Start monitoring playback to update chapter name
4716
4716
  this.startChapterNameMonitoring();
4717
4717
 
4718
4718
  if (this.api.player.options.debug) {
4719
- console.log('YT Plugin: Chapter name display initialized in title overlay');
4719
+ console.log('YT Plugin: Chapter name display initialized in top bar');
4720
4720
  }
4721
4721
  }
4722
4722
 
@@ -4746,10 +4746,11 @@
4746
4746
  }
4747
4747
 
4748
4748
  /**
4749
- * Update chapter name in overlay based on current time
4750
- */
4749
+ * Update chapter name in top bar subtitle based on current time
4750
+ */
4751
4751
  updateChapterNameDisplay(currentTime) {
4752
- const chapterElement = this.api.container.querySelector('.title-overlay .chapter-name');
4752
+ // Use topBar instead of title-overlay
4753
+ const chapterElement = this.api.container.querySelector('.player-top-bar .video-subtitle.chapter-name');
4753
4754
  if (!chapterElement) return;
4754
4755
 
4755
4756
  // Find current chapter
@@ -4766,7 +4767,13 @@
4766
4767
  chapterElement.textContent = currentChapter.title;
4767
4768
  chapterElement.style.display = 'block';
4768
4769
  } else {
4769
- chapterElement.style.display = 'none';
4770
+ // Show original subtitle if no chapter active
4771
+ if (this.api.player.options.videoSubtitle) {
4772
+ chapterElement.textContent = this.api.player.options.videoSubtitle;
4773
+ chapterElement.style.display = 'block';
4774
+ } else {
4775
+ chapterElement.style.display = 'none';
4776
+ }
4770
4777
  }
4771
4778
  }
4772
4779