myetv-player 1.1.5 → 1.1.6

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.
package/README.md CHANGED
@@ -116,6 +116,8 @@ const player = new MYETVvideoplayer('my-video', {
116
116
  | `videoTitle` | string | `''` | Title to show in overlay |
117
117
  | `videoSubtitle` | string | `''` | Sub-Title to show in overlay |
118
118
  | `persistentTitle` | boolean | `false` | Keep title always visible |
119
+ | `titleOverlayOpacity` | number | `'0.95'` | Overlay title opacity, values are from 0.00 to 1.00 |
120
+ | `controlBarOpacity ` | number | `'0.95'` | Controlbar opacity, values are from 0.00 to 1.00 |
119
121
  | `language` | string | `en` | Interface language code |
120
122
  | `brandLogoEnabled` | boolean | `false` | Show/hide the brand logo in the controlbar |
121
123
  | `brandLogoUrl` | string | `''` | Brand logo url in the controlbar (png, jpg, gif) - image height 44px - image width 120px |
@@ -425,6 +425,8 @@ constructor(videoElement, options = {}) {
425
425
  videoTitle: '', // Title text to show in overlay
426
426
  videoSubtitle: '', // Subtitle text to show in overlay
427
427
  persistentTitle: false, // If true, title overlay stays visible
428
+ controlBarOpacity: options.controlBarOpacity !== undefined ? options.controlBarOpacity : 0.95, // Opacity of control bar (0.0 to 1.0)
429
+ titleOverlayOpacity: options.titleOverlayOpacity !== undefined ? options.titleOverlayOpacity : 0.95, // Opacity of title overlay (0.0 to 1.0)
428
430
  debug: false, // Enable/disable debug logging
429
431
  autoplay: false, // if video should autoplay at start
430
432
  defaultQuality: 'auto', // 'auto', '1080p', '720p', '480p', etc.
@@ -565,7 +567,9 @@ constructor(videoElement, options = {}) {
565
567
  };
566
568
 
567
569
  this.lastTimeUpdate = 0; // For throttling timeupdate events
568
-
570
+ // Inject default styles
571
+ this.injectDefaultControlbarStyles();
572
+ // Set language if specified
569
573
  if (this.options.language && this.isI18nAvailable()) {
570
574
  VideoPlayerTranslations.setLanguage(this.options.language);
571
575
  }
@@ -2990,6 +2994,52 @@ clearControlsTimeout() {
2990
2994
  }
2991
2995
  }
2992
2996
 
2997
+ // Default controlbar styles injection
2998
+ injectDefaultControlbarStyles() {
2999
+ if (document.getElementById('default-controlbar-styles')) {
3000
+ return;
3001
+ }
3002
+
3003
+ const controlBarOpacity = Math.max(0, Math.min(1, this.options.controlBarOpacity));
3004
+ const titleOverlayOpacity = Math.max(0, Math.min(1, this.options.titleOverlayOpacity));
3005
+
3006
+ const style = document.createElement('style');
3007
+ style.id = 'default-controlbar-styles';
3008
+ style.textContent = `
3009
+ .video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .controls {
3010
+ background: linear-gradient(
3011
+ to top,
3012
+ rgba(0, 0, 0, ${controlBarOpacity}) 0%,
3013
+ rgba(0, 0, 0, ${controlBarOpacity * 0.89}) 20%,
3014
+ rgba(0, 0, 0, ${controlBarOpacity * 0.74}) 40%,
3015
+ rgba(0, 0, 0, ${controlBarOpacity * 0.53}) 60%,
3016
+ rgba(0, 0, 0, ${controlBarOpacity * 0.32}) 80%,
3017
+ rgba(0, 0, 0, ${controlBarOpacity * 0.21}) 100%
3018
+ );
3019
+ backdrop-filter: blur(3px);
3020
+ min-height: 60px;
3021
+ padding-bottom: 10px;
3022
+ }
3023
+
3024
+ .video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .title-overlay {
3025
+ background: linear-gradient(
3026
+ to bottom,
3027
+ rgba(0, 0, 0, ${titleOverlayOpacity}) 0%,
3028
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.89}) 20%,
3029
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.74}) 40%,
3030
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.53}) 60%,
3031
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.32}) 80%,
3032
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.21}) 100%
3033
+ );
3034
+ backdrop-filter: blur(3px);
3035
+ min-height: 80px;
3036
+ padding-top: 20px;
3037
+ }
3038
+ `;
3039
+
3040
+ document.head.appendChild(style);
3041
+ }
3042
+
2993
3043
  // Debug methods
2994
3044
  enableAutoHideDebug() {
2995
3045
  this.autoHideDebug = true;
@@ -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
  }
@@ -2734,6 +2738,51 @@ clearControlsTimeout() {
2734
2738
  }
2735
2739
  }
2736
2740
 
2741
+ injectDefaultControlbarStyles() {
2742
+ if (document.getElementById('default-controlbar-styles')) {
2743
+ return;
2744
+ }
2745
+
2746
+ const controlBarOpacity = Math.max(0, Math.min(1, this.options.controlBarOpacity));
2747
+ const titleOverlayOpacity = Math.max(0, Math.min(1, this.options.titleOverlayOpacity));
2748
+
2749
+ const style = document.createElement('style');
2750
+ style.id = 'default-controlbar-styles';
2751
+ style.textContent = `
2752
+ .video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .controls {
2753
+ background: linear-gradient(
2754
+ to top,
2755
+ rgba(0, 0, 0, ${controlBarOpacity}) 0%,
2756
+ rgba(0, 0, 0, ${controlBarOpacity * 0.89}) 20%,
2757
+ rgba(0, 0, 0, ${controlBarOpacity * 0.74}) 40%,
2758
+ rgba(0, 0, 0, ${controlBarOpacity * 0.53}) 60%,
2759
+ rgba(0, 0, 0, ${controlBarOpacity * 0.32}) 80%,
2760
+ rgba(0, 0, 0, ${controlBarOpacity * 0.21}) 100%
2761
+ );
2762
+ backdrop-filter: blur(3px);
2763
+ min-height: 60px;
2764
+ padding-bottom: 10px;
2765
+ }
2766
+
2767
+ .video-wrapper:not(.youtube-active):not(.vimeo-active):not(.facebook-active) .title-overlay {
2768
+ background: linear-gradient(
2769
+ to bottom,
2770
+ rgba(0, 0, 0, ${titleOverlayOpacity}) 0%,
2771
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.89}) 20%,
2772
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.74}) 40%,
2773
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.53}) 60%,
2774
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.32}) 80%,
2775
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.21}) 100%
2776
+ );
2777
+ backdrop-filter: blur(3px);
2778
+ min-height: 80px;
2779
+ padding-top: 20px;
2780
+ }
2781
+ `;
2782
+
2783
+ document.head.appendChild(style);
2784
+ }
2785
+
2737
2786
  enableAutoHideDebug() {
2738
2787
  this.autoHideDebug = true;
2739
2788
  if (this.options.debug) console.log('AUTO-HIDE DEBUG ENABLED');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myetv-player",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
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,4 @@
38
38
 
39
39
 
40
40
 
41
+
@@ -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
@@ -24,6 +24,13 @@
24
24
  showText: options.showText !== false,
25
25
  showCaptions: options.showCaptions !== false,
26
26
  // Plugin options
27
+ showNativeControlsButton: options.showNativeControlsButton !== undefined ? options.showNativeControlsButton : true,
28
+ controlBarOpacity: options.controlBarOpacity !== undefined
29
+ ? options.controlBarOpacity
30
+ : (player.options.controlBarOpacity !== undefined ? player.options.controlBarOpacity : 0.95),
31
+ titleOverlayOpacity: options.titleOverlayOpacity !== undefined
32
+ ? options.titleOverlayOpacity
33
+ : (player.options.titleOverlayOpacity !== undefined ? player.options.titleOverlayOpacity : 0.95),
27
34
  debug: options.debug || false,
28
35
  replaceNativePlayer: options.replaceNativePlayer !== false,
29
36
  autoLoadFromData: options.autoLoadFromData !== false,
@@ -456,9 +463,15 @@
456
463
  }
457
464
  }
