blakeblackshear.frigate/web/src/components/player/BirdseyeLivePlayer.tsx
Josh Hawkins d2ab44ce72 Reactify MSE player component (#9163)
* make mse a functional component with react hooks

* iOS 17 fixes

* birdseye mse

* remove debug

* fix test
2024-01-31 12:56:11 +00:00

51 lines
1.3 KiB
TypeScript

import WebRtcPlayer from "./WebRTCPlayer";
import { BirdseyeConfig } from "@/types/frigateConfig";
import ActivityIndicator from "../ui/activity-indicator";
import JSMpegPlayer from "./JSMpegPlayer";
import MSEPlayer from "./MsePlayer";
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") {
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>
);
}
} else if (liveMode == "jsmpeg") {
return (
<div className={`max-w-[${birdseyeConfig.width}px]`}>
<JSMpegPlayer
camera="birdseye"
width={birdseyeConfig.width}
height={birdseyeConfig.height}
/>
</div>
);
} else {
<ActivityIndicator />;
}
}