Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve video external player play #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/component/Viewer/Video.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Launch, PlaylistPlay, Subtitles } from "@material-ui/icons";
import TextLoading from "../Placeholder/TextLoading";
import SelectMenu from "./SelectMenu";
import { getDownloadURL } from "../../services/file";
import { sortMethodFuncs } from "../FileManager/Sort";
import { sortMethodFuncs } from "../../redux/explorer/action";
import { useTranslation } from "react-i18next";

const Artplayer = React.lazy(() =>
Expand All @@ -26,32 +26,34 @@ const Artplayer = React.lazy(() =>
)
);

const domain = document.location.protocol + "//" + window.location.host;

const externalPlayers = [
{
name: "PotPlayer",
url: (source, title) => `potplayer://${source}`,
url: (source, title) => `potplayer://${domain}${source}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For non-local storage policy, source will be a complete URL. We can add a simple check if source is starting with letter /.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I have read the backend code, external video player is reuse the download link.
maybe they should add a new api for specific external link?

I'm not major of frontend, wolud you like to sovle it?

},
{
name: "VLC",
url: (source, title) => `vlc://${source}`,
url: (source, title) => `vlc://${domain}${source}`,
},
{
name: "IINA",
url: (source, title) => `iina://weblink?url=${source}`,
url: (source, title) => `iina://weblink?url=${domain}${source}`,
},
{
name: "nPlayer",
url: (source, title) => `nplayer-${source}`,
url: (source, title) => `nplayer-${domain}${source}`,
},
{
name: "MXPlayer (Free)",
url: (source, title) =>
`intent:${source}#Intent;package=com.mxtech.videoplayer.ad;S.title=${title};end`,
`intent:${domain}${source}#Intent;package=com.mxtech.videoplayer.ad;S.title=${title};end`,
},
{
name: "MXPlayer (Pro)",
url: (source, title) =>
`intent:${source}#Intent;package=com.mxtech.videoplayer.pro;S.title=${title};end`,
`intent:${domain}${source}#Intent;package=com.mxtech.videoplayer.pro;S.title=${title};end`,
},
];

Expand Down Expand Up @@ -80,7 +82,7 @@ const useStyles = makeStyles((theme) => ({
marginTop: theme.spacing(1),
},
"@global": {
"video,.art-video-player,.art-bottom":{
"video,.art-video-player,.art-bottom": {
borderRadius: theme.shape.borderRadius,
}
}
Expand Down