diff options
| author | Factiven <[email protected]> | 2023-06-07 13:17:05 +0700 |
|---|---|---|
| committer | Factiven <[email protected]> | 2023-06-07 13:17:05 +0700 |
| commit | 84618a66caf9746faa503de0af532d6a86c8fb73 (patch) | |
| tree | cd297f2c973514908e8cfb86d2ad1f5bbef4cb82 /components | |
| parent | added fullscreen hotkey (#19) (diff) | |
| download | moopa-84618a66caf9746faa503de0af532d6a86c8fb73.tar.xz moopa-84618a66caf9746faa503de0af532d6a86c8fb73.zip | |
fixed freezed subtitle after changing quality
Diffstat (limited to 'components')
| -rw-r--r-- | components/videoPlayer.js | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/components/videoPlayer.js b/components/videoPlayer.js index 8c137d1..ecd62e0 100644 --- a/components/videoPlayer.js +++ b/components/videoPlayer.js @@ -1,6 +1,7 @@ import Player from "../lib/Artplayer"; import { useEffect, useState } from "react"; import { useAniList } from "../lib/useAnilist"; +import artplayerPluginHlsQuality from "artplayer-plugin-hls-quality"; const fontSize = [ { @@ -68,7 +69,9 @@ export default function VideoPlayer({ const referer = data?.headers?.Referer; const source = data.sources.map((items) => { const isDefault = - resolution === "auto" + provider !== "gogoanime" + ? items.quality === "default" || items.quality === "auto" + : resolution === "auto" ? items.quality === "default" || items.quality === "auto" : items.quality === resolution; return { @@ -129,7 +132,7 @@ export default function VideoPlayer({ return ( <> - {url ? ( + {url && ( <Player key={url} option={{ @@ -137,8 +140,29 @@ export default function VideoPlayer({ title: `${title}`, autoplay: true, screenshot: true, + moreVideoAttr: { + crossOrigin: "anonymous", + }, poster: poster ? poster : "", ...(provider === "zoro" && { + plugins: [ + artplayerPluginHlsQuality({ + // Show quality in control + // control: true, + + // Show quality in setting + setting: true, + + // Get the resolution text from level + getResolution: (level) => level.height + "P", + + // I18n + title: "Quality", + auto: "Auto", + }), + ], + }), + ...(provider === "zoro" && { subtitle: { url: `${defSub}`, // type: "vtt", @@ -275,8 +299,6 @@ export default function VideoPlayer({ // }); }} /> - ) : ( - "" )} </> ); |