+
setAutoPlay((prev) => !prev)}
/>
- setAutoSkipIntro((prev) => !prev)}
- />
+ />
setAutoNext((prev) => !prev)}
/>
-
+
diff --git a/src/pages/watch/Watch.jsx b/src/pages/watch/Watch.jsx
index 4433730..5702804 100644
--- a/src/pages/watch/Watch.jsx
+++ b/src/pages/watch/Watch.jsx
@@ -72,6 +72,10 @@ export default function Watch() {
autoNext,
setAutoNext,
} = useWatchControl();
+ const playerRef = useRef(null);
+ const videoContainerRef = useRef(null);
+ const controlsRef = useRef(null);
+ const episodesRef = useRef(null);
useEffect(() => {
if (!episodes || episodes.length === 0) return;
@@ -119,26 +123,66 @@ export default function Watch() {
}, [streamInfo, episodeId, animeId, totalEpisodes, navigate]);
useEffect(() => {
+ // Function to adjust the height of episodes list to match only video + controls
const adjustHeight = () => {
if (window.innerWidth > 1200) {
- const player = document.querySelector(".player");
- const episodes = document.querySelector(".episodes");
- if (player && episodes) {
- episodes.style.height = `${player.clientHeight}px`;
+ if (videoContainerRef.current && controlsRef.current && episodesRef.current) {
+ // Calculate combined height of video container and controls
+ const videoHeight = videoContainerRef.current.offsetHeight;
+ const controlsHeight = controlsRef.current.offsetHeight;
+ const totalHeight = videoHeight + controlsHeight;
+
+ // Apply the combined height to episodes container
+ episodesRef.current.style.height = `${totalHeight}px`;
}
} else {
- const episodes = document.querySelector(".episodes");
- if (episodes) {
- episodes.style.height = "auto";
+ if (episodesRef.current) {
+ episodesRef.current.style.height = 'auto';
}
}
};
- adjustHeight();
- window.addEventListener("resize", adjustHeight);
+
+ // Initial adjustment with delay to ensure player is fully rendered
+ const initialTimer = setTimeout(() => {
+ adjustHeight();
+ }, 500);
+
+ // Set up resize listener
+ window.addEventListener('resize', adjustHeight);
+
+ // Create MutationObserver to monitor player changes
+ const observer = new MutationObserver(() => {
+ setTimeout(adjustHeight, 100);
+ });
+
+ // Start observing both video container and controls
+ if (videoContainerRef.current) {
+ observer.observe(videoContainerRef.current, {
+ attributes: true,
+ childList: true,
+ subtree: true
+ });
+ }
+
+ if (controlsRef.current) {
+ observer.observe(controlsRef.current, {
+ attributes: true,
+ childList: true,
+ subtree: true
+ });
+ }
+
+ // Set up additional interval for continuous adjustments
+ const intervalId = setInterval(adjustHeight, 1000);
+
+ // Clean up
return () => {
- window.removeEventListener("resize", adjustHeight);
+ clearTimeout(initialTimer);
+ clearInterval(intervalId);
+ observer.disconnect();
+ window.removeEventListener('resize', adjustHeight);
};
- });
+ }, [buffering, activeServerType, activeServerName, episodeId, streamUrl, episodes]);
function Tag({ bgColor, index, icon, text }) {
return (
@@ -182,13 +226,13 @@ export default function Watch() {
}, [animeId, animeInfo]);
return (
-
+
{/* Left Column - Player, Controls, Servers */}
-
+
{/* Video Container */}
-
+
{!buffering ? (["hd-1", "hd-4"].includes(activeServerName.toLowerCase()) ?
{/* Controls Section */}
-
+
{!buffering && (
-
+
-
+
{animeInfo && animeInfo?.title ? (
-
- {language ? animeInfo?.title : animeInfo?.japanese_title}
-
+
+
+ {language ? animeInfo?.title : animeInfo?.japanese_title}
+
+
+
) : (
)}
@@ -366,12 +420,6 @@ export default function Watch() {
)}
)}
-
- View Details
-
@@ -380,22 +428,47 @@ export default function Watch() {
{seasons?.length > 0 && (
More Seasons
-
+
{seasons.map((season, index) => (

-
-
+ {/* Dots Pattern Overlay */}
+
')`,
+ backgroundSize: '3px 3px'
+ }}
+ />
+ {/* Dark Gradient Overlay */}
+
+ {/* Title Container */}
+
@@ -404,22 +477,29 @@ export default function Watch() {
)}
+
- {/* Recommended Section */}
- {animeInfo?.recommended_data.length > 0 && (
-
-
Recommended
-
+ {/* Episodes Section */}
+
+ {!episodes ? (
+
+
+
+ ) : (
+
setEpisodeId(id)}
+ totalEpisodes={totalEpisodes}
/>
-
- )}
+ )}
+
{/* Related Anime Section */}
{animeInfo && animeInfo.related_data ? (
-
+
Related Anime
)}
-
- {/* Right Column - Episodes */}
-
- {!episodes ? (
-
-
-
- ) : (
-
setEpisodeId(id)}
- totalEpisodes={totalEpisodes}
- />
- )}
-