Ensure haveStreamingServer Availability is Satisfied 2

This commit is contained in:
Alexandru Branza 2023-05-29 19:50:09 +03:00
parent 68bba90e30
commit 22aa3a5f15

View file

@ -13,8 +13,8 @@ const Stream = ({ className, addonName, name, description, thumbnail, progress,
const profile = useProfile(); const profile = useProfile();
const streamingServer = useStreamingServer(); const streamingServer = useStreamingServer();
const { core } = useServices(); const { core } = useServices();
const haveStreamingServer = streamingServer.settings !== null && streamingServer.settings.type === 'Ready';
const href = React.useMemo(() => { const href = React.useMemo(() => {
const haveStreamingServer = streamingServer.settings !== null && streamingServer.settings.type === 'Ready';
return deepLinks ? return deepLinks ?
profile.settings.playerType === 'external' ? profile.settings.playerType === 'external' ?
platform.isMobile() || !haveStreamingServer ? platform.isMobile() || !haveStreamingServer ?
@ -27,7 +27,7 @@ const Stream = ({ className, addonName, name, description, thumbnail, progress,
null null
: :
null; null;
}, [deepLinks, haveStreamingServer]); }, [deepLinks, streamingServer]);
const onClick = React.useCallback((e) => { const onClick = React.useCallback((e) => {
if (href === null) { if (href === null) {
// link does not lead to the player, it is expected to // link does not lead to the player, it is expected to