refactor(OptionsMenu): use download prop from external deeplinks for streamUrl

This commit is contained in:
Tim 2022-12-21 13:00:52 +01:00
parent 825102bb0f
commit 117dd30c76

View file

@ -14,16 +14,12 @@ const OptionsMenu = ({ className, stream }) => {
const toast = useToast();
const streamUrl = React.useMemo(() => {
return stream !== null ?
typeof stream.url === 'string' ?
stream.url
stream.deepLinks &&
stream.deepLinks.externalPlayer &&
typeof stream.deepLinks.externalPlayer.download === 'string' ?
stream.deepLinks.externalPlayer.download
:
typeof stream.infoHash === 'string' &&
typeof stream.fileIdx === 'number' &&
typeof streamingServer.selected === 'object' &&
typeof streamingServer.selected.transportUrl === 'string' ?
`${streamingServer.selected.transportUrl}${stream.infoHash}/${stream.fileIdx}`
:
null
null
:
null;
}, [stream, streamingServer]);