2023-12-20 15:34:27 +01:00
|
|
|
import WebRtcPlayer from "./WebRTCPlayer";
|
|
|
|
import { BirdseyeConfig } from "@/types/frigateConfig";
|
2024-03-03 17:32:47 +01:00
|
|
|
import ActivityIndicator from "../indicators/activity-indicator";
|
2023-12-20 15:34:27 +01:00
|
|
|
import JSMpegPlayer from "./JSMpegPlayer";
|
2024-01-04 00:38:52 +01:00
|
|
|
import MSEPlayer from "./MsePlayer";
|
2023-12-20 15:34:27 +01:00
|
|
|
|
|
|
|
type LivePlayerProps = {
|
|
|
|
birdseyeConfig: BirdseyeConfig;
|
|
|
|
liveMode: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default function BirdseyeLivePlayer({
|
|
|
|
birdseyeConfig,
|
|
|
|
liveMode,
|
|
|
|
}: LivePlayerProps) {
|
|
|
|
if (liveMode == "webrtc") {
|
|
|
|
return (
|
|
|
|
<div className="max-w-5xl">
|
|
|
|
<WebRtcPlayer camera="birdseye" />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
} else if (liveMode == "mse") {
|
2024-01-04 00:38:52 +01:00
|
|
|
if ("MediaSource" in window || "ManagedMediaSource" in window) {
|
|
|
|
return (
|
|
|
|
<div className="max-w-5xl">
|
|
|
|
<MSEPlayer camera="birdseye" />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<div className="w-5xl text-center text-sm">
|
|
|
|
MSE is only supported on iOS 17.1+. You'll need to update if available
|
|
|
|
or use jsmpeg / webRTC streams. See the docs for more info.
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2023-12-20 15:34:27 +01:00
|
|
|
} else if (liveMode == "jsmpeg") {
|
|
|
|
return (
|
|
|
|
<div className={`max-w-[${birdseyeConfig.width}px]`}>
|
|
|
|
<JSMpegPlayer
|
|
|
|
camera="birdseye"
|
|
|
|
width={birdseyeConfig.width}
|
|
|
|
height={birdseyeConfig.height}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
<ActivityIndicator />;
|
|
|
|
}
|
|
|
|
}
|