Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for enabling boundaries for assetbed cameras #8866

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Components/Assets/AssetTypes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export interface AssetTransaction {
modified_date: string;
}

export type BoundaryKeys = "x0" | "y0" | "x1" | "y1";
export interface AssetBedModel {
id: string;
asset_object: AssetData;
Expand All @@ -159,6 +160,7 @@ export interface AssetBedModel {
meta: Record<string, any>;
asset?: string;
bed?: string;
boundary: Record<BoundaryKeys, number> | null;
}

export type AssetBedBody = Partial<AssetBedModel>;
Expand Down
15 changes: 13 additions & 2 deletions src/Components/CameraFeed/CameraFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import { classNames, isIOS } from "../../Utils/utils";
import FeedAlert, { FeedAlertState, StreamStatus } from "./FeedAlert";
import FeedNetworkSignal from "./FeedNetworkSignal";
import NoFeedAvailable from "./NoFeedAvailable";
import FeedControls from "./FeedControls";
import FeedControls, { FeedControlsProps } from "./FeedControls";
import FeedWatermark from "./FeedWatermark";
import useFullscreen from "../../Common/hooks/useFullscreen";
import useBreakpoints from "../../Common/hooks/useBreakpoints";
import { GetPresetsResponse } from "./routes";
import VideoPlayer from "./videoPlayer";
import * as Notification from "../../Utils/Notifications.js";
import AssetInfoPopover from "../Common/AssetInfoPopover";

interface Props {
Expand All @@ -28,6 +29,7 @@ interface Props {
shortcutsDisabled?: boolean;
onMove?: () => void;
operate: ReturnType<typeof useOperateCamera>["operate"];
additionalControls?: FeedControlsProps["additionalControls"];
hideAssetInfo?: boolean;
}

Expand Down Expand Up @@ -134,15 +136,24 @@ export default function CameraFeed(props: Props) {
onReset={resetStream}
onMove={async (data) => {
setState("moving");
const { res } = await props.operate({ type: "relative_move", data });
const { res, error } = await props.operate({
type: "relative_move",
data,
});
props.onMove?.();
setTimeout(() => {
setState((state) => (state === "moving" ? undefined : state));
}, 4000);
if (res?.status === 400 && error) {
Notification.Error({
msg: error.detail,
});
}
if (res?.status === 500) {
setState("host_unreachable");
}
}}
additionalControls={props.additionalControls}
/>
);

Expand Down
Loading
Loading