458
465
 
466
+ // Create Facebook controls button
467
+ this.createFacebookControlsButton();
468
+
459
469
  // Setup event listeners
460
470
  this.setupEventListeners();
461
471
 
472
+ // inject controlbar gradient styles
473
+ this.injectControlbarGradientStyles();
474
+
462
475
  // Start time update
463
476
  this.startTimeUpdate();
464
477
 
@@ -724,12 +737,29 @@
724
737
  // Started playing - marks successful user interaction
725
738
  this.fbPlayer.subscribe('startedPlaying', () => {
726
739
  if (this.api.player.options.debug) {
727
- console.log('FB Plugin: Video started playing');
740
+ console.log('🎬 FB Plugin: Video started playing');
728
741
  }
742
+
729
743
  this.isPlaying = true;
730
744
  this.userHasInteracted = true; // Video playing = user clicked FB player
731
745
  this.waitingForUserClick = false;
732
746
 
747
+ // Rimuovi classe paused
748
+ if (this.player.container) {
749
+ this.player.container.classList.remove('video-paused');
750
+ }
751
+
752
+ // Riattiva l'auto-hide quando riprende la riproduzione
753
+ if (this.player.options.autoHide && this.player.autoHideInitialized) {
754
+ if (this.player.resetAutoHideTimer) {
755
+ this.player.resetAutoHideTimer();
756
+ }
757
+
758
+ if (this.options.debug) {
759
+ console.log('🎬 FB Plugin: Video playing - auto-hide reactivated');
760
+ }
761
+ }
762
+
733
763
  // Update play/pause icons
734
764
  const playIcon = this.api.container.querySelector('.play-icon');
735
765
  const pauseIcon = this.api.container.querySelector('.pause-icon');
@@ -740,7 +770,6 @@
740
770
  currentTime: this.getCurrentTime(),
741
771
  duration: this.getDuration()
742
772
  });
