myetv-player 1.1.5 → 1.2.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.
@@ -29,6 +29,22 @@
29
29
  z-index: 20 !important;
30
30
  }
31
31
 
32
+ .play-icon svg,
33
+ .pause-icon svg,
34
+ .volume-icon svg,
35
+ .mute-icon svg,
36
+ .playlist-prev-btn .icon svg,
37
+ .playlist-next-btn .icon svg,
38
+ .subtitles-btn .icon svg,
39
+ .fullscreen-icon svg,
40
+ .exit-fullscreen-icon svg,
41
+ .pip-icon svg,
42
+ .pip-exit-icon svg {
43
+ width: 16px;
44
+ height: 16px;
45
+ display: block;
46
+ }
47
+
32
48
  /* MAIN CONTROLS - IMPROVED RESPONSIVE LAYOUT */
33
49
  .controls-main {
34
50
  display: flex;
@@ -74,6 +74,14 @@
74
74
  gap: 6px;
75
75
  }
76
76
 
77
+ .progress-container {
78
+ margin-bottom: 10px;
79
+ }
80
+
81
+ .controls-main {
82
+ padding-top: 6px;
83
+ }
84
+
77
85
  .volume-container {
78
86
  /* Reduce volume slider width further instead of hiding */
79
87
  flex-shrink: 3;
package/src/controls.js CHANGED
@@ -229,6 +229,52 @@ clearControlsTimeout() {
229
229
  }
230
230
  }
231
231
 
232
+ // Default controlbar styles injection
233
+ injectDefaultControlbarStyles() {
234
+ if (document.getElementById('default-controlbar-styles')) {
235
+ return;
236
+ }
237
+
238
+ const controlBarOpacity = Math.max(0, Math.min(1, this.options.controlBarOpacity));
239
+ const titleOverlayOpacity = Math.max(0, Math.min(1, this.options.titleOverlayOpacity));
240
+
241
+ const style = document.createElement('style');
242
+ style.id = 'default-controlbar-styles';
243
+ style.textContent = `
244
+ .video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .controls {
245
+ background: linear-gradient(
246
+ to top,
247
+ rgba(0, 0, 0, ${controlBarOpacity}) 0%,
248
+ rgba(0, 0, 0, ${controlBarOpacity * 0.89}) 20%,
249
+ rgba(0, 0, 0, ${controlBarOpacity * 0.74}) 40%,
250
+ rgba(0, 0, 0, ${controlBarOpacity * 0.53}) 60%,
251
+ rgba(0, 0, 0, ${controlBarOpacity * 0.32}) 80%,
252
+ rgba(0, 0, 0, ${controlBarOpacity * 0.21}) 100%
253
+ );
254
+ backdrop-filter: blur(3px);
255
+ min-height: 60px;
256
+ padding-bottom: 10px;
257
+ }
258
+
259
+ .video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .title-overlay {
260
+ background: linear-gradient(
261
+ to bottom,
262
+ rgba(0, 0, 0, ${titleOverlayOpacity}) 0%,
263
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.89}) 20%,
264
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.74}) 40%,
265
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.53}) 60%,
266
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.32}) 80%,
267
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.21}) 100%
268
+ );
269
+ backdrop-filter: blur(3px);
270
+ min-height: 80px;
271
+ padding-top: 20px;
272
+ }
273
+ `;
274
+
275
+ document.head.appendChild(style);
276
+ }
277
+
232
278
  // Debug methods
