unified-video-framework 1.4.201 → 1.4.203

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.
@@ -365,6 +365,8 @@ export class WebPlayer extends BasePlayer {
365
365
  this.updateMetadataUI();
366
366
  }
367
367
 
368
+ private autoplayAttempted: boolean = false;
369
+
368
370
  private setupVideoEventListeners(): void {
369
371
  if (!this.video) return;
370
372
 
@@ -445,6 +447,24 @@ export class WebPlayer extends BasePlayer {
445
447
  this._deferredPause = false;
446
448
  try { this.video?.pause(); } catch (_) {}
447
449
  }
450
+
451
+ // Attempt autoplay once when video is ready to play
452
+ if (this.config.autoPlay && !this.autoplayAttempted) {
453
+ this.autoplayAttempted = true;
454
+ this.attemptIntelligentAutoplay().then(success => {
455
+ if (!success) {
456
+ this.debugWarn('❌ Intelligent autoplay failed, showing play overlay');
457
+ this.showPlayOverlay();
458
+ this.setupAutoplayRetry();
459
+ } else {
460
+ this.debugLog('✅ Intelligent autoplay succeeded');
461
+ }
462
+ }).catch(error => {
463
+ this.debugError('Autoplay failed:', error);
464
+ this.showPlayOverlay();
465
+ this.setupAutoplayRetry();
466
+ });
467
+ }
448
468
  });
449
469
 
