From e6648c16b9a2791dae002cbbe36be5a7ef499df8 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Thu, 27 Oct 2022 22:57:16 +0530 Subject: [PATCH] Fixed camera is offline error in other than staging (#3835) --- src/Components/Facility/Consultations/Feed.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Components/Facility/Consultations/Feed.tsx b/src/Components/Facility/Consultations/Feed.tsx index 0b6998a997a..1fc73d65b0e 100644 --- a/src/Components/Facility/Consultations/Feed.tsx +++ b/src/Components/Facility/Consultations/Feed.tsx @@ -136,8 +136,6 @@ export const Feed: React.FC = ({ consultationId }) => { }, [consultationId, dispatch] ); - const middlewareHostname = - cameraMiddlewareHostname || "dev_middleware.coronasafe.live"; // const [position, setPosition] = useState(); // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -164,8 +162,8 @@ export const Feed: React.FC = ({ consultationId }) => { ); const url = !isIOS - ? `wss://${middlewareHostname}/stream/${cameraAsset?.accessKey}/channel/0/mse?uuid=${cameraAsset?.accessKey}&channel=0` - : `https://${middlewareHostname}/stream/${cameraAsset?.accessKey}/channel/0/hls/live/index.m3u8?uuid=${cameraAsset?.accessKey}&channel=0`; + ? `wss://${cameraMiddlewareHostname}/stream/${cameraAsset?.accessKey}/channel/0/mse?uuid=${cameraAsset?.accessKey}&channel=0` + : `https://${cameraMiddlewareHostname}/stream/${cameraAsset?.accessKey}/channel/0/hls/live/index.m3u8?uuid=${cameraAsset?.accessKey}&channel=0`; const { startStream, @@ -176,7 +174,7 @@ export const Feed: React.FC = ({ consultationId }) => { : // eslint-disable-next-line react-hooks/rules-of-hooks useMSEMediaPlayer({ config: { - middlewareHostname, + middlewareHostname: cameraMiddlewareHostname, ...cameraAsset, }, url, @@ -191,7 +189,7 @@ export const Feed: React.FC = ({ consultationId }) => { relativeMove, } = useFeedPTZ({ config: { - middlewareHostname, + middlewareHostname: cameraMiddlewareHostname, ...cameraAsset, }, }); @@ -204,7 +202,7 @@ export const Feed: React.FC = ({ consultationId }) => { }; useEffect(() => { - if (cameraAsset.hostname) { + if (cameraAsset.hostname && cameraMiddlewareHostname) { getPresets({ onSuccess: (resp) => setPresets(resp.data), onError: (resp) => { @@ -216,7 +214,7 @@ export const Feed: React.FC = ({ consultationId }) => { }); getBedPresets(cameraAsset); } - }, [cameraAsset]); + }, [cameraAsset, cameraMiddlewareHostname]); useEffect(() => { let tId: any;