743
-
744
773
  this.api.triggerEvent('play', {});
745
774
  this.api.triggerEvent('playing', {});
746
775
  this.hideLoadingOverlay();
@@ -749,10 +778,47 @@
749
778
  // Paused
750
779
  this.fbPlayer.subscribe('paused', () => {
751
780
  if (this.api.player.options.debug) {
752
- console.log('FB Plugin: Video paused');
781
+ console.log('🎬 FB Plugin: Video paused');
753
782
  }
783
+
754
784
  this.isPlaying = false;
755
785
 
786
+ // Aggiungi classe per identificare lo stato di pausa
787
+ if (this.player.container) {
788
+ this.player.container.classList.add('video-paused');
789
+ }
790
+
791
+ // Mantieni la controlbar visibile SOLO se autoHide è abilitato
792
+ if (this.player.options.autoHide && this.player.autoHideInitialized) {
793
+ // Mostra controlli
794
+ if (this.player.controls) {
795
+ this.player.controls.classList.add('show');
796
+ }
797
+
798
+ // Mostra anche il title overlay se è abilitato e non è persistent
799
+ if (this.player.options.showTitleOverlay &&
800
+ !this.player.options.persistentTitle &&
801
+ this.player.titleOverlay) {
802
+ this.player.titleOverlay.classList.add('show');
803
+ }
804
+
805
+ // Cancella il timer di auto-hide
806
+ if (this.player.autoHideTimer) {
807
+ clearTimeout(this.player.autoHideTimer);
808
+ this.player.autoHideTimer = null;
809
+ }
810
+
811
+ // Cancella anche il timer del title overlay
812
+ if (this.player.titleTimeout) {
813
+ clearTimeout(this.player.titleTimeout);
814
+ this.player.titleTimeout = null;
815
+ }
816
+
817
+ if (this.options.debug) {
818
+ console.log('🎬 FB Plugin: Video paused - controls and title locked visible');
819
+ }
820
+ }
821
+
756
822
  // Update play/pause icons
757
823
  const playIcon = this.api.container.querySelector('.play-icon');
758
824
  const pauseIcon = this.api.container.querySelector('.pause-icon');
@@ -763,15 +829,15 @@
763
829
  currentTime: this.getCurrentTime(),
764
830
  duration: this.getDuration()
765
831
  });
766
-
767
832
  this.api.triggerEvent('pause', {});
768
833
  });
769
834
 
770
835
  // Finished playing