233
279
  enableAutoHideDebug() {
234
280
  this.autoHideDebug = true;
@@ -376,20 +422,20 @@ createControls() {
376
422
  <div class="progress-buffer"></div>
377
423
  <div class="progress-filled"></div>
378
424
  </div>
379
- <div class="progress-handle progress-handle-${this.options.seekHandleShape}"></div> <!-- ✅ Fuori da progress-bar -->
425
+ <div class="progress-handle progress-handle-${this.options.seekHandleShape}"></div>
380
426
  ${this.options.showSeekTooltip ? '<div class="seek-tooltip">0:00</div>' : ''}
381
427
  </div>
382
428
 
383
429
  <div class="controls-main">
384
430
  <div class="controls-left">
385
431
  <button class="control-btn play-pause-btn" data-tooltip="play_pause">
386
- <span class="icon play-icon">▶</span>
387
- <span class="icon pause-icon hidden">⏸</span>
432
+ <span class="icon play-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M8 5v14l11-7z"/></svg></span>
433
+ <span class="icon pause-icon hidden"><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M6 4h4v16H6zm8 0h4v16h-4z"/></svg></span>
388
434
  </button>
389
435
 
390
436
  <button class="control-btn mute-btn" data-tooltip="mute_unmute">
391
- <span class="icon volume-icon">🔊</span>
392
- <span class="icon mute-icon hidden">🔇</span>
437
+ <span class="icon volume-icon"><svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M11.536 14.01A8.473 8.473 0 0 0 14.026 8a8.473 8.473 0 0 0-2.49-6.01l-.708.707A7.476 7.476 0 0 1 13.025 8c0 2.071-.84 3.946-2.197 5.303z"/><path d="M10.121 12.596A6.48 6.48 0 0 0 12.025 8a6.48 6.48 0 0 0-1.904-4.596l-.707.707A5.483 5.483 0 0 1 11.025 8a5.483 5.483 0 0 1-1.61 3.89z"/><path d="M10.025 8a4.486 4.486 0 0 1-1.318 3.182L8 10.475A3.489 3.489 0 0 0 9.025 8c0-.966-.392-1.841-1.025-2.475l.707-.707A4.486 4.486 0 0 1 10.025 8M7 4a.5.5 0 0 0-.812-.39L3.825 5.5H1.5A.5.5 0 0 0 1 6v4a.5.5 0 0 0 .5.5h2.325l2.363 1.89A.5.5 0 0 0 7 12z"/></svg></span>
438
+ <span class="icon mute-icon hidden"><svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M6.717 3.55A.5.5 0 0 1 7 4v8a.5.5 0 0 1-.812.39L3.825 10.5H1.5A.5.5 0 0 1 1 10V6a.5.5 0 0 1 .5-.5h2.325l2.363-1.89a.5.5 0 0 1 .529-.06m7.137 2.096a.5.5 0 0 1 0 .708L12.207 8l1.647 1.646a.5.5 0 0 1-.708.708L11.5 8.707l-1.646 1.647a.5.5 0 0 1-.708-.708L10.793 8 9.146 6.354a.5.5 0 1 1 .708-.708L11.5 7.293l1.646-1.647a.5.5 0 0 1 .708 0"/></svg></span>
393
439
  </button>
394
440
 
395
441
  <div class="volume-container" data-mobile-slider="${this.options.volumeSlider}">
@@ -404,18 +450,17 @@ createControls() {
404
450
  </div>
405
451
 
406
452
  <div class="controls-right">
407
- <button class="control-btn playlist-prev-btn" data-tooltip="prevvideo" style="display: none;">
408
- <span class="icon">⏮</span>
409
- </button>
410
-
411
- <button class="control-btn playlist-next-btn" data-tooltip="nextvideo" style="display: none;">
412
- <span class="icon">⏭</span>
413
- </button>
453
+ <button class="control-btn playlist-prev-btn" data-tooltip="prevvideo" style="display: none;">
454
+ <span class="icon"><svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M3.5 12V4l7 4zm8-8v8l-7-4z"/></svg></span>
455
+ </button>
456
+ <button class="control-btn playlist-next-btn" data-tooltip="nextvideo" style="display: none;">
457
+ <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>
458
+ </button>
414
459
 
415
460
  ${this.options.showSubtitles ? `
416
461
  <div class="subtitles-control" style="display: none;">
417
462
  <button class="control-btn subtitles-btn" data-tooltip="subtitles">
418
- <span class="icon">CC</span>
463
+ <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>
419
464
  </button>
420
465
  <div class="subtitles-menu">
421
466
  <div class="subtitles-option active" data-track="off">Off</div>
@@ -456,22 +501,22 @@ createControls() {
456
501
 
457
502
  ${this.options.showPictureInPicture && this.isPiPSupported ? `
458
503
  <button class="control-btn pip-btn" data-tooltip="picture_in_picture">
459
- <span class="icon pip-icon">⧉</span>
460
- <span class="icon pip-exit-icon hidden">⧉</span>
504
+ <span class="icon pip-icon"><svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M0 3.5A1.5 1.5 0 0 1 1.5 2h13A1.5 1.5 0 0 1 16 3.5v9a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 0 12.5zM1.5 3a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5z"/><path d="M8 8.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v3a.5.5 0 0 1-.5.5h-5a.5.5 0 0 1-.5-.5z"/></svg></span>
505
+ <span class="icon pip-exit-icon hidden"><svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M0 3.5A1.5 1.5 0 0 1 1.5 2h13A1.5 1.5 0 0 1 16 3.5v9a1.5 1.5 0 0 1-1.5 1.5h-13A1.5 1.5 0 0 1 0 12.5zM1.5 3a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5z"/></svg></span>
461
506
  </button>
462
507
  ` : ''}
463
508
 
464
509
  <div class="settings-control">
465
510
  <button class="control-btn settings-btn" data-tooltip="settings_menu">
466
- <span class="">⚙</span>
511
+ <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>
467
512
  </button>
468
513
  <div class="settings-menu"></div>
469
514
  </div>
470
515
 
471
516
  ${this.options.showFullscreen ? `
472
517
  <button class="control-btn fullscreen-btn" data-tooltip="fullscreen">
473
- <span class="icon fullscreen-icon">⛶</span>
474
- <span class="icon exit-fullscreen-icon hidden">⛉</span>
518
+ <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>
519
+ <span class="icon exit-fullscreen-icon hidden"><svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M5.5 0a.5.5 0 0 1 .5.5v4A1.5 1.5 0 0 1 4.5 6h-4a.5.5 0 0 1 0-1h4a.5.5 0 0 0 .5-.5v-4a.5.5 0 0 1 .5-.5m5 0a.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 10 4.5v-4a.5.5 0 0 1 .5-.5M0 10.5a.5.5 0 0 1 .5-.5h4A1.5 1.5 0 0 1 6 11.5v4a.5.5 0 0 1-1 0v-4a.5.5 0 0 0-.5-.5h-4a.5.5 0 0 1-.5-.5m10 1a1.5 1.5 0 0 1 1.5-1.5h4a.5.5 0 0 1 0 1h-4a.5.5 0 0 0-.5.5v4a.5.5 0 0 1-1 0z"/></svg></span>
475
520
  </button>
476
521
  ` : ''}
477
522
  </div>
package/src/core.js CHANGED
@@ -29,6 +29,8 @@ constructor(videoElement, options = {}) {
29
29
  videoTitle: '', // Title text to show in overlay
30
30
  videoSubtitle: '', // Subtitle text to show in overlay
31
31
  persistentTitle: false, // If true, title overlay stays visible
32
+ controlBarOpacity: options.controlBarOpacity !== undefined ? options.controlBarOpacity : 0.95, // Opacity of control bar (0.0 to 1.0)
33
+ titleOverlayOpacity: options.titleOverlayOpacity !== undefined ? options.titleOverlayOpacity : 0.95, // Opacity of title overlay (0.0 to 1.0)
32
34
  debug: false, // Enable/disable debug logging
33
35
  autoplay: false, // if video should autoplay at start
34
36
  defaultQuality: 'auto', // 'auto', '1080p', '720p', '480p', etc.
@@ -169,7 +171,9 @@ constructor(videoElement, options = {}) {
169
171
  };
170
172
 
171
173
  this.lastTimeUpdate = 0; // For throttling timeupdate events
172
-
174
+ // Inject default styles
175
+ this.injectDefaultControlbarStyles();
176
+ // Set language if specified
173
177
  if (this.options.language && this.isI18nAvailable()) {
174
178
  VideoPlayerTranslations.setLanguage(this.options.language);
175
179
  }
package/src/events.js CHANGED
@@ -171,6 +171,13 @@
171
171
  this.video.addEventListener('playing', () => {
172
172
  this.hideLoading();
173
173
  this.closeAllMenus();
174
+
175
+ // Update play/pause button when video actually starts playing
176
+ if (this.playIcon && this.pauseIcon) {
177
+ this.playIcon.classList.add('hidden');
178
+ this.pauseIcon.classList.remove('hidden');
179
+ }
180
+
174
181
  // Trigger playing event - video is now actually playing
175
182
  this.triggerEvent('playing', {
176
183
  currentTime: this.getCurrentTime(),
@@ -379,17 +386,91 @@
379
386
  this.pipBtn.addEventListener('click', () => this.togglePictureInPicture());
380
387
  }
381
388
 
382
- if (this.subtitlesBtn) {
383
- this.subtitlesBtn.addEventListener('click', () => this.toggleSubtitles());
384
- }
389
+ if (this.volumeSlider) {
390
+ let isDraggingVolume = false;
385
391
 
386
- if (this.volumeSlider) {
387
- this.volumeSlider.addEventListener('input', (e) => {
388
- this.updateVolume(e.target.value);
392
+ // Input event
393
+ this.volumeSlider.addEventListener('input', (e) => {
394
+ this.updateVolume(e.target.value);
395
+ this.updateVolumeSliderVisual();
396
+ this.initVolumeTooltip();
397
+ });
398
+
399
+ // MOUSE DRAG - Start
400
+ this.volumeSlider.addEventListener('mousedown', (e) => {
401
+ isDraggingVolume = true;
402
+ if (this.volumeTooltip) {
403
+ this.volumeTooltip.classList.add('visible');
404
+ }
405
+ });
406
+
407
+ // MOUSE DRAG - Move
408
+ document.addEventListener('mousemove', (e) => {
409
+ if (isDraggingVolume && this.volumeSlider) {
410
+ const rect = this.volumeSlider.getBoundingClientRect();
411
+ const clickX = e.clientX - rect.left;
412
+ const percentage = Math.max(0, Math.min(1, clickX / rect.width));
413
+ const value = Math.round(percentage * 100);
414
+
415
+ this.volumeSlider.value = value;
416
+ this.updateVolume(value);
389
417
  this.updateVolumeSliderVisual();
390
- this.initVolumeTooltip();
391
- });
392
- }
418
+ if (this.volumeTooltip) {
419
+ this.updateVolumeTooltipPosition(value / 100);
420
+ }
421
+ }
422
+ });
423
+
424
+ // MOUSE DRAG - End
425
+ document.addEventListener('mouseup', () => {
426
+ if (isDraggingVolume) {
427
+ isDraggingVolume = false;
428
+ if (this.volumeTooltip) {
429
+ setTimeout(() => {
430
+ this.volumeTooltip.classList.remove('visible');
431
+ }, 300);
432
+ }
433
+ }
434
+ });
435
+
436
+ // TOUCH DRAG - Start
437
+ this.volumeSlider.addEventListener('touchstart', (e) => {
438
+ isDraggingVolume = true;
439
+ if (this.volumeTooltip) {
440
+ this.volumeTooltip.classList.add('visible');
441
+ }
442
+ }, { passive: true });
443
+
444
+ // TOUCH DRAG - Move
445
+ this.volumeSlider.addEventListener('touchmove', (e) => {
446
+ if (isDraggingVolume) {
447
+ const touch = e.touches[0];
448
+ const rect = this.volumeSlider.getBoundingClientRect();
449
+ const touchX = touch.clientX - rect.left;
450
+ const percentage = Math.max(0, Math.min(1, touchX / rect.width));
451
+ const value = Math.round(percentage * 100);
452
+
453
+ this.volumeSlider.value = value;
454
+ this.updateVolume(value);
455
+ this.updateVolumeSliderVisual();
456
+ if (this.volumeTooltip) {
457
+ this.updateVolumeTooltipPosition(value / 100);
458
+ }
459
+ }
460
+ }, { passive: true });
461
+
462
+ // TOUCH DRAG - End
463
+ this.volumeSlider.addEventListener('touchend', () => {
464
+ if (isDraggingVolume) {
465
+ isDraggingVolume = false;
466
+ if (this.volumeTooltip) {
467
+ setTimeout(() => {
468
+ this.volumeTooltip.classList.remove('visible');
469
+ }, 300);
470
+ }
471
+ }
472
+ }, { passive: true });
473
+ }
393
474
 
394
475
  if (this.progressContainer) {
395
476
  // Mouse events (desktop)