myetv-player 1.6.3 → 1.6.4

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.
@@ -1218,10 +1218,6 @@ createPlayerStructure() {
1218
1218
  this.createControls();
1219
1219
  this.createBrandLogo();
1220
1220
  this.detectPlaylist();
1221
-
1222
- if (this.options.showTitleOverlay) {
1223
- this.createTitleOverlay();
1224
- }
1225
1221
  this.createTopBar();
1226
1222
  }
1227
1223
 
@@ -1246,36 +1242,6 @@ createLoadingOverlay() {
1246
1242
  this.loadingOverlay = overlay;
1247
1243
  }
1248
1244
 
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
1245
  updateTooltips() {
1280
1246
  if (!this.controls) return;
1281
1247
 
@@ -1317,26 +1283,37 @@ setLanguage(lang) {
1317
1283
  }
1318
1284
 
1319
1285
  setVideoTitle(title) {
1320
- this.options.videoTitle = title || '';
1286
+ this.options.videoTitle = title;
1321
1287
 
1322
- if (this.titleOverlay) {
1323
- const titleElement = this.titleOverlay.querySelector('.title-text');
1324
- if (titleElement) {
1325
- titleElement.textContent = this.decodeHTMLEntities(this.options.videoTitle);
1288
+ if (this.topBarTitle) {
1289
+ this.topBarTitle.textContent = this.decodeHTMLEntities(title);
1290
+
1291
+ if (title && this.options.showTitleOverlay) {
1292
+ const titleSection = this.topBar.querySelector('.top-bar-title');
1293
+ if (titleSection) {
1294
+ titleSection.style.display = '';
1295
+ }
1326
1296
  }
1297
+ } else if (this.topBar && title) {
1327
1298
 
1328
- if (title) {
1329
- this.showTitleOverlay();
1299
+ const titleSection = this.topBar.querySelector('.top-bar-title');
1300
+ if (!titleSection) {
1301
+ const newTitleSection = document.createElement('div');
1302
+ newTitleSection.className = 'top-bar-title';
1330
1303
 
1331
- if (!this.options.persistentTitle) {
1332
- this.clearTitleTimeout();
1333
- this.titleTimeout = setTimeout(() => {
1334
- this.hideTitleOverlay();
1335
- }, 3000);
1336
- }
1304
+ const titleElement = document.createElement('h3');
1305
+ titleElement.className = 'video-title';
1306
+ titleElement.textContent = this.decodeHTMLEntities(title);
1307
+ newTitleSection.appendChild(titleElement);
1308
+
1309
+ const settingsControl = this.topBar.querySelector('.settings-control');
1310
+ this.topBar.insertBefore(newTitleSection, settingsControl);
1311
+
1312
+ this.topBarTitle = titleElement;
1337
1313
  }
1338
1314
  }
1339
1315
 
1316
+ if (this.options.debug) console.log('Video title set:', title);
1340
1317
  return this;
1341
1318
  }
1342
1319
 
@@ -1345,23 +1322,23 @@ getVideoTitle() {
1345
1322
  }
1346
1323
 
1347
1324
  setVideoSubtitle(subtitle) {
1348
- this.options.videoSubtitle = subtitle || '';
1325
+ this.options.videoSubtitle = subtitle;
1349
1326
 
1350
- if (this.titleOverlay) {
1351
- let subtitleElement = this.titleOverlay.querySelector('.subtitle-text');
1327
+ if (this.topBarSubtitle) {
1328
+ this.topBarSubtitle.textContent = subtitle;
1329
+ } else if (subtitle && this.topBar) {
1352
1330
 
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();
1331
+ const titleSection = this.topBar.querySelector('.top-bar-title');
1332
+ if (titleSection) {
1333
+ const subtitleEl = document.createElement('span');
1334
+ subtitleEl.className = 'video-subtitle';
1335
+ subtitleEl.textContent = subtitle;
1336
+ titleSection.appendChild(subtitleEl);
1337
+ this.topBarSubtitle = subtitleEl;
1362
1338
  }
1363
1339
  }
1364
1340
 
1341
+ if (this.options.debug) console.log('Video subtitle set:', subtitle);
1365
1342
  return this;
1366
1343
  }
1367
1344
 
@@ -1372,18 +1349,11 @@ getVideoSubtitle() {
1372
1349
  setPersistentTitle(persistent) {
1373
1350
  this.options.persistentTitle = persistent;
1374
1351
 
1375
- if (this.titleOverlay && this.options.videoTitle) {
1352
+ if (this.topBar) {
1376
1353
  if (persistent) {
1377
- this.showTitleOverlay();
1378
- this.clearTitleTimeout();
1354
+ this.topBar.classList.add('persistent');
1379
1355
  } 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
- }
1356
+ this.topBar.classList.remove('persistent');
1387
1357
  }
1388
1358
  }
1389
1359
 
@@ -1391,19 +1361,35 @@ setPersistentTitle(persistent) {
1391
1361
  }
1392
1362
 
1393
1363
  enableTitleOverlay() {
1394
- if (!this.titleOverlay && !this.options.showTitleOverlay) {
1364
+ if (!this.topBar) {
1365
+ if (this.options.debug) console.warn('Top bar not available');
1366
+ return this;
1367
+ }
1368
+
1395
1369
  this.options.showTitleOverlay = true;
1396
- this.createTitleOverlay();
1370
+
1371
+ if (this.options.videoTitle) {
1372
+ const titleSection = this.topBar.querySelector('.top-bar-title');
1373
+ if (titleSection) {
1374
+ titleSection.style.display = '';
1375
+ }
1397
1376
  }
1377
+
1378
+ if (this.options.debug) console.log('Title overlay enabled');
1398
1379
  return this;
1399
1380
  }
1400
1381
 
1401
1382
  disableTitleOverlay() {
1402
- if (this.titleOverlay) {
1403
- this.titleOverlay.remove();
1404
- this.titleOverlay = null;
1405
- }
1383
+ if (!this.topBar) return this;
1384
+
1406
1385
  this.options.showTitleOverlay = false;
1386
+
1387
+ const titleSection = this.topBar.querySelector('.top-bar-title');
1388
+ if (titleSection) {
1389
+ titleSection.style.display = 'none';
1390
+ }
1391
+
1392
+ if (this.options.debug) console.log('Title overlay disabled');
1407
1393
  return this;
1408
1394
  }
1409
1395
 
@@ -1530,15 +1516,14 @@ createTopBar() {
1530
1516
 
1531
1517
  const topBar = document.createElement('div');
1532
1518
  topBar.className = 'player-top-bar';
1533
- topBar.id = `topBar_${this.getUniqueId()}`;
1519
+ topBar.id = `topBar${this.getUniqueId()}`;
1534
1520
 
1535
- if (this.options.showTitleOverlay && this.options.videoTitle) {
1536
1521
  const titleSection = document.createElement('div');
1537
1522
  titleSection.className = 'top-bar-title';
1538
1523
 
1539
1524
  const titleElement = document.createElement('h3');
1540
1525
  titleElement.className = 'video-title';
1541
- titleElement.textContent = this.decodeHTMLEntities(this.options.videoTitle);
1526
+ titleElement.textContent = this.options.videoTitle ? this.decodeHTMLEntities(this.options.videoTitle) : '';
1542
1527
  titleSection.appendChild(titleElement);
1543
1528
 
1544
1529
  if (this.options.videoSubtitle) {
@@ -1548,26 +1533,22 @@ createTopBar() {
1548
1533
  titleSection.appendChild(subtitleElement);
1549
1534
  }
1550
1535
 
1551
- topBar.appendChild(titleSection);
1552
- } else {
1553
-
1554
- const spacer = document.createElement('div');
1555
- spacer.className = 'top-bar-spacer';
1556
- topBar.appendChild(spacer);
1536
+ if (!this.options.showTitleOverlay || !this.options.videoTitle) {
1537
+ titleSection.style.display = 'none';
1557
1538
  }
1558
1539
 
1540
+ topBar.appendChild(titleSection);
1541
+
1559
1542
  const settingsControl = document.createElement('div');
1560
1543
  settingsControl.className = 'settings-control settings-top-bar';
1561
1544
 
1562
1545
  const settingsBtn = document.createElement('button');
1563
1546
  settingsBtn.className = 'control-btn settings-btn';
1564
- settingsBtn.setAttribute('data-tooltip', 'settings_menu'); // ✅ Correct: underscore
1547
+ settingsBtn.setAttribute('data-tooltip', 'settingsmenu');
1565
1548
 
1566
1549
  const icon = document.createElement('span');
1567
1550
  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>`;
1551
+ 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
1552
  settingsBtn.appendChild(icon);
1572
1553
 
1573
1554
  const settingsMenu = document.createElement('div');
@@ -1577,6 +1558,10 @@ createTopBar() {
1577
1558
  settingsControl.appendChild(settingsMenu);
1578
1559
  topBar.appendChild(settingsControl);
1579
1560
 
1561
+ if (this.options.persistentTitle) {
1562
+ topBar.classList.add('persistent');
1563
+ }
1564
+
1580
1565
  this.container.insertBefore(topBar, this.container.firstChild);
1581
1566
 
1582
1567
  this.topBar = topBar;
@@ -1584,7 +1569,11 @@ createTopBar() {
1584
1569
  this.topBarSubtitle = topBar.querySelector('.video-subtitle');
1585
1570
 
1586
1571
  if (this.options.debug) {
1587
- console.log('Top bar created with integrated settings');
1572
+ console.log('Top bar created with integrated settings', {
1573
+ showTitle: this.options.showTitleOverlay,
1574
+ persistent: this.options.persistentTitle,
1575
+ opacity: this.options.titleOverlayOpacity
1576
+ });
1588
1577
  }
1589
1578
  }
1590
1579
 
@@ -3180,7 +3169,6 @@ resetAutoHideTimer() {
3180
3169
  }
3181
3170
 
3182
3171
  if (this.video && this.video.paused) {
3183
-
3184
3172
  const isInitialPause = this.video.currentTime === 0 && !this.video.ended;
3185
3173
 
3186
3174
  if (!isInitialPause) {
@@ -3189,16 +3177,20 @@ resetAutoHideTimer() {
3189
3177
  }
3190
3178
 
3191
3179
  if (this.autoHideDebug && this.options.debug) {
3192
- console.log('Video paused but at start - allowing timer (autoplay blocked scenario)');
3180
+ console.log('Video paused but at start - allowing timer (autoplay blocked)');
3193
3181
  }
3194
3182
  }
3195
3183
 
3196
3184
  this.autoHideTimer = setTimeout(() => {
3197
- if (this.autoHideDebug && this.options.debug) console.log(`Timer expired after ${this.options.autoHideDelay}ms - hiding controls`);
3185
+ if (this.autoHideDebug && this.options.debug) {
3186
+ console.log(`Timer expired after ${this.options.autoHideDelay}ms - hiding controls`);
3187
+ }
3198
3188
  this.hideControlsNow();
3199
3189
  }, this.options.autoHideDelay);
3200
3190
 
3201
- if (this.autoHideDebug && this.options.debug) console.log(`Auto-hide timer started (${this.options.autoHideDelay}ms)`);
3191
+ if (this.autoHideDebug && this.options.debug) {
3192
+ console.log(`Auto-hide timer started (${this.options.autoHideDelay}ms)`);
3193
+ }
3202
3194
  }
3203
3195
 
3204
3196
  showControlsNow() {
@@ -3282,9 +3274,7 @@ clearControlsTimeout() {
3282
3274
  }
3283
3275
 
3284
3276
  injectDefaultControlbarStyles() {
3285
- if (document.getElementById('default-controlbar-styles')) {
3286
- return;
3287
- }
3277
+ if (document.getElementById('default-controlbar-styles')) return;
3288
3278
 
3289
3279
  const controlBarOpacity = Math.max(0, Math.min(1, this.options.controlBarOpacity));
3290
3280
  const titleOverlayOpacity = Math.max(0, Math.min(1, this.options.titleOverlayOpacity));
@@ -3306,7 +3296,7 @@ injectDefaultControlbarStyles() {
3306
3296
  min-height: 60px;
3307
3297
  padding-bottom: 10px;
3308
3298
  }
3309
-
3299
+
3310
3300
  .video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .title-overlay {
3311
3301
  background: linear-gradient(
3312
3302
  to bottom,
@@ -3321,8 +3311,11 @@ injectDefaultControlbarStyles() {
3321
3311
  min-height: 80px;
3322
3312
  padding-top: 20px;
3323
3313
  }
3324
- `;
3325
3314
 
3315
+ .video-wrapper {
3316
+ --player-topbar-opacity: ${titleOverlayOpacity};
3317
+ }
3318
+ `;
3326
3319
  document.head.appendChild(style);
3327
3320
  }
3328
3321
 
@@ -6024,28 +6017,22 @@ bindChapterEvents() {
6024
6017
  }
6025
6018
 
6026
6019
  updateChapterInTitleOverlay() {
6027
- if (!this.video || !this.chapters || this.chapters.length === 0) return;
6020
+ if (!this.video || !this.chapters || this.chapters.length === 0) return;
6021
+ if (!this.topBar) return;
6022
+ let subtitleElement = this.topBar.querySelector('.video-subtitle');
6028
6023
 
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);
6024
+ if (!subtitleElement) {
6025
+ const titleSection = this.topBar.querySelector('.top-bar-title');
6026
+ if (!titleSection) return;
6027
+
6028
+ subtitleElement = document.createElement('span');
6029
+ subtitleElement.className = 'video-subtitle';
6030
+ titleSection.appendChild(subtitleElement);
6031
+ this.topBarSubtitle = subtitleElement;
6046
6032
  }
6047
6033
  const currentTime = this.video.currentTime;
6048
6034
  let currentChapter = null;
6035
+
6049
6036
  for (let i = this.chapters.length - 1; i >= 0; i--) {
6050
6037
  if (currentTime >= this.chapters[i].time) {
6051
6038
  currentChapter = this.chapters[i];
@@ -6053,10 +6040,19 @@ updateChapterInTitleOverlay() {
6053
6040
  }
6054
6041
  }
6055
6042
  if (currentChapter) {
6056
- chapterElement.textContent = currentChapter.title;
6057
- chapterElement.style.display = 'block';
6043
+ subtitleElement.textContent = currentChapter.title;
6044
+ subtitleElement.style.display = 'block';
6045
+ } else {
6046
+ if (this.options.videoSubtitle) {
6047
+ subtitleElement.textContent = this.options.videoSubtitle;
6048
+ subtitleElement.style.display = 'block';
6058
6049
  } else {
6059
- chapterElement.style.display = 'none';
6050
+ subtitleElement.style.display = 'none';
6051
+ }
6052
+ }
6053
+
6054
+ if (this.options.debug) {
6055
+ console.log('Chapter overlay updated:', currentChapter ? currentChapter.title : 'No chapter');
6060
6056
  }
6061
6057
  }
6062
6058
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myetv-player",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
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,4 @@
64
64
 
65
65
 
66
66
 
67
+
@@ -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