unified-video-framework 1.4.250 → 1.4.251

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.
@@ -1122,6 +1122,11 @@ export class WebPlayer extends BasePlayer {
1122
1122
  // Create YouTube iframe player with custom controls integration
1123
1123
  await this.createYouTubePlayer(videoId);
1124
1124
 
1125
+ // Force another metadata update after player creation
1126
+ setTimeout(() => {
1127
+ this.updateMetadataUI();
1128
+ }, 1000);
1129
+
1125
1130
  this.debugLog('✅ YouTube video loaded successfully');
1126
1131
  this.debugLog('YouTube video title:', metadata.title);
1127
1132
  } catch (error) {
@@ -1249,6 +1254,12 @@ export class WebPlayer extends BasePlayer {
1249
1254
 
1250
1255
  // Extract available YouTube qualities
1251
1256
  this.extractYouTubeAvailableQualities();
1257
+
1258
+ // Update metadata UI and settings after player is ready
1259
+ setTimeout(() => {
1260
+ this.updateMetadataUI();
1261
+ this.updateSettingsMenu();
1262
+ }, 500);
1252
1263
  }
1253
1264
 
1254
1265
  // Start time tracking
@@ -1486,16 +1497,18 @@ export class WebPlayer extends BasePlayer {
1486
1497
 
1487
1498
  const percent = (currentTime / duration) * 100;
1488
1499
 
1489
- // Update progress filled
1500
+ // Update progress filled (only if not dragging)
1490
1501
  const progressFilled = document.getElementById('uvf-progress-filled') as HTMLElement;
1491
1502
  if (progressFilled && !this.isDragging) {
1492
1503
  progressFilled.style.width = percent + '%';
1493
1504
  }
1494
1505
 
1495
- // Update progress handle
1506
+ // Update progress handle (only if not dragging)
1496
1507
  const progressHandle = document.getElementById('uvf-progress-handle') as HTMLElement;
1497
1508
  if (progressHandle && !this.isDragging) {
1498
1509
  progressHandle.style.left = percent + '%';
1510
+ // Remove dragging class if it was set
1511
+ progressHandle.classList.remove('dragging');
1499
1512
  }
1500
1513
 
1501
1514
  // Update buffered progress
@@ -1504,8 +1517,13 @@ export class WebPlayer extends BasePlayer {
1504
1517
  progressBuffered.style.width = buffered + '%';
1505
1518
  }
1506
1519
 
1507
- // Update time display
1508
- this.updateTimeDisplay();
1520
+ // Update time display with YouTube-specific times
1521
+ const timeDisplay = document.getElementById('uvf-time-display');
1522
+ if (timeDisplay) {
1523
+ const currentTimeStr = this.formatTime(currentTime);
1524
+ const durationStr = this.formatTime(duration);
1525
+ timeDisplay.textContent = `${currentTimeStr} / ${durationStr}`;
1526
+ }
1509
1527
  }
1510
1528
 
1511
1529
 
@@ -8128,12 +8146,27 @@ export class WebPlayer extends BasePlayer {
8128
8146
  const progressBar = document.querySelector('.uvf-progress-bar') as HTMLElement;
8129
8147
  const progressFilled = document.getElementById('uvf-progress-filled') as HTMLElement;
8130
8148
  const progressHandle = document.getElementById('uvf-progress-handle') as HTMLElement;
8131
- if (!progressBar || !this.video) return;
8149
+ if (!progressBar) return;
8150
+
8151
+ // Get duration from appropriate source
8152
+ let duration = 0;
8153
+ if (this.youtubePlayer && this.youtubePlayerReady) {
8154
+ try {
8155
+ duration = this.youtubePlayer.getDuration() || 0;
8156
+ } catch (error) {
8157
+ this.debugWarn('Error getting YouTube duration for seeking:', error);
8158
+ return;
8159
+ }
8160
+ } else if (this.video) {
8161
+ duration = this.video.duration;
8162
+ } else {
8163
+ this.debugWarn('No video source available for seeking');
8164
+ return;
8165
+ }
8132
8166
 
8133
- const duration = this.video.duration;
8134
8167
  // Validate duration before calculating seek time
8135
8168
  if (!isFinite(duration) || isNaN(duration) || duration <= 0) {
8136
- this.debugWarn('Invalid video duration, cannot seek via progress bar');
8169
+ this.debugWarn('Invalid video duration, cannot seek via progress bar:', duration);
8137
8170
  return;
8138
8171
  }
8139
8172
 
@@ -8148,21 +8181,24 @@ export class WebPlayer extends BasePlayer {
8148
8181
  return;
8149
8182
  }
8150
8183
 
8184
+ this.debugLog('Seeking to position:', time, 'seconds (', Math.round(percent), '%)');
8185
+
8151
8186
  // Update UI immediately for responsive feedback
8152
- if (progressFilled) {
8187
+ if (progressFilled && !this.isDragging) {
8153
8188
  progressFilled.style.width = percent + '%';
8154
8189
  }
8155
- if (progressHandle) {
8190
+ if (progressHandle && !this.isDragging) {
8156
8191
  progressHandle.style.left = percent + '%';
8157
- // Add dragging class for visual feedback
8158
- if (this.isDragging) {
8159
- progressHandle.classList.add('dragging');
8160
- } else {
8161
- progressHandle.classList.remove('dragging');
8162
- }
8192
+ progressHandle.classList.add('dragging');
8163
8193
  }
8164
8194
 
8195
+ // Perform the actual seek
8165
8196
  this.seek(time);
8197
+
8198
+ // For YouTube, provide immediate visual feedback since API might be delayed
8199
+ if (this.youtubePlayer && this.youtubePlayerReady) {
8200
+ this.emit('onSeeking');
8201
+ }
8166
8202
  }
8167
8203
 
8168
8204
  private formatTime(seconds: number): string {
@@ -9196,6 +9232,13 @@ export class WebPlayer extends BasePlayer {
9196
9232
  option.classList.add('active');
9197
9233
  }
9198
9234
  });
9235
+
9236
+ // Update quality badge
9237
+ const qualityBadge = document.getElementById('uvf-quality-badge');
9238
+ if (qualityBadge) {
9239
+ const qualityOption = this.youtubeAvailableQualities.find(q => q.value === quality);
9240
+ qualityBadge.textContent = qualityOption ? qualityOption.label : 'AUTO';
9241
+ }
9199
9242
  return;
9200
9243
  }
9201
9244
 
@@ -9592,9 +9635,9 @@ export class WebPlayer extends BasePlayer {
9592
9635
  * Detect available video qualities from different sources
9593
9636
  */
9594
9637
  private detectAvailableQualities(): void {
9595
- // Don't add default 'Auto' for YouTube - it's already included in youtubeAvailableQualities
9638
+ // Check if we're using YouTube and have detected qualities
9596
9639
  const isYouTube = this.youtubePlayer && this.youtubePlayerReady && this.youtubeAvailableQualities.length > 0;
9597
- this.availableQualities = isYouTube ? [] : [{ value: 'auto', label: 'Auto' }];
9640
+ this.availableQualities = [];
9598
9641
  let detectedQualities: Array<{ value: string; label: string; height?: number }> = [];
9599
9642
 
9600
9643
  // YouTube qualities
@@ -9605,6 +9648,8 @@ export class WebPlayer extends BasePlayer {
9605
9648
  height: q.height
9606
9649
  }));
9607
9650
  this.debugLog('Using YouTube qualities:', detectedQualities);
9651
+ this.availableQualities = detectedQualities;
9652
+ return; // Early return for YouTube
9608
9653
  } else if (this.hls && this.hls.levels) {
9609
9654
  // HLS qualities
9610
9655
  this.hls.levels.forEach((level: any, index: number) => {