450
470
  this.video.addEventListener('loadedmetadata', () => {
@@ -522,6 +542,9 @@ export class WebPlayer extends BasePlayer {
522
542
  this.source = source as any;
523
543
  this.subtitles = (source.subtitles || []) as any;
524
544
 
545
+ // Reset autoplay flag for new source
546
+ this.autoplayAttempted = false;
547
+
525
548
  // Clean up previous instances
526
549
  await this.cleanup();
527
550
 
@@ -617,25 +640,8 @@ export class WebPlayer extends BasePlayer {
617
640
 
618
641
  // Update settings menu with detected qualities
619
642
  this.updateSettingsMenu();
620
-
621
- // Start playback if autoPlay is enabled
622
- if (this.config.autoPlay) {
623
- // Use intelligent autoplay with capability detection
624
- this.attemptIntelligentAutoplay().then(success => {
625
- if (!success) {
626
- this.debugWarn('❌ Intelligent autoplay failed, showing play overlay');
627
- this.showPlayOverlay();
628
- // Set up retry on user interaction
629
- this.setupAutoplayRetry();
630
- } else {
631
- this.debugLog('✅ Intelligent autoplay succeeded');
632
- }
633
- }).catch(error => {
634
- this.debugError('HLS autoplay failed:', error);
635
- this.showPlayOverlay();
636
- this.setupAutoplayRetry();
637
- });
638
- }
643
+
644
+ // Note: Autoplay is now handled in the 'canplay' event when video is ready
639
645
  });
640
646
 
641
647
  this.hls.on(window.Hls.Events.LEVEL_SWITCHED, (event: any, data: any) => {
@@ -3976,58 +3982,18 @@ export class WebPlayer extends BasePlayer {
3976
3982
  }
3977
3983
  }
3978
3984
 
3979
- // .uvf-top-btn {
3980
- // width: 40px;
3981
- // height: 40px;
3982
- // background: rgba(255,255,255,0.1);
3983
- // backdrop-filter: blur(10px);
3984
- // border: 1px solid rgba(255,255,255,0.2);
3985
- // border-radius: 50%;
3986
- // cursor: pointer;
3987
- // display: flex;
3988
- // align-items: center;
3989
- // justify-content: center;
3990
- // transition: all 0.3s ease;
3991
- // }
3992
-
3993
- .uvf-top-btn:hover {
3994
- width: 40px;
3995
- height: 40px;
3996
- backdrop-filter: blur(10px);
3997
- border: 1px solid rgba(255,255,255,0.2);
3998
- border-radius: 50%;
3999
- background: rgba(255,255,255,0.2);
4000
- transform: scale(1.1);
4001
- box-shadow: 0 0 20px rgba(255,255,255,0.3);
4002
- cursor: pointer;
4003
- display: flex;
4004
- align-items: center;
4005
- justify-content: center;
4006
- transition: all 0.3s ease;
4007
- }
4008
3985
 
4009
- .uvf-top-btn.cast-grey {
4010
- width: 40px;
4011
- height: 40px;
3986
+ /* Cast button grey state when casting */
3987
+ .uvf-control-btn.cast-grey {
4012
3988
  opacity: 0.6;
4013
3989
  filter: grayscale(0.6);
4014
- box-shadow: none;
4015
- background: rgba(255,255,255,0.08);
4016
3990
  }
4017
- .uvf-top-btn.cast-grey:hover {
4018
- width: 40px;
4019
- height: 40px;
3991
+
3992
+ .uvf-control-btn.cast-grey:hover {
4020
3993
  transform: none;
4021
- background: rgba(255,255,255,0.12);
4022
- box-shadow: none;
3994
+ opacity: 0.7;
4023
3995
  }
4024
3996
 
4025
- .uvf-top-btn svg {
4026
- width: 20px;
4027
- height: 20px;
4028
- fill: var(--uvf-icon-color);
4029
- }
4030
-
4031
3997
  /* Pill-style button for prominent actions */
4032
3998
  .uvf-pill-btn {
4033
3999
  display: inline-flex;
@@ -4951,11 +4917,6 @@ export class WebPlayer extends BasePlayer {
4951
4917
  background: var(--uvf-overlay-medium);
4952
4918
  }
4953
4919
 
4954
- .uvf-top-btn:focus-visible {
4955
- outline: 2px solid var(--uvf-primary-color, #007bff);
4956
- outline-offset: 2px;
4957
- }
4958
-
4959
4920
  .uvf-progress-bar-wrapper:focus-visible {
4960
4921
  outline: 2px solid var(--uvf-primary-color, #007bff);
4961
4922
  outline-offset: 2px;
@@ -4991,10 +4952,6 @@ export class WebPlayer extends BasePlayer {
4991
4952
  border: 1px solid;
4992
4953
  }
4993
4954
 
4994
- // .uvf-top-btn {
4995
- // border: 1px solid;
4996
- // }
4997
-
4998
4955
  .uvf-progress-bar {
4999
4956
  border: 1px solid;
5000
4957
  }
@@ -5186,22 +5143,22 @@ export class WebPlayer extends BasePlayer {
5186
5143
  const topControls = document.createElement('div');
5187
5144
  topControls.className = 'uvf-top-controls';
5188
5145
  topControls.innerHTML = `
5189
- <div class="uvf-top-btn" id="uvf-cast-btn" title="Cast" aria-label="Cast">
5146
+ <button class="uvf-control-btn" id="uvf-cast-btn" title="Cast" aria-label="Cast">
5190
5147
  <svg viewBox="0 0 24 24">
5191
5148
  <path d="M1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19V7zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11zm20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/>
5192
5149
  </svg>
5193
- </div>
5150
+ </button>
5194
5151
  <button class="uvf-pill-btn uvf-stop-cast-btn" id="uvf-stop-cast-btn" title="Stop Casting" aria-label="Stop Casting" style="display: none;">
5195
5152
  <svg viewBox="0 0 24 24" aria-hidden="true">
5196
5153
  <path d="M6 6h12v12H6z"/>
5197
5154
  </svg>
5198
5155
  <span>Stop Casting</span>
5199
5156
  </button>
5200
- <div class="uvf-top-btn" id="uvf-share-btn" title="Share" aria-label="Share">
5157
+ <button class="uvf-control-btn" id="uvf-share-btn" title="Share" aria-label="Share">
5201
5158
  <svg viewBox="0 0 24 24">
5202
5159
  <path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"/>
5203
5160
  </svg>
5204
- </div>
5161
+ </button>
5205
5162
  `;
5206
5163
  topBar.appendChild(topControls);
5207
5164