myetv-player 1.2.0 → 1.4.0

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.
Files changed (47) hide show
  1. package/css/myetv-player.css +242 -168
  2. package/css/myetv-player.min.css +1 -1
  3. package/dist/myetv-player.js +638 -203
  4. package/dist/myetv-player.min.js +548 -170
  5. package/package.json +35 -16
  6. package/plugins/twitch/myetv-player-twitch-plugin.js +125 -11
  7. package/plugins/vimeo/myetv-player-vimeo.js +80 -49
  8. package/plugins/youtube/README.md +5 -2
  9. package/plugins/youtube/myetv-player-youtube-plugin.js +766 -6
  10. package/.github/workflows/codeql.yml +0 -100
  11. package/.github/workflows/npm-publish.yml +0 -30
  12. package/SECURITY.md +0 -50
  13. package/build.js +0 -195
  14. package/scss/README.md +0 -161
  15. package/scss/_audio-player.scss +0 -21
  16. package/scss/_base.scss +0 -116
  17. package/scss/_controls.scss +0 -204
  18. package/scss/_loading.scss +0 -111
  19. package/scss/_menus.scss +0 -432
  20. package/scss/_mixins.scss +0 -112
  21. package/scss/_poster.scss +0 -8
  22. package/scss/_progress-bar.scss +0 -319
  23. package/scss/_resolution.scss +0 -68
  24. package/scss/_responsive.scss +0 -1368
  25. package/scss/_themes.scss +0 -30
  26. package/scss/_title-overlay.scss +0 -60
  27. package/scss/_tooltips.scss +0 -7
  28. package/scss/_variables.scss +0 -49
  29. package/scss/_video.scss +0 -221
  30. package/scss/_volume.scss +0 -122
  31. package/scss/_watermark.scss +0 -128
  32. package/scss/myetv-player.scss +0 -51
  33. package/scss/package.json +0 -16
  34. package/src/README.md +0 -560
  35. package/src/chapters.js +0 -521
  36. package/src/controls.js +0 -1242
  37. package/src/core.js +0 -1922
  38. package/src/events.js +0 -537
  39. package/src/fullscreen.js +0 -82
  40. package/src/i18n.js +0 -374
  41. package/src/playlist.js +0 -177
  42. package/src/plugins.js +0 -384
  43. package/src/quality.js +0 -963
  44. package/src/streaming.js +0 -346
  45. package/src/subtitles.js +0 -524
  46. package/src/utils.js +0 -65
  47. package/src/watermark.js +0 -246
