unified-video-framework 1.4.205 → 1.4.207
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.
|
@@ -384,9 +384,6 @@ export class WebPlayer extends BasePlayer {
|
|
|
384
384
|
this.state.isPlaying = true;
|
|
385
385
|
this.state.isPaused = false;
|
|
386
386
|
this.emit('onPlay');
|
|
387
|
-
|
|
388
|
-
// Hide play overlay when playback starts
|
|
389
|
-
this.hidePlayOverlay();
|
|
390
387
|
});
|
|
391
388
|
|
|
392
389
|
this.video.addEventListener('playing', () => {
|
|
@@ -396,9 +393,6 @@ export class WebPlayer extends BasePlayer {
|
|
|
396
393
|
try { this.video?.pause(); } catch (_) {}
|
|
397
394
|
}
|
|
398
395
|
|
|
399
|
-
// Also hide overlay on playing event (more reliable)
|
|
400
|
-
this.hidePlayOverlay();
|
|
401
|
-
|
|
402
396
|
// Stop buffering state
|
|
403
397
|
this.setBuffering(false);
|
|
404
398
|
});
|
|
@@ -456,15 +450,13 @@ export class WebPlayer extends BasePlayer {
|
|
|
456
450
|
this.autoplayAttempted = true;
|
|
457
451
|
this.attemptIntelligentAutoplay().then(success => {
|
|
458
452
|
if (!success) {
|
|
459
|
-
this.debugWarn('❌ Intelligent autoplay failed
|
|
460
|
-
this.showPlayOverlay();
|
|
453
|
+
this.debugWarn('❌ Intelligent autoplay failed - will retry on user interaction');
|
|
461
454
|
this.setupAutoplayRetry();
|
|
462
455
|
} else {
|
|
463
456
|
this.debugLog('✅ Intelligent autoplay succeeded');
|
|
464
457
|
}
|
|
465
458
|
}).catch(error => {
|
|
466
459
|
this.debugError('Autoplay failed:', error);
|
|
467
|
-
this.showPlayOverlay();
|
|
468
460
|
this.setupAutoplayRetry();
|
|
469
461
|
});
|
|
470
462
|
} else {
|
|
@@ -959,27 +951,26 @@ export class WebPlayer extends BasePlayer {
|
|
|
959
951
|
}
|
|
960
952
|
}
|
|
961
953
|
|
|
962
|
-
//
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
954
|
+
// Always try muted autoplay as fallback (browsers allow this)
|
|
955
|
+
// Ignore capability detection - it can give false negatives
|
|
956
|
+
this.video.muted = true;
|
|
957
|
+
this.debugLog('🔇 Attempting muted autoplay (always try this)');
|
|
966
958
|
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
}
|
|
980
|
-
} catch (error) {
|
|
981
|
-
this.debugLog('❌ Muted autoplay failed:', error);
|
|
959
|
+
try {
|
|
960
|
+
this.debugLog('▶️ Calling play() for muted autoplay...');
|
|
961
|
+
await this.play();
|
|
962
|
+
// Verify video is actually playing
|
|
963
|
+
this.debugLog(`📊 Play returned, video.paused=${this.video.paused}`);
|
|
964
|
+
if (!this.video.paused) {
|
|
965
|
+
this.debugLog('✅ Muted autoplay successful');
|
|
966
|
+
// Show YouTube-style unmute button instead of blocking overlay
|
|
967
|
+
this.showUnmuteButton();
|
|
968
|
+
return true;
|
|
969
|
+
} else {
|
|
970
|
+
this.debugLog('❌ Muted play() succeeded but video is paused');
|
|
982
971
|
}
|
|
972
|
+
} catch (error) {
|
|
973
|
+
this.debugLog('❌ Muted autoplay failed:', error);
|
|
983
974
|
}
|
|
984
975
|
|
|
985
976
|
return false;
|
|
@@ -1029,160 +1020,6 @@ export class WebPlayer extends BasePlayer {
|
|
|
1029
1020
|
this.debugLog('🎯 Autoplay retry armed - waiting for user interaction');
|
|
1030
1021
|
}
|
|
1031
1022
|
|
|
1032
|
-
private showPlayOverlay(): void {
|
|
1033
|
-
// Don't show overlay if unmute button is already visible (video is autoplaying muted)
|
|
1034
|
-
const unmuteBtn = document.getElementById('uvf-unmute-btn');
|
|
1035
|
-
if (unmuteBtn) {
|
|
1036
|
-
this.debugLog('Skipping play overlay - video is autoplaying muted with unmute button');
|
|
1037
|
-
return;
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
// Don't show overlay if video is already playing
|
|
1041
|
-
if (this.video && !this.video.paused) {
|
|
1042
|
-
this.debugLog('Skipping play overlay - video is already playing');
|
|
1043
|
-
return;
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
// Remove existing overlay
|
|
1047
|
-
this.hidePlayOverlay();
|
|
1048
|
-
|
|
1049
|
-
this.debugLog('📺 Showing play overlay due to autoplay restriction');
|
|
1050
|
-
|
|
1051
|
-
const overlay = document.createElement('div');
|
|
1052
|
-
overlay.id = 'uvf-play-overlay';
|
|
1053
|
-
overlay.className = 'uvf-play-overlay';
|
|
1054
|
-
|
|
1055
|
-
const playButton = document.createElement('button');
|
|
1056
|
-
playButton.className = 'uvf-play-button';
|
|
1057
|
-
playButton.setAttribute('aria-label', 'Play video');
|
|
1058
|
-
playButton.innerHTML = `
|
|
1059
|
-
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
1060
|
-
<path d="M8 5v14l11-7z"/>
|
|
1061
|
-
</svg>
|
|
1062
|
-
`;
|
|
1063
|
-
|
|
1064
|
-
const message = document.createElement('div');
|
|
1065
|
-
message.className = 'uvf-play-message';
|
|
1066
|
-
message.textContent = 'Click to play';
|
|
1067
|
-
|
|
1068
|
-
overlay.appendChild(playButton);
|
|
1069
|
-
overlay.appendChild(message);
|
|
1070
|
-
|
|
1071
|
-
// Enhanced click handler with better error handling
|
|
1072
|
-
const handlePlayClick = async (e: Event) => {
|
|
1073
|
-
e.preventDefault();
|
|
1074
|
-
e.stopPropagation();
|
|
1075
|
-
this.lastUserInteraction = Date.now();
|
|
1076
|
-
this.debugLog('▶️ User clicked play overlay');
|
|
1077
|
-
|
|
1078
|
-
try {
|
|
1079
|
-
// Ensure video is ready
|
|
1080
|
-
if (!this.video) {
|
|
1081
|
-
this.debugError('Video element not available');
|
|
1082
|
-
return;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
// Try to play
|
|
1086
|
-
await this.play();
|
|
1087
|
-
this.debugLog('✅ Play successful after user click');
|
|
1088
|
-
} catch (error) {
|
|
1089
|
-
this.debugError('❌ Failed to play after user interaction:', error);
|
|
1090
|
-
// Show error message on overlay
|
|
1091
|
-
message.textContent = 'Unable to play. Please try again.';
|
|
1092
|
-
message.style.color = '#ff6b6b';
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
// Add click handler to button
|
|
1097
|
-
playButton.addEventListener('click', handlePlayClick);
|
|
1098
|
-
|
|
1099
|
-
// Also allow clicking anywhere on overlay
|
|
1100
|
-
overlay.addEventListener('click', async (e) => {
|
|
1101
|
-
if (e.target === overlay) {
|
|
1102
|
-
await handlePlayClick(e);
|
|
1103
|
-
}
|
|
1104
|
-
});
|
|
1105
|
-
|
|
1106
|
-
// Add enhanced styles with better visibility
|
|
1107
|
-
const style = document.createElement('style');
|
|
1108
|
-
style.textContent = `
|
|
1109
|
-
.uvf-play-overlay {
|
|
1110
|
-
position: absolute !important;
|
|
1111
|
-
top: 0 !important;
|
|
1112
|
-
left: 0 !important;
|
|
1113
|
-
width: 100% !important;
|
|
1114
|
-
height: 100% !important;
|
|
1115
|
-
background: rgba(0, 0, 0, 0.85) !important;
|
|
1116
|
-
display: flex !important;
|
|
1117
|
-
flex-direction: column !important;
|
|
1118
|
-
justify-content: center !important;
|
|
1119
|
-
align-items: center !important;
|
|
1120
|
-
z-index: 999999 !important;
|
|
1121
|
-
cursor: pointer !important;
|
|
1122
|
-
backdrop-filter: blur(4px);
|
|
1123
|
-
-webkit-backdrop-filter: blur(4px);
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
.uvf-play-button {
|
|
1127
|
-
width: 96px !important;
|
|
1128
|
-
height: 96px !important;
|
|
1129
|
-
border-radius: 50% !important;
|
|
1130
|
-
background: rgba(255, 255, 255, 0.95) !important;
|
|
1131
|
-
border: 3px solid rgba(255, 255, 255, 0.3) !important;
|
|
1132
|
-
color: #000 !important;
|
|
1133
|
-
cursor: pointer !important;
|
|
1134
|
-
display: flex !important;
|
|
1135
|
-
align-items: center !important;
|
|
1136
|
-
justify-content: center !important;
|
|
1137
|
-
transition: all 0.3s ease !important;
|
|
1138
|
-
margin-bottom: 20px !important;
|
|
1139
|
-
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
.uvf-play-button:hover {
|
|
1143
|
-
background: #fff !important;
|
|
1144
|
-
transform: scale(1.15) !important;
|
|
1145
|
-
box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4) !important;
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
.uvf-play-button svg {
|
|
1149
|
-
width: 40px !important;
|
|
1150
|
-
height: 40px !important;
|
|
1151
|
-
margin-left: 4px !important;
|
|
1152
|
-
}
|
|
1153
|
-
|
|
1154
|
-
.uvf-play-message {
|
|
1155
|
-
color: white !important;
|
|
1156
|
-
font-size: 18px !important;
|
|
1157
|
-
font-weight: 600 !important;
|
|
1158
|
-
text-align: center !important;
|
|
1159
|
-
opacity: 0.95 !important;
|
|
1160
|
-
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
|
|
1161
|
-
}
|
|
1162
|
-
`;
|
|
1163
|
-
|
|
1164
|
-
// Add to page if not already added
|
|
1165
|
-
if (!document.getElementById('uvf-play-overlay-styles')) {
|
|
1166
|
-
style.id = 'uvf-play-overlay-styles';
|
|
1167
|
-
document.head.appendChild(style);
|
|
1168
|
-
}
|
|
1169
|
-
|
|
1170
|
-
// Add to player
|
|
1171
|
-
if (this.playerWrapper) {
|
|
1172
|
-
this.playerWrapper.appendChild(overlay);
|
|
1173
|
-
this.debugLog('✅ Play overlay added to player wrapper');
|
|
1174
|
-
} else {
|
|
1175
|
-
this.debugError('❌ Cannot show play overlay - playerWrapper not found');
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
private hidePlayOverlay(): void {
|
|
1180
|
-
this.debugLog('🔇 Hiding play overlay');
|
|
1181
|
-
const overlay = document.getElementById('uvf-play-overlay');
|
|
1182
|
-
if (overlay) {
|
|
1183
|
-
overlay.remove();
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
1023
|
|
|
1187
1024
|
/**
|
|
1188
1025
|
* Show YouTube-style unmute button when video autoplays muted
|
|
@@ -1381,8 +1218,6 @@ export class WebPlayer extends BasePlayer {
|
|
|
1381
1218
|
this.video.pause();
|
|
1382
1219
|
}
|
|
1383
1220
|
|
|
1384
|
-
// Hide the play overlay if it exists
|
|
1385
|
-
this.hidePlayOverlay();
|
|
1386
1221
|
// Hide unmute button when video starts playing with sound
|
|
1387
1222
|
if (!this.video.muted) {
|
|
1388
1223
|
this.hideUnmuteButton();
|