feat: Enhance search history dropdown with absolute positioning and empty state styling; improve video player autoplay functionality

This commit is contained in:
kuekhaoyang
2025-11-19 12:22:20 +08:00
parent fad6041df0
commit 3a756dd06f
10 changed files with 187 additions and 159 deletions
+6
View File
@@ -147,6 +147,12 @@ export function DesktopVideoPlayer({
if (initialTime > 0) {
videoRef.current.currentTime = initialTime;
}
// Auto-play the video when loaded
videoRef.current.play().catch(err => {
console.warn('Autoplay was prevented:', err);
// Autoplay may be blocked by browser policy, which is fine
});
};
const handleVideoError = () => {
+8 -4
View File
@@ -262,10 +262,8 @@ export function MobileVideoPlayer({
} catch (error) {
console.warn('Play/pause error:', error);
} finally {
// Small delay to prevent rapid toggling
setTimeout(() => {
isTogglingRef.current = false;
}, 100);
// Immediately release the toggle lock
isTogglingRef.current = false;
}
};
@@ -290,6 +288,12 @@ export function MobileVideoPlayer({
if (initialTime > 0) {
videoRef.current.currentTime = initialTime;
}
// Auto-play the video when loaded
videoRef.current.play().catch(err => {
console.warn('Autoplay was prevented:', err);
// Show a toast or indication that user needs to tap to play
});
};
const handleVideoError = () => {