From e4ce88fa532b15d4dcce8b8176f3e376e8c9c65f Mon Sep 17 00:00:00 2001 From: Factiven Date: Mon, 25 Sep 2023 23:45:27 +0700 Subject: Update v4.1.1 --- components/anime/episode.js | 5 +-- components/anime/mobile/topSection.js | 2 +- components/home/content.js | 12 +++++-- components/watch/player/playerComponent.js | 58 ++++++++++++++++++++---------- 4 files changed, 53 insertions(+), 24 deletions(-) (limited to 'components') diff --git a/components/anime/episode.js b/components/anime/episode.js index e6420a7..6f96c98 100644 --- a/components/anime/episode.js +++ b/components/anime/episode.js @@ -262,7 +262,8 @@ export default function AnimeEpisode({ className="flex lg:hidden flex-col items-center relative rounded-md bg-secondary py-1.5 px-3 font-karla text-sm hover:ring-1 ring-action cursor-pointer group" > {isDub ? "Dub" : "Sub"} - + + Switch to {isDub ? "Sub" : "Dub"} @@ -298,7 +299,7 @@ export default function AnimeEpisode({ className="hidden lg:flex flex-col items-center relative rounded-[3px] bg-secondary py-1 px-3 font-karla text-sm hover:ring-1 ring-action cursor-pointer group" > {isDub ? "Dub" : "Sub"} - + Switch to {isDub ? "Sub" : "Dub"} diff --git a/components/anime/mobile/topSection.js b/components/anime/mobile/topSection.js index 8db1465..761a9fd 100644 --- a/components/anime/mobile/topSection.js +++ b/components/anime/mobile/topSection.js @@ -2,7 +2,7 @@ import { PlayIcon, PlusIcon, ShareIcon } from "@heroicons/react/24/solid"; import Image from "next/image"; import { useRouter } from "next/router"; import { useEffect, useState } from "react"; -import { convertSecondsToTime } from "../../../utils/getTimes"; +import { convertSecondsToTime } from "@/utils/getTimes"; import Link from "next/link"; import InfoChip from "./reused/infoChip"; import Description from "./reused/description"; diff --git a/components/home/content.js b/components/home/content.js index 9dd4408..651d276 100644 --- a/components/home/content.js +++ b/components/home/content.js @@ -256,7 +256,11 @@ export default function Content({ className="flex flex-col gap-3 shrink-0 cursor-pointer" > @@ -345,7 +349,11 @@ export default function Content({ {ids !== "onGoing" && ( diff --git a/components/watch/player/playerComponent.js b/components/watch/player/playerComponent.js index d498384..9fe9cd3 100644 --- a/components/watch/player/playerComponent.js +++ b/components/watch/player/playerComponent.js @@ -64,6 +64,7 @@ export default function PlayerComponent({ const [subtitle, setSubtitle] = useState(); const [defSub, setDefSub] = useState(); const [loading, setLoading] = useState(true); + const [error, setError] = useState(false); useEffect(() => { setLoading(true); @@ -212,6 +213,13 @@ export default function PlayerComponent({ } }); + art.on("error", (error, reconnectTime) => { + if (error && reconnectTime >= 5) { + setError(true); + console.error("Error while loading video:", error); + } + }); + art.on("play", () => { art.notice.show = ""; setPlayerState({ ...playerState, isPlaying: true }); @@ -436,7 +444,6 @@ export default function PlayerComponent({ */ const option = { url: url, - title: "title", autoplay: autoplay ? true : false, autoSize: false, fullscreen: true, @@ -445,6 +452,10 @@ export default function PlayerComponent({ setting: true, screenshot: true, hotkey: true, + pip: true, + fastForward: true, + airplay: true, + lock: true, }; return ( @@ -453,24 +464,33 @@ export default function PlayerComponent({ className={`${className} bg-black`} style={{ aspectRatio: aspectRatio }} > -
- {!loading && track && url && ( - +
+ {!error ? ( + !loading && + track && + url && ( + + ) + ) : ( +

+ Something went wrong while loading the video,
+ please try from other source +

)}
-- cgit v1.2.3