Skip to content

Commit

Permalink
Merge branch 'develop' into fix#6560
Browse files Browse the repository at this point in the history
  • Loading branch information
konavivekramakrishna authored Nov 16, 2023
2 parents ae2b482 + 43d08e1 commit 40c3682
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
37 changes: 22 additions & 15 deletions src/Components/Facility/Consultations/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,28 @@ export const Feed: React.FC<IFeedProps> = ({ consultationId, facilityId }) => {
}
};

const startStreamFeed = () => {
startStream({
onSuccess: () => setStreamStatus(StreamStatus.Playing),
onError: () => {
setStreamStatus(StreamStatus.Offline);
if (!statusReported) {
triggerGoal("Camera Feed Viewed", {
consultationId,
userId: authUser.id,
result: "error",
});
setStatusReported(true);
}
},
});
};

useEffect(() => {
if (cameraAsset.id) {
setTimeout(() => {
startStreamFeed();
}, 1000);
getPresets({
onSuccess: (resp) => setPresets(resp),
onError: (_) => {
Expand All @@ -251,21 +271,8 @@ export const Feed: React.FC<IFeedProps> = ({ consultationId, facilityId }) => {
setStreamStatus(StreamStatus.Loading);
}
tId = setTimeout(() => {
startStream({
onSuccess: () => setStreamStatus(StreamStatus.Playing),
onError: () => {
setStreamStatus(StreamStatus.Offline);
if (!statusReported) {
triggerGoal("Camera Feed Viewed", {
consultationId,
userId: authUser.id,
result: "error",
});
setStatusReported(true);
}
},
});
}, 100);
startStreamFeed();
}, 5000);
} else if (!statusReported) {
triggerGoal("Camera Feed Viewed", {
consultationId,
Expand Down
17 changes: 12 additions & 5 deletions src/Components/Facility/Consultations/LiveFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ const LiveFeed = (props: any) => {
useEffect(() => {
if (cameraAsset?.hostname) {
fetchCameraPresets();
setTimeout(() => {
startStreamFeed();
}, 1000);
}
}, []);

Expand All @@ -192,6 +195,13 @@ const LiveFeed = (props: any) => {
}
}, [page.offset, cameraAsset.id, refreshPresetsHash]);

const startStreamFeed = () => {
startStream({
onSuccess: () => setStreamStatus(StreamStatus.Playing),
onError: () => setStreamStatus(StreamStatus.Offline),
});
};

const viewOptions = (page: number) => {
return presets
? Object.entries(presets)
Expand All @@ -207,11 +217,8 @@ const LiveFeed = (props: any) => {
if (streamStatus !== StreamStatus.Playing) {
setStreamStatus(StreamStatus.Loading);
tId = setTimeout(() => {
startStream({
onSuccess: () => setStreamStatus(StreamStatus.Playing),
onError: () => setStreamStatus(StreamStatus.Offline),
});
}, 500);
startStreamFeed();
}, 5000);
}

return () => {
Expand Down
4 changes: 3 additions & 1 deletion src/Components/Form/FormFields/NumericWithUnitsFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export default function NumericWithUnitsFormField(props: Props) {
autoComplete={props.autoComplete}
required={field.required}
value={numValue}
onChange={(e) => field.handleChange(e.target.value + " " + unitValue)}
onChange={(e) =>
field.handleChange(Number(e.target.value) + " " + unitValue)
}
/>
<div className="absolute inset-y-0 right-0 flex items-center">
<select
Expand Down

0 comments on commit 40c3682

Please sign in to comment.