@@ -7,14 +7,15 @@ class VideoPlayerI18n {
7
7
 
8
8
  'it': {
9
9
  'subtitles': 'Sottotitoli (C)',
10
- 'subtitlesdisable': 'Disabilita Sottotitoli',
11
- 'subtitlesenable': 'Abilita Sottotitoli',
10
+ 'subtitlesoff': 'Disattivati',
11
+ 'subtitlesdisable': 'Disabilita sottotitoli',
12
+ 'subtitlesenable': 'Abilita sottotitoli',
12
13
  'play_pause': 'Play/Pausa (Spazio)',
13
14
  'mute_unmute': 'Muta/Smuta (M)',
14
15
  'volume': 'Volume',
15
16
  'playback_speed': 'Velocità riproduzione',
16
17
  'video_quality': 'Qualità video',
17
- 'picture_in_picture': 'Picture-in-Picture (P)',
18
+ 'picture_in_picture': 'Finestra sovrapposta (P)',
18
19
  'fullscreen': 'Schermo intero (F)',
19
20
  'auto': 'Auto',
20
21
  'brand_logo': 'Logo',
@@ -27,6 +28,7 @@ class VideoPlayerI18n {
27
28
 
28
29
  'en': {
29
30
  'subtitles': 'Subtitles (C)',
31
+ 'subtitlesoff': 'Off',
30
32
  'subtitlesdisable': 'Disable Subtitles',
31
33
  'subtitlesenable': 'Enable Subtitles',
32
34
  'play_pause': 'Play/Pause (Space)',
@@ -42,23 +44,20 @@ class VideoPlayerI18n {
42
44
  'prev_video': 'Previous video (P)',
43
45
  'playlist_next': 'Next',
44
46
  'playlist_prev': 'Previous',
45
- 'next_video': 'Next video (N)',
46
- 'prev_video': 'Previous video (P)',
47
- 'playlist_next': 'Next',
48
- 'playlist_prev': 'Previous',
49
47
  'settings_menu': 'Settings'
50
48
  },
51
49
 
52
50
  'es': {
53
51
  'subtitles': 'Subtítulos (C)',
54
- 'subtitlesdisable': 'Disable Subtitles',
55
- 'subtitlesenable': 'Enable Subtitles',
52
+ 'subtitlesoff': 'Desactivados',
53
+ 'subtitlesdisable': 'Desactivar subtítulos',
54
+ 'subtitlesenable': 'Activar subtítulos',
56
55
  'play_pause': 'Reproducir/Pausar (Espacio)',
57
56
  'mute_unmute': 'Silenciar (M)',
58
57
  'volume': 'Volumen',
59
58
  'playback_speed': 'Velocidad de reproducción',
60
59
  'video_quality': 'Calidad de vídeo',
61
- 'picture_in_picture': 'Picture-in-Picture (P)',
60
+ 'picture_in_picture': 'Imagen en imagen (P)',
62
61
  'fullscreen': 'Pantalla completa (F)',
63
62
  'auto': 'Auto',
64
63
  'brand_logo': 'Logo de marca',
@@ -66,19 +65,20 @@ class VideoPlayerI18n {
66
65
  'prev_video': 'Vídeo anterior (P)',
67
66
  'playlist_next': 'Siguiente',
68
67
  'playlist_prev': 'Anterior',
69
- 'settings_menu': 'Settings'
68
+ 'settings_menu': 'Configuración'
70
69
  },
71
70
 
72
71
  'fr': {
73
72
  'subtitles': 'Sous-titres (C)',
74
- 'subtitlesdisable': 'Disable Subtitles',
75
- 'subtitlesenable': 'Enable Subtitles',
73
+ 'subtitlesoff': 'Désactivés',
74
+ 'subtitlesdisable': 'Désactiver les sous-titres',
75
+ 'subtitlesenable': 'Activer les sous-titres',
76
76
  'play_pause': 'Lecture/Pause (Espace)',
77
77
  'mute_unmute': 'Muet (M)',
78
78
  'volume': 'Volume',
79
79
  'playback_speed': 'Vitesse de lecture',
80
80
  'video_quality': 'Qualité vidéo',
81
- 'picture_in_picture': 'Picture-in-Picture (P)',
81
+ 'picture_in_picture': 'Image dans l’image (P)',
82
82
  'fullscreen': 'Plein écran (F)',
83
83
  'auto': 'Auto',
84
84
  'brand_logo': 'Logo de marque',
@@ -86,19 +86,20 @@ class VideoPlayerI18n {
86
86
  'prev_video': 'Vidéo précédente (P)',
87
87
  'playlist_next': 'Suivant',
88
88
  'playlist_prev': 'Précédent',
89
- 'settings_menu': 'Settings'
89
+ 'settings_menu': 'Paramètres'
90
90
  },
91
91
 
92
92
  'de': {
93
93
  'subtitles': 'Untertitel (C)',
94
- 'subtitlesdisable': 'Disable Subtitles',
95
- 'subtitlesenable': 'Enable Subtitles',
94
+ 'subtitlesoff': 'Aus',
95
+ 'subtitlesdisable': 'Untertitel deaktivieren',
96
+ 'subtitlesenable': 'Untertitel aktivieren',
96
97
  'play_pause': 'Abspielen/Pausieren (Leertaste)',
97
98
  'mute_unmute': 'Stumm (M)',
98
99
  'volume': 'Lautstärke',
99
100
  'playback_speed': 'Wiedergabegeschwindigkeit',
100
101
  'video_quality': 'Videoqualität',
101
- 'picture_in_picture': 'Picture-in-Picture (P)',
102
+ 'picture_in_picture': 'Bild-in-Bild (P)',
102
103
  'fullscreen': 'Vollbild (F)',
103
104
  'auto': 'Auto',
104
105
  'brand_logo': 'Markenlogo',
@@ -106,19 +107,20 @@ class VideoPlayerI18n {
106
107
  'prev_video': 'Vorheriges Video (P)',
107
108
  'playlist_next': 'Weiter',
108
109
  'playlist_prev': 'Zurück',
109
- 'settings_menu': 'Settings'
110
+ 'settings_menu': 'Einstellungen'
110
111
  },
111
112
 
112
113
  'pt': {
113
114
  'subtitles': 'Legendas (C)',
114
- 'subtitlesdisable': 'Disable Subtitles',
115
- 'subtitlesenable': 'Enable Subtitles',
115
+ 'subtitlesoff': 'Desativadas',
116
+ 'subtitlesdisable': 'Desativar legendas',
117
+ 'subtitlesenable': 'Ativar legendas',
116
118
  'play_pause': 'Reproduzir/Pausar (Espaço)',
117
119
  'mute_unmute': 'Silenciar (M)',
118
120
  'volume': 'Volume',
119
121
  'playback_speed': 'Velocidade de reprodução',
120
122
  'video_quality': 'Qualidade do vídeo',
121
- 'picture_in_picture': 'Picture-in-Picture (P)',
123
+ 'picture_in_picture': 'Imagem em imagem (P)',
122
124
  'fullscreen': 'Tela cheia (F)',
123
125
  'auto': 'Auto',
124
126
  'brand_logo': 'Logo da marca',
@@ -126,13 +128,14 @@ class VideoPlayerI18n {
126
128
  'prev_video': 'Vídeo anterior (P)',
127
129
  'playlist_next': 'Próximo',
128
130
  'playlist_prev': 'Anterior',
129
- 'settings_menu': 'Settings'
131
+ 'settings_menu': 'Configurações'
130
132
  },
131
133
 
132
134
  'zh': {
133
135
  'subtitles': '字幕 (C)',
134
- 'subtitlesdisable': 'Disable Subtitles',
135
- 'subtitlesenable': 'Enable Subtitles',
136
+ 'subtitlesoff': '关闭',
137
+ 'subtitlesdisable': '禁用字幕',
138
+ 'subtitlesenable': '启用字幕',
136
139
  'play_pause': '播放/暂停 (空格)',
137
140
  'mute_unmute': '静音 (M)',
138
141
  'volume': '音量',
@@ -146,13 +149,14 @@ class VideoPlayerI18n {
146
149
  'prev_video': '上一个视频 (P)',
147
150
  'playlist_next': '下一个',
148
151
  'playlist_prev': '上一个',
149
- 'settings_menu': 'Settings'
152
+ 'settings_menu': '设置'
150
153
  },
151
154
 
152
155
  'ja': {
153
156
  'subtitles': '字幕 (C)',
154
- 'subtitlesdisable': 'Disable Subtitles',
155
- 'subtitlesenable': 'Enable Subtitles',
157
+ 'subtitlesoff': 'オフ',
158
+ 'subtitlesdisable': '字幕を無効にする',
159
+ 'subtitlesenable': '字幕を有効にする',
156
160
  'play_pause': '再生/一時停止 (スペース)',
157
161
  'mute_unmute': 'ミュート (M)',
158
162
  'volume': '音量',
@@ -166,13 +170,14 @@ class VideoPlayerI18n {
166
170
  'prev_video': '前の動画 (P)',
167
171
  'playlist_next': '次へ',
168
172
  'playlist_prev': '前へ',
169
- 'settings_menu': 'Settings'
173
+ 'settings_menu': '設定'
170
174
  },
171
175
 
172
176
  'ru': {
173
177
  'subtitles': 'Субтитры (C)',
174
- 'subtitlesdisable': 'Disable Subtitles',
175
- 'subtitlesenable': 'Enable Subtitles',
178
+ 'subtitlesoff': 'Выкл',
179
+ 'subtitlesdisable': 'Отключить субтитры',
180
+ 'subtitlesenable': 'Включить субтитры',
176
181
  'play_pause': 'Воспроизведение/Пауза (Пробел)',
177
182
  'mute_unmute': 'Звук (M)',
178
183
  'volume': 'Громкость',
@@ -186,13 +191,14 @@ class VideoPlayerI18n {
186
191
  'prev_video': 'Предыдущее видео (P)',
187
192
  'playlist_next': 'Далее',
188
193
  'playlist_prev': 'Назад',
189
- 'settings_menu': 'Settings'
194
+ 'settings_menu': 'Настройки'
190
195
  },
191
196
 
192
197
  'ar': {
193
198
  'subtitles': 'الترجمة (C)',
194
- 'subtitlesdisable': 'Disable Subtitles',
195
- 'subtitlesenable': 'Enable Subtitles',
199
+ 'subtitlesoff': 'إيقاف',
200
+ 'subtitlesdisable': 'تعطيل الترجمة',
201
+ 'subtitlesenable': 'تفعيل الترجمة',
196
202
  'play_pause': 'تشغيل/إيقاف مؤقت (مسافة)',
197
203
  'mute_unmute': 'كتم الصوت (M)',
198
204
  'volume': 'مستوى الصوت',
@@ -206,7 +212,175 @@ class VideoPlayerI18n {
206
212
  'prev_video': 'الفيديو السابق (P)',
207
213
  'playlist_next': 'التالي',
208
214
  'playlist_prev': 'السابق',
209
- 'settings_menu': 'Settings'
215
+ 'settings_menu': 'الإعدادات'
216
+ },
217
+
218
+ 'ko': {
219
+ 'subtitles': '자막 (C)',
220
+ 'subtitlesoff': '끄기',
221
+ 'subtitlesdisable': '자막 비활성화',
222
+ 'subtitlesenable': '자막 활성화',
223
+ 'play_pause': '재생/일시정지 (스페이스)',
224
+ 'mute_unmute': '음소거 (M)',
225
+ 'volume': '음량',
226
+ 'playback_speed': '재생 속도',
227
+ 'video_quality': '비디오 품질',
228
+ 'picture_in_picture': '화면 속 화면 (P)',
229
+ 'fullscreen': '전체 화면 (F)',
230
+ 'auto': '자동',
231
+ 'brand_logo': '브랜드 로고',
232
+ 'next_video': '다음 비디오 (N)',
233
+ 'prev_video': '이전 비디오 (P)',
234
+ 'playlist_next': '다음',
235
+ 'playlist_prev': '이전',
236
+ 'settings_menu': '설정'
237
+ },
238
+
239
+ 'pl': {
240
+ 'subtitles': 'Napisy (C)',
241
+ 'subtitlesoff': 'Wyłączone',
242
+ 'subtitlesdisable': 'Wyłącz napisy',
243
+ 'subtitlesenable': 'Włącz napisy',
244
+ 'play_pause': 'Odtwarzaj/Pauza (Spacja)',
245
+ 'mute_unmute': 'Wycisz (M)',
246
+ 'volume': 'Głośność',
247
+ 'playback_speed': 'Prędkość odtwarzania',
248
+ 'video_quality': 'Jakość wideo',
249
+ 'picture_in_picture': 'Obraz w obrazie (P)',
250
+ 'fullscreen': 'Pełny ekran (F)',
251
+ 'auto': 'Auto',
252
+ 'brand_logo': 'Logo marki',
253
+ 'next_video': 'Następne wideo (N)',
254
+ 'prev_video': 'Poprzednie wideo (P)',
255
+ 'playlist_next': 'Dalej',
256
+ 'playlist_prev': 'Wstecz',
257
+ 'settings_menu': 'Ustawienia'
258
+ },
259
+
260
+ 'hu': {
261
+ 'subtitles': 'Feliratok (C)',
262
+ 'subtitlesoff': 'Kikapcsolva',
263
+ 'subtitlesdisable': 'Feliratok kikapcsolása',
264
+ 'subtitlesenable': 'Feliratok bekapcsolása',
265
+ 'play_pause': 'Lejátszás/Szünet (Szóköz)',
266
+ 'mute_unmute': 'Némítás (M)',
267
+ 'volume': 'Hangerő',
268
+ 'playback_speed': 'Lejátszási sebesség',
269
+ 'video_quality': 'Videó minősége',
270
+ 'picture_in_picture': 'Kép a képben (P)',
271
+ 'fullscreen': 'Teljes képernyő (F)',
272
+ 'auto': 'Auto',
273
+ 'brand_logo': 'Márka logó',
274
+ 'next_video': 'Következő videó (N)',
275
+ 'prev_video': 'Előző videó (P)',
276
+ 'playlist_next': 'Következő',
277
+ 'playlist_prev': 'Előző',
278
+ 'settings_menu': 'Beállítások'
279
+ },
280
+
281
+ 'tr': {
282
+ 'subtitles': 'Altyazılar (C)',
283
+ 'subtitlesoff': 'Kapalı',
284
+ 'subtitlesdisable': 'Altyazıları kapat',
285
+ 'subtitlesenable': 'Altyazıları aç',
286
+ 'play_pause': 'Oynat/Duraklat (Boşluk)',
287
+ 'mute_unmute': 'Sessize al (M)',
288
+ 'volume': 'Ses düzeyi',
289
+ 'playback_speed': 'Oynatma hızı',
290
+ 'video_quality': 'Video kalitesi',
291
+ 'picture_in_picture': 'Resim içinde resim (P)',
292
+ 'fullscreen': 'Tam ekran (F)',
293
+ 'auto': 'Otomatik',
294
+ 'brand_logo': 'Marka logosu',
295
+ 'next_video': 'Sonraki video (N)',
296
+ 'prev_video': 'Önceki video (P)',
297
+ 'playlist_next': 'Sonraki',
298
+ 'playlist_prev': 'Önceki',
299
+ 'settings_menu': 'Ayarlar'
300
+ },
301
+
302
+ 'nl': {
303
+ 'subtitles': 'Ondertitels (C)',
304
+ 'subtitlesoff': 'Uit',
305
+ 'subtitlesdisable': 'Ondertitels uitschakelen',
306
+ 'subtitlesenable': 'Ondertitels inschakelen',
307
+ 'play_pause': 'Afspelen/Pauzeren (Spatie)',
308
+ 'mute_unmute': 'Dempen (M)',
309
+ 'volume': 'Volume',
310
+ 'playback_speed': 'Afspeelsnelheid',
311
+ 'video_quality': 'Videokwaliteit',
312
+ 'picture_in_picture': 'Beeld-in-beeld (P)',
313
+ 'fullscreen': 'Volledig scherm (F)',
314
+ 'auto': 'Auto',
315
+ 'brand_logo': 'Merklogo',
316
+ 'next_video': 'Volgende video (N)',
317
+ 'prev_video': 'Vorige video (P)',
318
+ 'playlist_next': 'Volgende',
319
+ 'playlist_prev': 'Vorige',
320
+ 'settings_menu': 'Instellingen'
321
+ },
322
+
323
+ 'hi': {
324
+ 'subtitles': 'उपशीर्षक (C)',
325
+ 'subtitlesoff': 'बंद',
326
+ 'subtitlesdisable': 'उपशीर्षक अक्षम करें',
327
+ 'subtitlesenable': 'उपशीर्षक सक्षम करें',
328
+ 'play_pause': 'चलाएं/रोकें (स्पेस)',
329
+ 'mute_unmute': 'म्यूट (M)',
330
+ 'volume': 'वॉल्यूम',
331
+ 'playback_speed': 'प्लेबैक गति',
332
+ 'video_quality': 'वीडियो गुणवत्ता',
333
+ 'picture_in_picture': 'चित्र-में-चित्र (P)',
334
+ 'fullscreen': 'पूर्ण स्क्रीन (F)',
335
+ 'auto': 'स्वतः',
336
+ 'brand_logo': 'ब्रांड लोगो',
337
+ 'next_video': 'अगला वीडियो (N)',
338
+ 'prev_video': 'पिछला वीडियो (P)',
339
+ 'playlist_next': 'अगला',
340
+ 'playlist_prev': 'पिछला',
341
+ 'settings_menu': 'सेटिंग्स'
342
+ },
343
+
344
+ 'sv': {
345
+ 'subtitles': 'Undertexter (C)',
346
+ 'subtitlesoff': 'Av',
347
+ 'subtitlesdisable': 'Inaktivera undertexter',
348
+ 'subtitlesenable': 'Aktivera undertexter',
349
+ 'play_pause': 'Spela/Pausa (Blanksteg)',
350
+ 'mute_unmute': 'Stäng av ljud (M)',
351
+ 'volume': 'Volym',
352
+ 'playback_speed': 'Uppspelningshastighet',
353
+ 'video_quality': 'Videokvalitet',
354
+ 'picture_in_picture': 'Bild i bild (P)',
355
+ 'fullscreen': 'Fullskärm (F)',
356
+ 'auto': 'Auto',
357
+ 'brand_logo': 'Varumärkeslogotyp',
358
+ 'next_video': 'Nästa video (N)',
359
+ 'prev_video': 'Föregående video (P)',
360
+ 'playlist_next': 'Nästa',
361
+ 'playlist_prev': 'Föregående',
362
+ 'settings_menu': 'Inställningar'
363
+ },
364
+
365
+ 'id': {
366
+ 'subtitles': 'Teks (C)',
367
+ 'subtitlesoff': 'Mati',
368
+ 'subtitlesdisable': 'Nonaktifkan teks',
369
+ 'subtitlesenable': 'Aktifkan teks',
370
+ 'play_pause': 'Putar/Jeda (Spasi)',
371
+ 'mute_unmute': 'Bisu (M)',
372
+ 'volume': 'Volume',
373
+ 'playback_speed': 'Kecepatan pemutaran',
374
+ 'video_quality': 'Kualitas video',
375
+ 'picture_in_picture': 'Gambar-dalam-gambar (P)',
376
+ 'fullscreen': 'Layar penuh (F)',
377
+ 'auto': 'Otomatis',
378
+ 'brand_logo': 'Logo merek',
379
+ 'next_video': 'Video berikutnya (N)',
380
+ 'prev_video': 'Video sebelumnya (P)',
381
+ 'playlist_next': 'Berikutnya',
382
+ 'playlist_prev': 'Sebelumnya',
383
+ 'settings_menu': 'Pengaturan'
210
384
  }
211
385
  };
212
386
 
@@ -865,6 +1039,10 @@ markPlayerReady() {
865
1039
  this.video.style.pointerEvents = '';
866
1040
  }
867
1041
 
1042
+ if (typeof this.updateSettingsMenuVisibility === 'function') {
1043
+ this.updateSettingsMenuVisibility();
1044
+ }
1045
+
868
1046
  setTimeout(() => {
869
1047
  if (this.options.autoHide && !this.autoHideInitialized) {
870
1048
  this.initAutoHide();
@@ -3034,30 +3212,12 @@ createControls() {
3034
3212
  <span class="icon"><svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M12.5 4v8l-7-4zm-8 0v8l7-4z"/></svg></span>
3035
3213
  </button>
3036
3214
 
3037
- ${this.options.showSubtitles ? `
3038
- <div class="subtitles-control" style="display: none;">
3039
- <button class="control-btn subtitles-btn" data-tooltip="subtitles">
3040
- <span class="icon"><svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M0 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2zm2-1a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1z"/><path d="M6.096 4.972c.234 0 .44.05.617.152.177.1.312.235.405.403.093.169.14.36.14.577 0 .216-.047.406-.14.572a1.03 1.03 0 0 1-.405.403 1.2 1.2 0 0 1-.617.152 1.2 1.2 0 0 1-.615-.152 1.03 1.03 0 0 1-.406-.403 1.28 1.28 0 0 1-.14-.572c0-.216.046-.408.14-.577.093-.168.228-.303.406-.403.177-.101.383-.152.615-.152m4.915 0c.234 0 .44.05.617.152.177.1.312.235.405.403.093.169.14.36.14.577 0 .216-.047.406-.14.572a1.03 1.03 0 0 1-.405.403 1.2 1.2 0 0 1-.617.152 1.2 1.2 0 0 1-.615-.152 1.03 1.03 0 0 1-.406-.403 1.28 1.28 0 0 1-.14-.572c0-.216.046-.408.14-.577.093-.168.228-.303.406-.403.177-.101.383-.152.615-.152M6.096 9.972c.234 0 .44.05.617.152.177.1.312.235.405.403.093.169.14.36.14.577 0 .216-.047.406-.14.572a1.03 1.03 0 0 1-.405.403 1.2 1.2 0 0 1-.617.152 1.2 1.2 0 0 1-.615-.152 1.03 1.03 0 0 1-.406-.403 1.28 1.28 0 0 1-.14-.572c0-.216.046-.408.14-.577.093-.168.228-.303.406-.403.177-.101.383-.152.615-.152m4.915 0c.234 0 .44.05.617.152.177.1.312.235.405.403.093.169.14.36.14.577 0 .216-.047.406-.14.572a1.03 1.03 0 0 1-.405.403 1.2 1.2 0 0 1-.617.152 1.2 1.2 0 0 1-.615-.152 1.03 1.03 0 0 1-.406-.403 1.28 1.28 0 0 1-.14-.572c0-.216.046-.408.14-.577.093-.168.228-.303.406-.403.177-.101.383-.152.615-.152"/></svg></span>
3215
+ <div class="settings-control">
3216
+ <button class="control-btn settings-btn" data-tooltip="settings_menu">
3217
+ <span class="icon"><svg viewBox="0 0 24 24" width="16" height="16" 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></span>
3041
3218
  </button>
3042
- <div class="subtitles-menu">
3043
- <div class="subtitles-option active" data-track="off">Off</div>
3044
- </div>
3045
- </div>
3046
- ` : ''}
3047
-
3048
- ${this.options.showSpeedControl ? `
3049
- <div class="speed-control">
3050
- <button class="control-btn speed-btn" data-tooltip="playback_speed">1x</button>
3051
- <div class="speed-menu">
3052
- <div class="speed-option" data-speed="0.5">0.5x</div>
3053
- <div class="speed-option" data-speed="0.75">0.75x</div>
3054
- <div class="speed-option active" data-speed="1">1x</div>
3055
- <div class="speed-option" data-speed="1.25">1.25x</div>
3056
- <div class="speed-option" data-speed="1.5">1.5x</div>
3057
- <div class="speed-option" data-speed="2">2x</div>
3058
- </div>
3219
+ <div class="settings-menu"></div>
3059
3220
  </div>
3060
- ` : ''}
3061
3221
 
3062
3222
  ${this.options.showQualitySelector && this.originalSources && this.originalSources.length > 1 ? `
3063
3223
  <div class="quality-control">
@@ -3083,13 +3243,6 @@ createControls() {
3083
3243
  </button>
3084
3244
  ` : ''}
3085
3245
 
3086
- <div class="settings-control">
3087
- <button class="control-btn settings-btn" data-tooltip="settings_menu">
3088
- <span class="icon"><svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"/><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52z"/></svg></span>
3089
- </button>
3090
- <div class="settings-menu"></div>
3091
- </div>
3092
-
3093
3246
  ${this.options.showFullscreen ? `
3094
3247
  <button class="control-btn fullscreen-btn" data-tooltip="fullscreen">
3095
3248
  <span class="icon fullscreen-icon"><svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M1.5 1a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0v-4A1.5 1.5 0 0 1 1.5 0h4a.5.5 0 0 1 0 1zM10 .5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 16 1.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5M.5 10a.5.5 0 0 1 .5.5v4a.5.5 0 0 0 .5.5h4a.5.5 0 0 1 0 1h-4A1.5 1.5 0 0 1 0 14.5v-4a.5.5 0 0 1 .5-.5m15 0a.5.5 0 0 1 .5.5v4a1.5 1.5 0 0 1-1.5 1.5h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5"/></svg></span>
@@ -3179,37 +3332,14 @@ updateSettingsMenuVisibility() {
3179
3332
  const settingsControl = this.controls?.querySelector('.settings-control');
3180
3333
  if (!settingsControl) return;
3181
3334
 
3182
- if (this.isSmallScreen) {
3183
-
3184
3335
  settingsControl.style.display = 'block';
3185
3336
 
3186
- const pipBtn = this.controls.querySelector('.pip-btn');
3187
- const speedControl = this.controls.querySelector('.speed-control');
3188
- const subtitlesControl = this.controls.querySelector('.subtitles-control');
3189
-
3190
- if (pipBtn) pipBtn.style.display = 'none';
3191
- if (speedControl) speedControl.style.display = 'none';
3192
- if (subtitlesControl) subtitlesControl.style.display = 'none';
3193
-
3194
3337
  this.populateSettingsMenu();
3195
- } else {
3196
3338
 
3197
- settingsControl.style.display = 'none';
3198
-
3199
- const pipBtn = this.controls.querySelector('.pip-btn');
3200
3339
  const speedControl = this.controls.querySelector('.speed-control');
3201
3340
  const subtitlesControl = this.controls.querySelector('.subtitles-control');
3202
-
3203
- if (pipBtn && this.options.showPictureInPicture && this.isPiPSupported) {
3204
- pipBtn.style.display = 'flex';
3205
- }
3206
- if (speedControl && this.options.showSpeedControl) {
3207
- speedControl.style.display = 'block';
3208
- }
3209
- if (subtitlesControl && this.options.showSubtitles && this.textTracks.length > 0) {
3210
- subtitlesControl.style.display = 'block';
3211
- }
3212
- }
3341
+ if (speedControl) speedControl.style.display = 'none';
3342
+ if (subtitlesControl) subtitlesControl.style.display = 'none';
3213
3343
  }
3214
3344
 
3215
3345
  populateSettingsMenu() {
@@ -3218,22 +3348,13 @@ populateSettingsMenu() {
3218
3348
 
3219
3349
  let menuHTML = '';
3220
3350
 
3221
- if (this.options.showPictureInPicture && this.isPiPSupported) {
3222
- const pipLabel = this.t('picture_in_picture') || 'Picture-in-Picture';
3223
- menuHTML += `<div class="settings-option" data-action="pip">
3224
- <span class="settings-option-label">${pipLabel}</span>
3225
- </div>`;
3226
- }
3227
-
3228
3351
  if (this.options.showSpeedControl) {
3229
3352
  const speedLabel = this.t('playback_speed') || 'Playback Speed';
3230
3353
  const currentSpeed = this.video ? this.video.playbackRate : 1;
3231
-
3232
- menuHTML += `
3233
- <div class="settings-expandable-wrapper">
3354
+ menuHTML += `<div class="settings-expandable-wrapper">
3234
3355
  <div class="settings-option expandable-trigger" data-action="speed-expand">
3235
- <span class="settings-option-label">${speedLabel}: ${currentSpeed}x</span>
3236
- <span class="expand-arrow">▼</span>
3356
+ <span class="settings-option-label">${speedLabel} <strong>${currentSpeed}x</strong></span>
3357
+ <span class="expand-arrow">▶</span>
3237
3358
  </div>
3238
3359
  <div class="settings-expandable-content" style="display: none;">`;
3239
3360
 
@@ -3242,20 +3363,18 @@ populateSettingsMenu() {
3242
3363
  const isActive = Math.abs(speed - currentSpeed) < 0.01;
3243
3364
  menuHTML += `<div class="settings-suboption ${isActive ? 'active' : ''}" data-speed="${speed}">${speed}x</div>`;
3244
3365
  });
3245
-
3246
3366
  menuHTML += `</div></div>`;
3247
3367
  }
3248
3368
 
3249
3369
  if (this.options.showSubtitles && this.textTracks && this.textTracks.length > 0) {
3250
3370
  const subtitlesLabel = this.t('subtitles') || 'Subtitles';
3251
3371
  const currentTrack = this.currentSubtitleTrack;
3252
- const currentLabel = this.subtitlesEnabled && currentTrack ? currentTrack.label : (this.t('subtitlesoff') || 'Off');
3372
+ const currentLabel = this.subtitlesEnabled ? (currentTrack ? currentTrack.label : 'Unknown') : (this.t('subtitlesoff') || 'Off');
3253
3373
 
3254
- menuHTML += `
3255
- <div class="settings-expandable-wrapper">
3374
+ menuHTML += `<div class="settings-expandable-wrapper">
3256
3375
  <div class="settings-option expandable-trigger" data-action="subtitles-expand">
3257
- <span class="settings-option-label">${subtitlesLabel}: ${currentLabel}</span>
3258
- <span class="expand-arrow">▼</span>
3376
+ <span class="settings-option-label">${subtitlesLabel} <strong>${currentLabel}</strong></span>
3377
+ <span class="expand-arrow">▶</span>
3259
3378
  </div>
3260
3379
  <div class="settings-expandable-content" style="display: none;">`;
3261
3380
 
@@ -3270,20 +3389,30 @@ populateSettingsMenu() {
3270
3389
  }
3271
3390
 
3272
3391
  settingsMenu.innerHTML = menuHTML;
3273
-
3274
- this.addSettingsMenuScrollbar();
3275
3392
  }
3276
3393
 
3277
3394
  addSettingsMenuScrollbar() {
3278
3395
  const settingsMenu = this.controls?.querySelector('.settings-menu');
3279
3396
  if (!settingsMenu) return;
3280
3397
 
3281
- const playerHeight = this.container.offsetHeight;
3282
- const maxMenuHeight = playerHeight - 100;
3398
+ const settingsBtn = document.querySelector('.settings-btn');
3399
+ if (!settingsBtn) return;
3283
3400
 
3401
+ const updateMenuHeight = () => {
3402
+ if (settingsMenu.classList.contains('active')) {
3403
+ const containerRect = settingsMenu.parentElement.parentElement.getBoundingClientRect();
3404
+ const btnRect = settingsBtn.getBoundingClientRect();
3405
+ const spaceBelow = containerRect.bottom - btnRect.bottom;
3406
+ const maxMenuHeight = Math.max(100, Math.min(250, spaceBelow - 20));
3284
3407
  settingsMenu.style.maxHeight = `${maxMenuHeight}px`;
3285
3408
  settingsMenu.style.overflowY = 'auto';
3286
3409
  settingsMenu.style.overflowX = 'hidden';
3410
+ }
3411
+ };
3412
+
3413
+ updateMenuHeight();
3414
+
3415
+ window.addEventListener('resize', updateMenuHeight);
3287
3416
 
3288
3417
  if (!document.getElementById('player-settings-scrollbar-style')) {
3289
3418
  const scrollbarStyle = document.createElement('style');
@@ -3312,8 +3441,38 @@ addSettingsMenuScrollbar() {
3312
3441
  }
3313
3442
 
3314
3443
  bindSettingsMenuEvents() {
3444
+ const settingsBtn = this.controls?.querySelector('.settings-btn');
3315
3445
  const settingsMenu = this.controls?.querySelector('.settings-menu');
3316
- if (!settingsMenu) return;
3446
+ if (!settingsMenu || !settingsBtn) return;
3447
+
3448
+ settingsBtn.addEventListener('click', (e) => {
3449
+ e.stopPropagation();
3450
+ settingsMenu.classList.toggle('active');
3451
+
3452
+ if (settingsMenu.classList.contains('active')) {
3453
+ const settingsBtn = document.querySelector('.settings-btn');
3454
+ const containerRect = settingsMenu.parentElement.parentElement.getBoundingClientRect();
3455
+ const btnRect = settingsBtn.getBoundingClientRect();
3456
+ const spaceBelow = containerRect.bottom - btnRect.bottom;
3457
+ const maxMenuHeight = Math.max(100, Math.min(250, spaceBelow - 20));
3458
+
3459
+ settingsMenu.style.maxHeight = `${maxMenuHeight}px`;
3460
+ settingsMenu.style.overflowY = 'auto';
3461
+ settingsMenu.style.overflowX = 'hidden';
3462
+ } else {
3463
+ settingsMenu.style.maxHeight = 'none';
3464
+ settingsMenu.style.overflowY = 'visible';
3465
+ }
3466
+
3467
+ });
3468
+
3469
+ document.addEventListener('click', (e) => {
3470
+ if (!settingsBtn?.contains(e.target) && !settingsMenu?.contains(e.target)) {
3471
+ settingsMenu?.classList.remove('active');
3472
+ settingsMenu.style.maxHeight = 'none';
3473
+ settingsMenu.style.overflowY = 'visible';
3474
+ }
3475
+ });
3317
3476
 
3318
3477
  settingsMenu.addEventListener('click', (e) => {
3319
3478
  e.stopPropagation();
@@ -5256,37 +5415,82 @@ parseTimeToSeconds(timeStr) {
5256
5415
  }
5257
5416
 
5258
5417
  createChapterMarkers() {
5259
- if (!this.progressContainer || !this.video || !this.chapters) {
5418
+ if (!this.progressContainer || !this.video || !this.chapters) return;
5419
+
5420
+ const duration = this.video.duration;
5421
+ if (!duration || isNaN(duration)) {
5422
+ const loadedMetadataHandler = () => {
5423
+ this.createChapterMarkers();
5424
+ this.video.removeEventListener('loadedmetadata', loadedMetadataHandler);
5425
+ };
5426
+ this.video.addEventListener('loadedmetadata', loadedMetadataHandler);
5260
5427
  return;
5261
5428
  }
5429
+ const existingMarkers = this.progressContainer.querySelector('.chapter-markers-container');
5430
+ if (existingMarkers) {
5431
+ existingMarkers.remove();
5432
+ }
5262
5433
  const markersContainer = document.createElement('div');
5263
- markersContainer.className = 'chapter-markers-container';
5264
-
5434
+ markersContainer.className = 'chapter-markers-container';
5265
5435
  this.chapters.forEach((chapter, index) => {
5436
+ const nextChapter = this.chapters[index + 1];
5437
+ const startPercent = (chapter.time / duration) * 100;
5438
+ const endPercent = nextChapter ? (nextChapter.time / duration) * 100 : 100;
5439
+ const gapSize = nextChapter ? 6 : 0; // 6px gap between segments
5440
+ const widthPercent = endPercent - startPercent;
5441
+ const segment = document.createElement('div');
5442
+ segment.className = 'chapter-segment';
5443
+ segment.style.cssText = `
5444
+ position: absolute;
5445
+ left: ${startPercent}%;
5446
+ top: 0;
5447
+ width: calc(${widthPercent}% - ${gapSize}px);
5448
+ height: 100%;
5449
+ background: rgba(255, 255, 255, 0.3);
5450
+ cursor: pointer;
5451
+ z-index: 3;
5452
+ transition: background 0.2s;
5453
+ pointer-events: none;
5454
+ `;
5455
+
5456
+ segment.setAttribute('data-chapter-index', index);
5457
+ segment.setAttribute('data-chapter-time', chapter.time);
5458
+ segment.setAttribute('data-chapter-title', chapter.title);
5459
+
5460
+ markersContainer.appendChild(segment);
5461
+ if (nextChapter) {
5266
5462
  const marker = document.createElement('div');
5267
5463
  marker.className = 'chapter-marker';
5268
- marker.setAttribute('data-chapter-index', index);
5269
- marker.setAttribute('data-chapter-time', chapter.time);
5270
- marker.setAttribute('data-chapter-title', chapter.title);
5271
- if (chapter.color) {
5272
- marker.style.backgroundColor = chapter.color;
5273
- }
5464
+ marker.style.cssText = `
5465
+ position: absolute !important;
5466
+ left: ${endPercent}% !important;
5467
+ top: 0 !important;
5468
+ width: 6px !important;
5469
+ height: 100% !important;
5470
+ background: transparent !important;
5471
+ border: none !important;
5472
+ box-shadow: none !important;
5473
+ margin-left: -3px !important;
5474
+ cursor: pointer !important;
5475
+ z-index: 10 !important;
5476
+ `;
5477
+
5478
+ marker.setAttribute('data-chapter-time', nextChapter.time);
5479
+ marker.setAttribute('data-chapter-title', nextChapter.title);
5480
+ marker.addEventListener('click', (e) => {
5481
+ e.stopPropagation();
5482
+ this.jumpToChapter(index + 1);
5483
+ });
5274
5484
 
5275
5485
  markersContainer.appendChild(marker);
5486
+ }
5276
5487
  });
5277
5488
  this.progressContainer.appendChild(markersContainer);
5278
- this.chapterMarkersContainer = markersContainer;
5279
- if (this.video.duration && !isNaN(this.video.duration)) {
5280
- this.updateChapterMarkerPositions();
5281
- } else {
5282
- const loadedMetadataHandler = () => {
5283
- this.updateChapterMarkerPositions();
5284
- this.video.removeEventListener('loadedmetadata', loadedMetadataHandler);
5285
- };
5286
- this.video.addEventListener('loadedmetadata', loadedMetadataHandler);
5287
- }
5489
+ this.chapterMarkersContainer = markersContainer;
5288
5490
 
5289
- if (this.options.debug) console.log('📚 Chapter markers created on timeline');
5491
+ if (this.options.debug) {
5492
+ console.log(`Chapter markers created: ${this.chapters.length} segments`);
5493
+ }
5290
5494
  }
5291
5495
 
5292
5496
  updateChapterMarkerPositions() {
@@ -5308,56 +5512,231 @@ updateChapterMarkerPositions() {
5308
5512
  }
5309
5513
 
5310
5514
  createChapterTooltip() {
5311
- if (!this.progressContainer) {
5312
- return;
5313
- }
5314
-
5315
- const tooltip = document.createElement('div');
5316
- tooltip.className = 'chapter-tooltip';
5317
- tooltip.style.opacity = '0';
5318
- tooltip.style.visibility = 'hidden';
5319
- tooltip.innerHTML = `
5320
- <div class="chapter-tooltip-image"></div>
5321
- <div class="chapter-tooltip-title"></div>
5322
- <div class="chapter-tooltip-time"></div>
5515
+ if (!this.progressContainer) return;
5516
+ let chapterTooltip = this.progressContainer.querySelector('.chapter-tooltip');
5517
+ if (chapterTooltip) {
5518
+ chapterTooltip.remove();
5519
+ }
5520
+ chapterTooltip = document.createElement('div');
5521
+ chapterTooltip.className = 'chapter-tooltip';
5522
+ chapterTooltip.style.cssText = `
5523
+ position: absolute;
5524
+ bottom: calc(100% + 35px);
5525
+ left: 0;
5526
+ background: rgba(28, 28, 28, 0.95);
5527
+ color: #fff;
5528
+ border-radius: 4px;
5529
+ pointer-events: none;
5530
+ visibility: hidden;
5531
+ opacity: 0;
5532
+ z-index: 100001;
5533
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
5534
+ max-width: 300px;
5535
+ overflow: hidden;
5536
+ transform: translateX(-50%);
5537
+ transition: opacity 0.15s, visibility 0.15s;
5538
+ display: flex;
5539
+ flex-direction: column;
5540
+ `;
5541
+ chapterTooltip.innerHTML = `
5542
+ <div class="chapter-tooltip-content" style="display: flex; flex-direction: column; gap: 8px; padding: 8px;">
5543
+ <div class="chapter-tooltip-image" style="
5544
+ width: 100%;
5545
+ height: 120px;
5546
+ background-size: cover;
5547
+ background-position: center;
5548
+ border-radius: 3px;
5549
+ display: none;
5550
+ "></div>
5551
+ <div class="chapter-tooltip-info" style="display: flex; flex-direction: column; gap: 4px;">
5552
+ <div class="chapter-tooltip-title" style="
5553
+ font-size: 13px;
5554
+ font-weight: 600;
5555
+ color: #fff;
5556
+ max-width: 280px;
5557
+ overflow: hidden;
5558
+ text-overflow: ellipsis;
5559
+ white-space: nowrap;
5560
+ "></div>
5561
+ <div class="chapter-tooltip-time" style="
5562
+ font-size: 12px;
5563
+ font-weight: 400;
5564
+ color: rgba(255, 255, 255, 0.8);
5565
+ "></div>
5566
+ </div>
5567
+ </div>
5323
5568
  `;
5324
5569
 
5325
- this.progressContainer.appendChild(tooltip);
5326
- this.chapterTooltip = tooltip;
5570
+ this.progressContainer.appendChild(chapterTooltip);
5571
+ this.chapterTooltip = chapterTooltip;
5327
5572
 
5328
- if (this.options.debug) console.log('📚 Chapter tooltip created');
5573
+ if (this.options.debug) {
5574
+ console.log('Chapter tooltip created');
5575
+ }
5329
5576
  }
5330
5577
 
5331
5578
  bindChapterEvents() {
5332
- if (!this.chapterMarkersContainer || !this.chapterTooltip) {
5579
+ if (!this.progressContainer) return;
5580
+ let chapterTooltip = this.progressContainer.querySelector('.chapter-tooltip-hover');
5581
+ if (chapterTooltip) {
5582
+ chapterTooltip.remove();
5583
+ }
5584
+ chapterTooltip = document.createElement('div');
5585
+ chapterTooltip.className = 'chapter-tooltip-hover';
5586
+ chapterTooltip.style.cssText = `
5587
+ position: absolute;
5588
+ bottom: calc(100% + 35px);
5589
+ left: 0;
5590
+ background: rgba(28, 28, 28, 0.95);
5591
+ color: #fff;
5592
+ border-radius: 4px;
5593
+ padding: 8px;
5594
+ pointer-events: none;
5595
+ visibility: hidden;
5596
+ opacity: 0;
5597
+ z-index: 100001;
5598
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
5599
+ max-width: 300px;
5600
+ transform: translateX(-50%);
5601
+ transition: opacity 0.15s, visibility 0.15s;
5602
+ `;
5603
+
5604
+ this.progressContainer.appendChild(chapterTooltip);
5605
+ this.chapterTooltip = chapterTooltip;
5606
+ const getPlayerBounds = () => {
5607
+ return this.container ? this.container.getBoundingClientRect() : null;
5608
+ };
5609
+ this.progressContainer.addEventListener('mousemove', (e) => {
5610
+ if (!this.video || !this.video.duration || !this.chapters || this.chapters.length === 0) {
5333
5611
  return;
5612
+ }
5613
+
5614
+ const rect = this.progressContainer.getBoundingClientRect();
5615
+ const playerRect = getPlayerBounds();
5616
+ const mouseX = e.clientX - rect.left;
5617
+ const percentage = Math.max(0, Math.min(1, mouseX / rect.width));
5618
+ const time = percentage * this.video.duration;
5619
+ let currentChapter = null;
5620
+ for (let i = this.chapters.length - 1; i >= 0; i--) {
5621
+ if (time >= this.chapters[i].time) {
5622
+ currentChapter = this.chapters[i];
5623
+ break;
5624
+ }
5625
+ }
5626
+
5627
+ if (currentChapter) {
5628
+ let tooltipHTML = '<div style="display: flex; flex-direction: column; gap: 6px;">';
5629
+ if (currentChapter.image) {
5630
+ tooltipHTML += `
5631
+ <div style="
5632
+ width: 100%;
5633
+ height: 120px;
5634
+ background-image: url('${currentChapter.image}');
5635
+ background-size: cover;
5636
+ background-position: center;
5637
+ border-radius: 3px;
5638
+ "></div>
5639
+ `;
5334
5640
  }
5335
- const markers = this.chapterMarkersContainer.querySelectorAll('.chapter-marker');
5641
+ tooltipHTML += `
5642
+ <div style="
5643
+ font-size: 13px;
5644
+ font-weight: 600;
5645
+ max-width: 280px;
5646
+ overflow: hidden;
5647
+ text-overflow: ellipsis;
5648
+ white-space: nowrap;
5649
+ ">
5650
+ ${currentChapter.title}
5651
+ </div>
5652
+ `;
5653
+ tooltipHTML += `
5654
+ <div style="
5655
+ font-size: 12px;
5656
+ font-weight: 400;
5657
+ color: rgba(255, 255, 255, 0.8);
5658
+ ">
5659
+ ${this.formatTime(currentChapter.time)}
5660
+ </div>
5661
+ `;
5336
5662
 
5337
- markers.forEach((marker, index) => {
5338
- marker.addEventListener('mouseenter', (e) => {
5339
- this.showChapterTooltip(index, e);
5340
- });
5663
+ tooltipHTML += '</div>';
5341
5664
 
5342
- marker.addEventListener('mousemove', (e) => {
5343
- this.updateChapterTooltipPosition(e);
5344
- });
5665
+ chapterTooltip.innerHTML = tooltipHTML;
5666
+ chapterTooltip.style.visibility = 'visible';
5667
+ chapterTooltip.style.opacity = '1';
5668
+ setTimeout(() => {
5669
+ const tooltipWidth = chapterTooltip.offsetWidth;
5670
+ const tooltipHalfWidth = tooltipWidth / 2;
5671
+ const absoluteX = e.clientX;
5345
5672
 
5346
- marker.addEventListener('mouseleave', () => {
5347
- this.hideChapterTooltip();
5673
+ if (playerRect) {
5674
+ if (absoluteX - tooltipHalfWidth < playerRect.left) {
5675
+ chapterTooltip.style.left = `${playerRect.left - rect.left + tooltipHalfWidth}px`;
5676
+ }
5677
+ else if (absoluteX + tooltipHalfWidth > playerRect.right) {
5678
+ chapterTooltip.style.left = `${playerRect.right - rect.left - tooltipHalfWidth}px`;
5679
+ }
5680
+ else {
5681
+ chapterTooltip.style.left = `${mouseX}px`;
5682
+ }
5683
+ } else {
5684
+ chapterTooltip.style.left = `${mouseX}px`;
5685
+ }
5686
+ }, 0);
5687
+ } else {
5688
+ chapterTooltip.style.visibility = 'hidden';
5689
+ chapterTooltip.style.opacity = '0';
5690
+ }
5348
5691
  });
5349
- marker.addEventListener('click', (e) => {
5350
- e.stopPropagation();
5351
- this.jumpToChapter(index);
5352
- });
5692
+ this.progressContainer.addEventListener('mouseleave', () => {
5693
+ chapterTooltip.style.visibility = 'hidden';
5694
+ chapterTooltip.style.opacity = '0';
5353
5695
  });
5354
5696
  if (this.video) {
5355
- this.video.addEventListener('timeupdate', () => {
5356
- this.updateActiveChapter();
5357
- });
5697
+ this.video.addEventListener('timeupdate', () => this.updateActiveChapter());
5698
+ }
5699
+
5700
+ if (this.options.debug) {
5701
+ console.log('Chapter events bound with tooltip');
5358
5702
  }
5703
+ }
5704
+
5705
+ updateChapterInTitleOverlay() {
5706
+ if (!this.video || !this.chapters || this.chapters.length === 0) return;
5359
5707
 
5360
- if (this.options.debug) console.log('📚 Chapter events bound');
5708
+ const titleOverlay = this.container ? this.container.querySelector('.title-overlay') : null;
5709
+ if (!titleOverlay) return;
5710
+ let chapterElement = titleOverlay.querySelector('.chapter-name');
5711
+ if (!chapterElement) {
5712
+ chapterElement = document.createElement('div');
5713
+ chapterElement.className = 'chapter-name';
5714
+ chapterElement.style.cssText = `
5715
+ font-size: 13px;
5716
+ font-weight: 500;
5717
+ color: rgba(255, 255, 255, 0.9);
5718
+ margin-top: 6px;
5719
+ max-width: 400px;
5720
+ overflow: hidden;
5721
+ text-overflow: ellipsis;
5722
+ white-space: nowrap;
5723
+ `;
5724
+ titleOverlay.appendChild(chapterElement);
5725
+ }
5726
+ const currentTime = this.video.currentTime;
5727
+ let currentChapter = null;
5728
+ for (let i = this.chapters.length - 1; i >= 0; i--) {
5729
+ if (currentTime >= this.chapters[i].time) {
5730
+ currentChapter = this.chapters[i];
5731
+ break;
5732
+ }
5733
+ }
5734
+ if (currentChapter) {
5735
+ chapterElement.textContent = currentChapter.title;
5736
+ chapterElement.style.display = 'block';
5737
+ } else {
5738
+ chapterElement.style.display = 'none';
5739
+ }
5361
5740
  }
5362
5741
 
5363
5742
  showChapterTooltip(chapterIndex, e) {
@@ -5424,9 +5803,7 @@ jumpToChapter(chapterIndex) {
5424
5803
  }
5425
5804
 
5426
5805
  updateActiveChapter() {
5427
- if (!this.video || !this.chapterMarkersContainer || !this.chapters) {
5428
- return;
5429
- }
5806
+ if (!this.video || !this.chapterMarkersContainer || !this.chapters) return;
5430
5807
 
5431
5808
  const currentTime = this.video.currentTime;
5432
5809
  const markers = this.chapterMarkersContainer.querySelectorAll('.chapter-marker');
@@ -5443,7 +5820,8 @@ updateActiveChapter() {
5443
5820
  } else {
5444
5821
  marker.classList.remove('active');
5445
5822
  }
5446
- });
5823
+ });
5824
+ this.updateChapterInTitleOverlay();
5447
5825
  }
5448
5826
 
5449
5827
  getCurrentChapter() {