2021-03-26 13:43:04 -07:00
|
|
|
// This file is part of Moonfire NVR, a security camera network video recorder.
|
|
|
|
// Copyright (C) 2021 The Moonfire NVR Authors; see AUTHORS and LICENSE.txt.
|
|
|
|
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
|
|
|
|
|
2021-08-13 08:49:22 -07:00
|
|
|
import Container from "@material-ui/core/Container";
|
|
|
|
import ErrorIcon from "@material-ui/icons/Error";
|
2021-03-26 13:43:04 -07:00
|
|
|
import { Camera } from "../types";
|
|
|
|
import LiveCamera from "./LiveCamera";
|
|
|
|
import Multiview from "./Multiview";
|
|
|
|
|
|
|
|
export interface LiveProps {
|
|
|
|
cameras: Camera[];
|
|
|
|
layoutIndex: number;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Live = ({ cameras, layoutIndex }: LiveProps) => {
|
2021-08-13 08:49:22 -07:00
|
|
|
if ("MediaSource" in window === false) {
|
|
|
|
return (
|
|
|
|
<Container>
|
|
|
|
<ErrorIcon
|
|
|
|
sx={{
|
|
|
|
float: "left",
|
|
|
|
color: "secondary.main",
|
|
|
|
marginRight: "1em",
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
Live view doesn't work yet on your browser. See{" "}
|
|
|
|
<a href="https://github.com/scottlamb/moonfire-nvr/issues/121">#121</a>.
|
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
}
|
2021-03-26 13:43:04 -07:00
|
|
|
return (
|
|
|
|
<Multiview
|
|
|
|
layoutIndex={layoutIndex}
|
|
|
|
cameras={cameras}
|
2021-03-29 11:49:33 -07:00
|
|
|
renderCamera={(camera: Camera | null, chooser: JSX.Element) => (
|
|
|
|
<LiveCamera camera={camera} chooser={chooser} />
|
|
|
|
)}
|
2021-03-26 13:43:04 -07:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export { MultiviewChooser } from "./Multiview";
|
|
|
|
export default Live;
|