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.
@@ -389,6 +389,8 @@ constructor(videoElement, options = {}) {
389
389
  videoTitle: '', // Title text to show in overlay
390
390
  videoSubtitle: '', // Subtitle text to show in overlay
391
391
  persistentTitle: false, // If true, title overlay stays visible
392
+ controlBarOpacity: options.controlBarOpacity !== undefined ? options.controlBarOpacity : 0.95, // Opacity of control bar (0.0 to 1.0)
393
+ titleOverlayOpacity: options.titleOverlayOpacity !== undefined ? options.titleOverlayOpacity : 0.95, // Opacity of title overlay (0.0 to 1.0)
392
394
  debug: false, // Enable/disable debug logging
393
395
  autoplay: false, // if video should autoplay at start
394
396
  defaultQuality: 'auto', // 'auto', '1080p', '720p', '480p', etc.
@@ -514,6 +516,8 @@ constructor(videoElement, options = {}) {
514
516
 
515
517
  this.lastTimeUpdate = 0; // For throttling timeupdate events
516
518
 
519
+ this.injectDefaultControlbarStyles();
520
+
517
521
  if (this.options.language && this.isI18nAvailable()) {
518
522
  VideoPlayerTranslations.setLanguage(this.options.language);
519
523
  }
@@ -2259,6 +2263,11 @@ addEventListener(eventType, callback) {
2259
2263
  this.hideLoading();
2260
2264
  this.closeAllMenus();
2261
2265
 
2266
+ if (this.playIcon && this.pauseIcon) {
2267
+ this.playIcon.classList.add('hidden');
2268
+ this.pauseIcon.classList.remove('hidden');
2269
+ }
2270
+
2262
2271
  this.triggerEvent('playing', {
2263
2272
  currentTime: this.getCurrentTime(),
2264
2273
  duration: this.getDuration()
@@ -2457,16 +2466,83 @@ addEventListener(eventType, callback) {
2457
2466
  this.pipBtn.addEventListener('click', () => this.togglePictureInPicture());
2458
2467
  }
2459
2468
 
2460
- if (this.subtitlesBtn) {
2461
- this.subtitlesBtn.addEventListener('click', () => this.toggleSubtitles());
2462
- }
2463
-
2464
2469
  if (this.volumeSlider) {
2470
+ let isDraggingVolume = false;
2471
+
2465
2472
  this.volumeSlider.addEventListener('input', (e) => {
2466
2473
  this.updateVolume(e.target.value);
2467
2474
  this.updateVolumeSliderVisual();
2468
2475
  this.initVolumeTooltip();
2469
2476
  });
2477
+
2478
+ this.volumeSlider.addEventListener('mousedown', (e) => {
2479
+ isDraggingVolume = true;
2480
+ if (this.volumeTooltip) {
2481
+ this.volumeTooltip.classList.add('visible');
2482
+ }
2483
+ });
2484
+
2485
+ document.addEventListener('mousemove', (e) => {
2486
+ if (isDraggingVolume && this.volumeSlider) {
2487
+ const rect = this.volumeSlider.getBoundingClientRect();
2488
+ const clickX = e.clientX - rect.left;
2489
+ const percentage = Math.max(0, Math.min(1, clickX / rect.width));
2490
+ const value = Math.round(percentage * 100);
2491
+
2492
+ this.volumeSlider.value = value;
2493
+ this.updateVolume(value);
2494
+ this.updateVolumeSliderVisual();
2495
+ if (this.volumeTooltip) {
2496
+ this.updateVolumeTooltipPosition(value / 100);
2497
+ }
2498
+ }
2499
+ });
2500
+
2501
+ document.addEventListener('mouseup', () => {
2502
+ if (isDraggingVolume) {
2503
+ isDraggingVolume = false;
2504
+ if (this.volumeTooltip) {
2505
+ setTimeout(() => {
2506
+ this.volumeTooltip.classList.remove('visible');
2507
+ }, 300);
2508
+ }
2509
+ }
2510
+ });
2511
+
2512
+ this.volumeSlider.addEventListener('touchstart', (e) => {
2513
+ isDraggingVolume = true;
2514
+ if (this.volumeTooltip) {
2515
+ this.volumeTooltip.classList.add('visible');
2516
+ }
2517
+ }, { passive: true });
2518
+
2519
+ this.volumeSlider.addEventListener('touchmove', (e) => {
2520
+ if (isDraggingVolume) {
2521
+ const touch = e.touches[0];
2522
+ const rect = this.volumeSlider.getBoundingClientRect();
2523
+ const touchX = touch.clientX - rect.left;
2524
+ const percentage = Math.max(0, Math.min(1, touchX / rect.width));
2525
+ const value = Math.round(percentage * 100);
2526
+
2527
+ this.volumeSlider.value = value;
2528
+ this.updateVolume(value);
2529
+ this.updateVolumeSliderVisual();
2530
+ if (this.volumeTooltip) {
2531
+ this.updateVolumeTooltipPosition(value / 100);
2532
+ }
2533
+ }
2534
+ }, { passive: true });
2535
+
2536
+ this.volumeSlider.addEventListener('touchend', () => {
2537
+ if (isDraggingVolume) {
2538
+ isDraggingVolume = false;
2539
+ if (this.volumeTooltip) {
2540
+ setTimeout(() => {
2541
+ this.volumeTooltip.classList.remove('visible');
2542
+ }, 300);
2543
+ }
2544
+ }
2545
+ }, { passive: true });
2470
2546
  }
2471
2547
 
2472
2548
  if (this.progressContainer) {
@@ -2734,6 +2810,51 @@ clearControlsTimeout() {
2734
2810
  }
2735
2811
  }
2736
2812
 
2813
+ injectDefaultControlbarStyles() {
2814
+ if (document.getElementById('default-controlbar-styles')) {
2815
+ return;
2816
+ }
2817
+
2818
+ const controlBarOpacity = Math.max(0, Math.min(1, this.options.controlBarOpacity));
2819
+ const titleOverlayOpacity = Math.max(0, Math.min(1, this.options.titleOverlayOpacity));
2820
+
2821
+ const style = document.createElement('style');
2822
+ style.id = 'default-controlbar-styles';
2823
+ style.textContent = `
2824
+ .video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .controls {
2825
+ background: linear-gradient(
2826
+ to top,
2827
+ rgba(0, 0, 0, ${controlBarOpacity}) 0%,
2828
+ rgba(0, 0, 0, ${controlBarOpacity * 0.89}) 20%,
2829
+ rgba(0, 0, 0, ${controlBarOpacity * 0.74}) 40%,
2830
+ rgba(0, 0, 0, ${controlBarOpacity * 0.53}) 60%,
2831
+ rgba(0, 0, 0, ${controlBarOpacity * 0.32}) 80%,
2832
+ rgba(0, 0, 0, ${controlBarOpacity * 0.21}) 100%
2833
+ );
2834
+ backdrop-filter: blur(3px);
2835
+ min-height: 60px;
2836
+ padding-bottom: 10px;
2837
+ }
2838
+
2839
+ .video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .title-overlay {
2840
+ background: linear-gradient(
2841
+ to bottom,
2842
+ rgba(0, 0, 0, ${titleOverlayOpacity}) 0%,
2843
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.89}) 20%,
2844
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.74}) 40%,
2845
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.53}) 60%,
2846
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.32}) 80%,
2847
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.21}) 100%
2848
+ );
2849
+ backdrop-filter: blur(3px);
2850
+ min-height: 80px;
2851
+ padding-top: 20px;
2852
+ }
2853
+ `;
2854
+
2855
+ document.head.appendChild(style);
2856
+ }
2857
+
2737
2858
  enableAutoHideDebug() {
2738
2859
  this.autoHideDebug = true;
2739
2860
  if (this.options.debug) console.log('AUTO-HIDE DEBUG ENABLED');
@@ -2878,20 +2999,20 @@ createControls() {
2878
2999
  <div class="progress-buffer"></div>
2879
3000
  <div class="progress-filled"></div>
2880
3001
  </div>
2881
- <div class="progress-handle progress-handle-${this.options.seekHandleShape}"></div> <!-- ✅ Fuori da progress-bar -->
3002
+ <div class="progress-handle progress-handle-${this.options.seekHandleShape}"></div>
2882
3003
  ${this.options.showSeekTooltip ? '<div class="seek-tooltip">0:00</div>' : ''}
2883
3004
  </div>
2884
3005
 
2885
3006
  <div class="controls-main">
2886
3007
  <div class="controls-left">
2887
3008
  <button class="control-btn play-pause-btn" data-tooltip="play_pause">
2888
- <span class="icon play-icon">▶</span>
2889
- <span class="icon pause-icon hidden">⏸</span>
3009
+ <span class="icon play-icon"><svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M8 5v14l11-7z"/></svg></span>
3010
+ <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>
2890
3011
  </button>
2891
3012
 
2892
3013
  <button class="control-btn mute-btn" data-tooltip="mute_unmute">
2893
- <span class="icon volume-icon">🔊</span>
2894
- <span class="icon mute-icon hidden">🔇</span>
3014
+ <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>
3015
+ <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>
2895
3016
  </button>
2896
3017
 
2897
3018
  <div class="volume-container" data-mobile-slider="${this.options.volumeSlider}">
@@ -2906,18 +3027,17 @@ createControls() {
2906
3027
  </div>
2907
3028
 
2908
3029
  <div class="controls-right">
2909
- <button class="control-btn playlist-prev-btn" data-tooltip="prevvideo" style="display: none;">
2910
- <span class="icon">⏮</span>
2911
- </button>
2912
-
2913
- <button class="control-btn playlist-next-btn" data-tooltip="nextvideo" style="display: none;">
2914
- <span class="icon">⏭</span>
2915
- </button>
3030
+ <button class="control-btn playlist-prev-btn" data-tooltip="prevvideo" style="display: none;">
3031
+ <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>
3032
+ </button>
3033
+ <button class="control-btn playlist-next-btn" data-tooltip="nextvideo" style="display: none;">
3034
+ <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
+ </button>
2916
3036
 
2917
3037
  ${this.options.showSubtitles ? `
2918
3038
  <div class="subtitles-control" style="display: none;">
2919
3039
  <button class="control-btn subtitles-btn" data-tooltip="subtitles">
2920
- <span class="icon">CC</span>
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>
2921
3041
  </button>
2922
3042
  <div class="subtitles-menu">
2923
3043
  <div class="subtitles-option active" data-track="off">Off</div>
@@ -2958,22 +3078,22 @@ createControls() {
2958
3078
 
2959
3079
  ${this.options.showPictureInPicture && this.isPiPSupported ? `
2960
3080
  <button class="control-btn pip-btn" data-tooltip="picture_in_picture">
2961
- <span class="icon pip-icon">⧉</span>
2962
- <span class="icon pip-exit-icon hidden">⧉</span>
3081
+ <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>
3082
+ <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>
2963
3083
  </button>
2964
3084
  ` : ''}
2965
3085
 
2966
3086
  <div class="settings-control">
2967
3087
  <button class="control-btn settings-btn" data-tooltip="settings_menu">
2968
- <span class="">⚙</span>
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>
2969
3089
  </button>
2970
3090
  <div class="settings-menu"></div>
2971
3091
  </div>
2972
3092
 
2973
3093
  ${this.options.showFullscreen ? `
2974
3094
  <button class="control-btn fullscreen-btn" data-tooltip="fullscreen">
2975
- <span class="icon fullscreen-icon">⛶</span>
2976
- <span class="icon exit-fullscreen-icon hidden">⛉</span>
3095
+ <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>
3096
+ <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>
2977
3097
  </button>
2978
3098
  ` : ''}
2979
3099
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myetv-player",
3
- "version": "1.1.5",
3
+ "version": "1.2.0",
4
4
  "description": "MYETV Video Player - Modular JavaScript and SCSS Build System",
5
5
  "main": "dist/myetv-player.js",
6
6
  "scripts": {
@@ -38,3 +38,5 @@
38
38
 
39
39
 
40
40
 
41
+
42
+
@@ -119,6 +119,9 @@ const player = new MYETVPlayer('myVideo', {
119
119
  showCaptions: true, // Show captions if available
120
120
 
121
121
  // ========== Plugin Options ==========
122
+ showNativeControlsButton: true, // Show the button on the controlbar to enable the Facebook native controls temporarily
123
+ controlBarOpacity: 0.95, // The controlbar opacity or semi-transparency or transparency - values: from 0 to 1
124
+ titleOverlayOpacity: 0.95, // The overlay title opacity or semi-transparency or transparency - values: from 0 to 1
122
125
  debug: false, // Enable debug logging
123
126
  replaceNativePlayer: true, // Replace native video element
124
127
  autoLoadFromData: true // Auto-detect from data attributes