From 6ef5bd54d5cdea80adc6972dbcb662908b3e39dd Mon Sep 17 00:00:00 2001
From: real-zephex <zephex-1@outlook.com>
Date: Sun, 19 May 2024 08:00:13 +0530
Subject: added series support

---
 src/app/web-series/components/videoPlayer.jsx | 71 +++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)
 create mode 100644 src/app/web-series/components/videoPlayer.jsx

(limited to 'src/app/web-series/components/videoPlayer.jsx')

diff --git a/src/app/web-series/components/videoPlayer.jsx b/src/app/web-series/components/videoPlayer.jsx
new file mode 100644
index 0000000..0e6b603
--- /dev/null
+++ b/src/app/web-series/components/videoPlayer.jsx
@@ -0,0 +1,71 @@
+"use client";
+
+import { useState } from "react";
+import styles from "../styles/videoPlayer.module.css";
+
+const SeriesPlayer = ({ id: id }) => {
+	const [iframe, iframeContent] = useState(null);
+	const [episode, setEpisode] = useState("");
+	const [season, setSeason] = useState("");
+
+	async function VideoPlayerInitialize() {
+		if (!episode || !season) {
+			alert("Please provide the required episode and season number.");
+			return;
+		}
+		iframeContent(await iframeGenerator(id, season, episode));
+		document.getElementById("video-player").style.display = "none";
+	}
+
+	return (
+		<main className={styles.Main}>
+			<div className={styles.EpisodeSeasonInput}>
+				<input
+					name="Season"
+					type="number"
+					placeholder="Season Number"
+					onChange={(e) => {
+						if (Number(e.target.value) > 0) {
+							setSeason(e.target.value);
+						}
+					}}
+				></input>
+				<input
+					name="Episode"
+					type="number"
+					placeholder="Episode Number"
+					onChange={(e) => {
+						if (Number(e.target.value) > 0) {
+							setEpisode(e.target.value);
+						}
+					}}
+				></input>
+
+				<button onClick={() => VideoPlayerInitialize(id)}>
+					Search
+				</button>
+			</div>
+
+			<div className={styles.VideoPlayer}>
+				{iframe}
+				<p id="video-player">
+					Please use adblockers to prevent ads and redirects. We have
+					no control over the amount of ads or the type of ads which
+					you might encounter.
+				</p>
+			</div>
+		</main>
+	);
+};
+
+const iframeGenerator = async (id, seasonNumber, episodeNumber) => {
+	return (
+		<iframe
+			src={`https://vidsrc.pro/embed/tv/${id}/${seasonNumber}/${episodeNumber}`}
+			allowFullScreen
+			referrerPolicy="origin"
+		></iframe>
+	);
+};
+
+export default SeriesPlayer;
-- 
cgit v1.2.3


From 6e83d0f37cb00785d142f9ddefddeff17535e77b Mon Sep 17 00:00:00 2001
From: real-zephex <zephex-1@outlook.com>
Date: Sun, 19 May 2024 08:05:01 +0530
Subject: added series support

---
 src/app/web-series/components/videoPlayer.jsx | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

(limited to 'src/app/web-series/components/videoPlayer.jsx')

diff --git a/src/app/web-series/components/videoPlayer.jsx b/src/app/web-series/components/videoPlayer.jsx
index 0e6b603..cc8feb3 100644
--- a/src/app/web-series/components/videoPlayer.jsx
+++ b/src/app/web-series/components/videoPlayer.jsx
@@ -59,13 +59,8 @@ const SeriesPlayer = ({ id: id }) => {
 };
 
 const iframeGenerator = async (id, seasonNumber, episodeNumber) => {
-	return (
-		<iframe
-			src={`https://vidsrc.pro/embed/tv/${id}/${seasonNumber}/${episodeNumber}`}
-			allowFullScreen
-			referrerPolicy="origin"
-		></iframe>
-	);
+	const url = `https://vidsrc.pro/embed/tv/${id}/${seasonNumber}/${episodeNumber}`;
+	return <iframe src={url} allowFullScreen referrerPolicy="origin"></iframe>;
 };
 
 export default SeriesPlayer;
-- 
cgit v1.2.3

