diff --git a/src/components/video/controls/LoadingControl.tsx b/src/components/video/controls/LoadingControl.tsx index eeea8d8f..8b38cef9 100644 --- a/src/components/video/controls/LoadingControl.tsx +++ b/src/components/video/controls/LoadingControl.tsx @@ -4,7 +4,9 @@ import { useVideoPlayerState } from "../VideoContext"; export function LoadingControl() { const { videoState } = useVideoPlayerState(); - if (!videoState.isLoading) return null; + const isLoading = videoState.isFirstLoading || videoState.isLoading; + + if (!isLoading) return null; return ; } diff --git a/src/components/video/controls/MiddlePauseControl.tsx b/src/components/video/controls/MiddlePauseControl.tsx index 9bbbe08c..b934db0a 100644 --- a/src/components/video/controls/MiddlePauseControl.tsx +++ b/src/components/video/controls/MiddlePauseControl.tsx @@ -12,6 +12,7 @@ export function MiddlePauseControl() { if (videoState.hasPlayedOnce) return null; if (videoState.isPlaying) return null; + if (videoState.isFirstLoading) return null; return (
{ + update((s) => ({ + ...s, + isFirstLoading: false, + })); + }; player.addEventListener("pause", pause); player.addEventListener("playing", playing); @@ -133,6 +142,7 @@ function registerListeners(player: HTMLVideoElement, update: SetPlayer) { player.addEventListener("volumechange", volumechange); player.addEventListener("progress", progress); player.addEventListener("waiting", waiting); + player.addEventListener("canplay", canplay); return () => { player.removeEventListener("pause", pause); @@ -145,6 +155,7 @@ function registerListeners(player: HTMLVideoElement, update: SetPlayer) { player.removeEventListener("volumechange", volumechange); player.removeEventListener("progress", progress); player.removeEventListener("waiting", waiting); + player.removeEventListener("canplay", canplay); }; } diff --git a/src/views/search/SearchResultsView.tsx b/src/views/search/SearchResultsView.tsx index 60a61115..20764b22 100644 --- a/src/views/search/SearchResultsView.tsx +++ b/src/views/search/SearchResultsView.tsx @@ -52,6 +52,8 @@ export function SearchResultsView({ searchQuery }: { searchQuery: MWQuery }) { ); useEffect(() => { + // TODO use cache + // TODO run immediately without debounce on mount async function runSearch(query: MWQuery) { const searchResults = await runSearchQuery(query); if (!searchResults) return;