Merge pull request #513 from edde746/add-iina-mpv

Add IINA & mpv as external players
This commit is contained in:
Tim 2023-12-18 15:20:44 +01:00 committed by GitHub
commit 0027ce8236
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 19 deletions

View file

@ -16,7 +16,13 @@ if (platform.name === 'ios') {
{ label: 'Just Player', value: 'justplayer' },
{ label: 'MX Player', value: 'mxplayer' }
]);
} else if (['windows', 'macos', 'linux'].includes(platform.name)) {
} else if (platform.name === 'macos') {
options = options.concat([
{ label: 'IINA', value: 'iina' },
{ label: 'mpv', value: 'mpv' },
{ label: 'VLC', value: 'vlc' }
]);
} else if (['windows', 'linux'].includes(platform.name)) {
options = options.concat([
{ label: 'VLC', value: 'vlc' }
]);

View file

@ -15,19 +15,13 @@ const Stream = ({ className, videoId, videoReleased, addonName, name, descriptio
const { core } = useServices();
const toast = useToast();
const href = React.useMemo(() => {
const haveStreamingServer = streamingServer.settings !== null && streamingServer.settings.type === 'Ready';
return deepLinks ?
profile.settings.playerType && profile.settings.playerType !== 'internal' ?
platform.isMobile() || !haveStreamingServer ?
(deepLinks.externalPlayer.openPlayer || {})[platform.name] || deepLinks.externalPlayer.href
: null
:
typeof deepLinks.player === 'string' ?
deepLinks.player
:
null
:
null;
if (!deepLinks) return null;
if (profile.settings.playerType && profile.settings.playerType !== 'internal') {
return (deepLinks.externalPlayer.openPlayer || {})[platform.name] || deepLinks.externalPlayer.href;
}
return typeof deepLinks.player === 'string' ? deepLinks.player : null;
}, [deepLinks, profile, streamingServer]);
const markVideoAsWatched = React.useCallback(() => {
if (typeof videoId === 'string') {

View file

@ -211,11 +211,15 @@ const useProfileSettingsInputs = (profile) => {
}
}), [profile.settings]);
const playInExternalPlayerSelect = React.useMemo(() => ({
options: externalPlayerOptions.map((opt) => {
opt.label = t(opt.label);
return opt;
}),
selected: [`${profile.settings.playerType || 'internal'}`],
options: externalPlayerOptions.map((opt) => ({
value: opt.value,
label: t(opt.label),
})),
selected: [profile.settings.playerType],
renderLabelText: () => {
const selectedOption = externalPlayerOptions.find(({ value }) => value === profile.settings.playerType);
return selectedOption ? t(selectedOption.label, { defaultValue: selectedOption.label }) : profile.settings.playerType;
},
onSelect: (event) => {
core.transport.dispatch({
action: 'Ctx',