feat: added vlc play button
This commit is contained in:
1 parent
3460041115
commit
b6bef36e82
2 files changed
+22
-2
No files matched your search
+20
-2
@@ -1,12 +1,12 @@
|
|||||||
import { FC, useMemo } from 'react';
|
import { FC, useMemo } from 'react';
|
||||||
import { Cast, Download, ListVideo, Loader, Magnet, Play } from 'lucide-react';
|
import { Cast, Download, ListVideo, Loader, Magnet, Play, TrafficCone } from 'lucide-react';
|
||||||
|
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import ButtonsGroup from '@/components/ui/buttons-group';
|
import ButtonsGroup from '@/components/ui/buttons-group';
|
||||||
import { Quality } from '@/data/parsers/yts/models';
|
import { Quality } from '@/data/parsers/yts/models';
|
||||||
import { useM3UUrl } from '@/hooks/useM3UStreamUrl';
|
import { useM3UUrl } from '@/hooks/useM3UStreamUrl';
|
||||||
import { useStreamUrl } from '@/hooks/useStreamUrl';
|
import { useStreamUrl } from '@/hooks/useStreamUrl';
|
||||||
import { cn, detectSafari, getMagnetHash } from '@/lib/utils';
|
import { cn, detectSafari, getMagnetHash, isStandaloneApp } from '@/lib/utils';
|
||||||
|
|
||||||
import { providers } from '../../../../constants';
|
import { providers } from '../../../../constants';
|
||||||
import { useCastMagnet, usePrefix } from '../../../../hooks/useMagnetHosts';
|
import { useCastMagnet, usePrefix } from '../../../../hooks/useMagnetHosts';
|
||||||
@@ -30,6 +30,8 @@ const Actions: FC<Props> = ({ torrent, backdrop, title, provider, playerEntryId,
|
|||||||
const streamUrl = useStreamUrl();
|
const streamUrl = useStreamUrl();
|
||||||
const M3UUrl = useM3UUrl();
|
const M3UUrl = useM3UUrl();
|
||||||
|
|
||||||
|
const isStandalone = isStandaloneApp();
|
||||||
|
|
||||||
const { isIOS, isSafari } = detectSafari();
|
const { isIOS, isSafari } = detectSafari();
|
||||||
const isHEVC = torrent.codec?.includes('265') || torrent.codec?.toLowerCase().includes('hevc');
|
const isHEVC = torrent.codec?.includes('265') || torrent.codec?.toLowerCase().includes('hevc');
|
||||||
|
|
||||||
@@ -107,6 +109,22 @@ const Actions: FC<Props> = ({ torrent, backdrop, title, provider, playerEntryId,
|
|||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
|
{isStandalone && (
|
||||||
|
<Button
|
||||||
|
className='relative grow-0 px-3 text-white hover:text-white active:text-white'
|
||||||
|
style={{ background: '#f7901e' }}
|
||||||
|
variant='outline'
|
||||||
|
title='Play in VLC'
|
||||||
|
asChild
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className='absolute left-0 top-0 size-full'
|
||||||
|
rel='noopener noreferrer'
|
||||||
|
href={`vlc://${streamUrl}/stream?m3u&link=${encodeURIComponent(magnet)}`}
|
||||||
|
/>
|
||||||
|
<TrafficCone size={20} />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</ButtonsGroup>
|
</ButtonsGroup>
|
||||||
{!magnet && (
|
{!magnet && (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -51,3 +51,5 @@ export const detectSafari = () => {
|
|||||||
|
|
||||||
return { isSafari, isIOS };
|
return { isSafari, isIOS };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const isStandaloneApp = () => window.matchMedia('screen and (display-mode: standalone)').matches;
|
||||||
Reference in new issue
Block a user