Skip to content

Commit

Permalink
Fixed camera is offline error in other than staging (ohcnetwork#3835)
Browse files Browse the repository at this point in the history
  • Loading branch information
khavinshankar authored Oct 27, 2022
1 parent c72e315 commit e6648c1
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Components/Facility/Consultations/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ export const Feed: React.FC<IFeedProps> = ({ consultationId }) => {
},
[consultationId, dispatch]
);
const middlewareHostname =
cameraMiddlewareHostname || "dev_middleware.coronasafe.live";

// const [position, setPosition] = useState<any>();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand All @@ -164,8 +162,8 @@ export const Feed: React.FC<IFeedProps> = ({ 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,
Expand All @@ -176,7 +174,7 @@ export const Feed: React.FC<IFeedProps> = ({ consultationId }) => {
: // eslint-disable-next-line react-hooks/rules-of-hooks
useMSEMediaPlayer({
config: {
middlewareHostname,
middlewareHostname: cameraMiddlewareHostname,
...cameraAsset,
},
url,
Expand All @@ -191,7 +189,7 @@ export const Feed: React.FC<IFeedProps> = ({ consultationId }) => {
relativeMove,
} = useFeedPTZ({
config: {
middlewareHostname,
middlewareHostname: cameraMiddlewareHostname,
...cameraAsset,
},
});
Expand All @@ -204,7 +202,7 @@ export const Feed: React.FC<IFeedProps> = ({ consultationId }) => {
};

useEffect(() => {
if (cameraAsset.hostname) {
if (cameraAsset.hostname && cameraMiddlewareHostname) {
getPresets({
onSuccess: (resp) => setPresets(resp.data),
onError: (resp) => {
Expand All @@ -216,7 +214,7 @@ export const Feed: React.FC<IFeedProps> = ({ consultationId }) => {
});
getBedPresets(cameraAsset);
}
}, [cameraAsset]);
}, [cameraAsset, cameraMiddlewareHostname]);

useEffect(() => {
let tId: any;
Expand Down

0 comments on commit e6648c1

Please sign in to comment.