771
836
  this.fbPlayer.subscribe('finishedPlaying', () => {
772
837
  if (this.api.player.options.debug) {
773
- console.log('FB Plugin: Video finished');
838
+ console.log('🎬 FB Plugin: Video finished');
774
839
  }
840
+
775
841
  this.isPlaying = false;
776
842
 
777
843
  // Update play/pause icons
@@ -789,7 +855,7 @@
789
855
  // Started buffering
790
856
  this.fbPlayer.subscribe('startedBuffering', () => {
791
857
  if (this.api.player.options.debug) {
792
- console.log('FB Plugin: Video buffering started');
858
+ console.log('🎬 FB Plugin: Video buffering started');
793
859
  }
794
860
  this.api.triggerEvent('waiting', {});
795
861
  this.showLoadingOverlay();
@@ -798,7 +864,7 @@
798
864
  // Finished buffering
799
865
  this.fbPlayer.subscribe('finishedBuffering', () => {
800
866
  if (this.api.player.options.debug) {
801
- console.log('FB Plugin: Video buffering finished');
867
+ console.log('🎬 FB Plugin: Video buffering finished');
802
868
  }
803
869
  this.api.triggerEvent('canplay', {});
804
870
  this.hideLoadingOverlay();
@@ -806,13 +872,13 @@
806
872
 
807
873
  // Error
808
874
  this.fbPlayer.subscribe('error', (error) => {
809
- console.error('FB Plugin: Facebook player error:', error);
875
+ console.error('🎬 FB Plugin: Facebook player error:', error);
810
876
  this.api.triggerEvent('error', error);
811
877
  this.api.triggerEvent('facebookplugin:error', error);
812
878
  });
813
879
 
814
880
  if (this.api.player.options.debug) {
815
- console.log('FB Plugin: Event listeners setup completed');
881
+ console.log('🎬 FB Plugin: Event listeners setup completed');
816
882
  }
817
883
  }
818
884
 
@@ -824,7 +890,6 @@
824
890
  this.timeUpdateInterval = setInterval(() => {
825
891
  if (this.fbPlayer && this.fbPlayer.getCurrentPosition !== undefined && this.fbPlayer.getDuration !== undefined) {
826
892
  try {
827
- // CRITICAL FIX: These are properties, not methods
828
893
  const currentTime = this.fbPlayer.getCurrentPosition();
829
894
  const duration = this.fbPlayer.getDuration();
830
895
 
@@ -852,13 +917,10 @@
852
917
  // Create tooltip if it doesn't exist
853
918
  this.createProgressTooltip();
854
919
 
855
- // CRITICAL: Update progress bar tooltip with current duration
920
+ // Update progress bar tooltip with current duration
856
921
  this.updateProgressTooltip(duration);
857
922
  }
858
923
 
859
- // REMOVED: Volume monitoring - Facebook API doesn't have volume events
860
- // Volume is only updated via setupVolumeSlider() when user changes it
861
-
862
924
  } catch (error) {
863
925
  // Ignore timing errors
864
926
  }
@@ -867,7 +929,84 @@
867
929
  }
868
930
 
869
931
  /**
870
- * CRITICAL: Update progress bar tooltip with correct time
932
+ * Inject CSS styles for controlbar and title overlay gradients
933
+ * Uses Facebook-specific selectors to avoid conflicts with other plugins
934
+ */
935
+ injectControlbarGradientStyles() {
936
+ // Check if styles are already injected
937
+ if (document.getElementById('facebook-controlbar-gradient-styles')) {
938
+ return;
939
+ }
940
+
941
+ // Validate opacity values (must be between 0 and 1)
942
+ const controlBarOpacity = Math.max(0, Math.min(1, this.options.controlBarOpacity));
943
+ const titleOverlayOpacity = Math.max(0, Math.min(1, this.options.titleOverlayOpacity));
944
+
945
+ // Create style element
946
+ const style = document.createElement('style');
947
+ style.id = 'facebook-controlbar-gradient-styles';
948
+
949
+ // CSS with Facebook-specific selectors to avoid conflicts
950
+ style.textContent = `
951
+ /* Controlbar gradient - dark opaque at bottom, semi-transparent at top */
952
+ /* ONLY applied when Facebook plugin is active */
953
+ .video-wrapper.facebook-active .controls {
954
+ background: linear-gradient(
955
+ to top,
956
+ rgba(0, 0, 0, ${controlBarOpacity}) 0%, /* Maximum opacity at bottom */
957
+ rgba(0, 0, 0, ${controlBarOpacity * 0.89}) 20%, /* 89% of max opacity */
958
+ rgba(0, 0, 0, ${controlBarOpacity * 0.74}) 40%, /* 74% */
959
+ rgba(0, 0, 0, ${controlBarOpacity * 0.53}) 60%, /* 53% */
960
+ rgba(0, 0, 0, ${controlBarOpacity * 0.32}) 80%, /* 32% */
961
+ rgba(0, 0, 0, ${controlBarOpacity * 0.21}) 100% /* 21% at top */
962
+ ) !important;
963
+ backdrop-filter: blur(3px);
964
+ min-height: 60px;
965
+ padding-bottom: 10px;
966
+ }
967
+
968
+ /* Title overlay gradient - dark opaque at top, semi-transparent at bottom */
969
+ /* ONLY applied when Facebook plugin is active */
970
+ .video-wrapper.facebook-active .title-overlay {
971
+ background: linear-gradient(
972
+ to bottom,
973
+ rgba(0, 0, 0, ${titleOverlayOpacity}) 0%, /* Maximum opacity at top */
974
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.89}) 20%, /* 89% of max opacity */
975
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.74}) 40%, /* 74% */
976
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.53}) 60%, /* 53% */
977
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.32}) 80%, /* 32% */
978
+ rgba(0, 0, 0, ${titleOverlayOpacity * 0.21}) 100% /* 21% at bottom */
979
+ ) !important;
980
+ backdrop-filter: blur(3px);
981
+ min-height: 80px;
982
+ padding-top: 20px;
983
+ }
984
+
985
+ /* Keep controlbar visible when video is paused */
986
+ .video-wrapper.facebook-active.video-paused .controls.show {
987
+ opacity: 1 !important;
988
+ visibility: visible !important;
989
+ }
990
+
991
+ /* Keep title overlay visible when video is paused */
992
+ .video-wrapper.facebook-active.video-paused .title-overlay.show {
993
+ opacity: 1 !important;
994
+ visibility: visible !important;
995
+ }
996
+ `;
997
+
998
+ // Append style to document head
999
+ document.head.appendChild(style);
1000
+
1001
+ // Debug logging
1002
+ if (this.options.debug) {
1003
+ console.log('🎬 Facebook Plugin: Controlbar and title overlay gradient styles injected');
1004
+ console.log(`🎬 Facebook Plugin: ControlBar opacity: ${controlBarOpacity}, TitleOverlay opacity: ${titleOverlayOpacity}`);
1005
+ }
1006
+ }
1007
+
1008
+ /**
1009
+ * Update progress bar tooltip with correct time
871
1010
  */
872
1011
  updateProgressTooltip() {
873
1012
  const progContainer = this.api.container.querySelector('.progress-container');
@@ -908,8 +1047,8 @@
908
1047
  }
909
1048
 
910
1049
  /**
911
- * Create progress tooltip element if it doesn't exist
912
- */
1050
+ * Create progress tooltip element if it doesn't exist
1051
+ */
913
1052
  createProgressTooltip() {
914
1053
  const progContainer = this.api.container.querySelector('.progress-container');
915
1054
  if (!progContainer) return;
@@ -1259,6 +1398,127 @@
1259
1398
 
1260
1399
  }
1261
1400
 
1401
+ // Create button to show Facebook native controls
1402
+ createFacebookControlsButton() {
1403
+ // Verify option enabled
1404
+ if (!this.options.showNativeControlsButton) {
1405
+ if (this.options.debug) {
1406
+ console.log('🎬 FB Plugin: Native controls button disabled by option');
1407
+ }
1408
+ return;
1409
+ }
1410
+
1411
+ // Check if button already exists
1412
+ if (this.player.container.querySelector('.facebook-controls-btn')) {
1413
+ return;
1414
+ }
1415
+
1416
+ const controlsRight = this.player.container.querySelector('.controls-right');
1417
+ if (!controlsRight) return;
1418
+
1419
+ const buttonHTML = `
1420
+ <button class="control-btn facebook-controls-btn" title="Show Facebook Controls">
1421
+ <svg viewBox="0 0 24 24" fill="currentColor" width="24" height="24">
1422
+ <path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/>
1423
+ </svg>
1424
+ </button>
1425
+ `;
1426
+
1427
+ // Insert before quality control
1428
+ const qualityControl = controlsRight.querySelector('.quality-control');
1429
+ if (qualityControl) {
1430
+ qualityControl.insertAdjacentHTML('beforebegin', buttonHTML);
1431
+ } else {
1432
+ const fullscreenBtn = controlsRight.querySelector('.fullscreen-btn');
1433
+ if (fullscreenBtn) {
1434
+ fullscreenBtn.insertAdjacentHTML('beforebegin', buttonHTML);
1435
+ } else {
1436
+ controlsRight.insertAdjacentHTML('beforeend', buttonHTML);
1437
+ }
1438
+ }
1439
+
1440
+ // Add click listener
1441
+ const btn = this.player.container.querySelector('.facebook-controls-btn');
1442
+ if (btn) {
1443
+ btn.addEventListener('click', () => {
1444
+ if (this.options.debug) {
1445
+ console.log('🎬 FB Plugin: Native controls button clicked');
1446
+ }
1447
+ this.showFacebookControls();
1448
+ });
1449
+
1450
+ // Add custom styling (Facebook blue color)
1451
+ btn.style.color = '#1877f2';
1452
+
1453
+ if (this.options.debug) {
1454
+ console.log('🎬 FB Plugin: Native controls button created');
1455
+ }
1456
+ }
1457
+ }
1458
+
1459
+ // Show Facebook native controls
1460
+ showFacebookControls() {
1461
+ if (this.options.debug) {
1462
+ console.log('🎬 FB Plugin: Showing Facebook native controls');
1463
+ }
1464
+
1465
+ const iframe = this.player.container.querySelector('iframe');
1466
+ const controlbar = this.player.container.querySelector('.controls');
1467
+ const titleOverlay = this.player.container.querySelector('.title-overlay');
1468
+
1469
+ if (iframe) {
1470
+ // Bring iframe to front
1471
+ iframe.style.pointerEvents = 'auto';
1472
+ iframe.style.zIndex = '9999';
1473
+
1474
+ // Hide controlbar and title
1475
+ if (controlbar) controlbar.style.display = 'none';
1476
+ if (titleOverlay) titleOverlay.style.display = 'none';
1477
+
1478
+ // Auto-restore after 10 seconds
1479
+ this.facebookControlsTimeout = setTimeout(() => {
1480
+ if (this.options.debug) {
1481
+ console.log('🎬 FB Plugin: Restoring custom controls after 10 seconds');
1482
+ }
1483
+ this.hideFacebookControls();
1484
+ }, 10000);
1485
+ }
1486
+ }
1487
+
1488
+ // Hide Facebook native controls
1489
+ hideFacebookControls() {
1490
+ if (this.options.debug) {
1491
+ console.log('🎬 FB Plugin: Hiding Facebook native controls');
1492
+ }
1493
+
1494
+ // Clear timeout if exists
1495
+ if (this.facebookControlsTimeout) {
1496
+ clearTimeout(this.facebookControlsTimeout);
1497
+ this.facebookControlsTimeout = null;
1498
+ }
1499
+
1500
+ const iframe = this.player.container.querySelector('iframe');
1501
+ const controlbar = this.player.container.querySelector('.controls');
1502
+ const titleOverlay = this.player.container.querySelector('.title-overlay');
1503
+
1504
+ if (iframe) {
1505
+ // Disable clicks on Facebook controls
1506
+ iframe.style.pointerEvents = 'none';
1507
+ iframe.style.zIndex = '1';
1508
+
1509
+ // Restore controlbar and title
1510
+ if (controlbar) {
1511
+ controlbar.style.display = '';
1512
+ controlbar.style.zIndex = '10';
1513
+ }
1514
+ if (titleOverlay) titleOverlay.style.display = '';
1515
+
1516
+ if (this.options.debug) {
1517
+ console.log('🎬 FB Plugin: Custom controls restored');
1518
+ }
1519
+ }
1520
+ }
1521
+
1262
1522
  /**
1263
1523
  * CRITICAL: Setup volume slider event listeners
1264
1524
  */
@@ -1537,6 +1797,12 @@
1537
1797
  this.styleObserver = null;
1538
1798
  }
1539
1799
 
1800
+ // Clear Facebook controls timeout
1801
+ if (this.facebookControlsTimeout) {
1802
+ clearTimeout(this.facebookControlsTimeout);
1803
+ this.facebookControlsTimeout = null;
1804
+ }
1805
+
1540
1806
  if (this.fbPlayer) {
1541
1807
  this.fbPlayer = null;
1542
1808
  }
@@ -135,6 +135,9 @@ const player = new MYETVPlayer('myVideo', {
135
135
  transparent: true, // Transparent background
136
136
 
137
137
  // ========== Plugin Options ==========
138
+ showNativeControlsButton: true, // Show the button on the controlbar to enable the Vimeo native controls temporarily
139
+ controlBarOpacity: 0.95, // The controlbar opacity or semi-transparency or transparency - values: from 0 to 1
140
+ titleOverlayOpacity: 0.95, // The overlay title opacity or semi-transparency or transparency - values: from 0 to 1
138
141
  debug: false, // Enable debug logging
139
142
  replaceNativePlayer: true, // Replace native video element
140
143
  syncControls: true // Sync with custom controls