diff --git a/src/component/Viewers/Video/Artplayer.tsx b/src/component/Viewers/Video/Artplayer.tsx index 13faced..0484b25 100644 --- a/src/component/Viewers/Video/Artplayer.tsx +++ b/src/component/Viewers/Video/Artplayer.tsx @@ -1,4 +1,5 @@ import { Box, BoxProps } from "@mui/material"; +import { fileExtension } from "../../../util"; import Artplayer from "artplayer"; import artplayerPluginChapter from "artplayer-plugin-chapter"; import artplayerPluginHlsControl from "artplayer-plugin-hls-control"; @@ -143,7 +144,7 @@ export default function Player({ opts.plugins.push(artplayerPluginChapter({ chapters })); } - if (option.title.endsWith(".m3u8")) { + if (fileExtension(option.title) === "m3u8") { opts.plugins.push( artplayerPluginHlsControl({ quality: { diff --git a/src/component/Viewers/Video/VideoViewer.tsx b/src/component/Viewers/Video/VideoViewer.tsx index 8720cb4..66eb256 100644 --- a/src/component/Viewers/Video/VideoViewer.tsx +++ b/src/component/Viewers/Video/VideoViewer.tsx @@ -100,7 +100,7 @@ const VideoViewer = () => { } const firstLoad = !currentExpire.current; - const isM3u8 = viewerState.file.name.endsWith(".m3u8"); + const isM3u8 = fileExtension(viewerState.file.name) === "m3u8"; if (isM3u8) { // For m3u8, use masked url const crFileUrl = new CrUri(getFileLinkedUri(viewerState.file));