mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-21 03:33:42 +08:00
feat: Enhance search history dropdown with absolute positioning and empty state styling; improve video player autoplay functionality
This commit is contained in:
@@ -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 = () => {
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user