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/watch/player/playerComponent.js | 58 ++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 19 deletions(-) (limited to 'components/watch/player') 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