Skip to content

The free and privacy-friendly screen recorder with no limits πŸŽ₯

842 B
Raw Blame
import React, { useEffect } from "react";
import CloudRecorder from "../CloudRecorder/CloudRecorder";
import Recorder from "../Recorder/Recorder";

// ?cloud=1 β†’ CloudRecorder (TUS), ?resume=1 β†’ silent upload resume, default β†’ local Recorder.
const urlParams = new URLSearchParams(window.location.search);
const IS_CLOUD = urlParams.get("cloud") === "1";
const IS_RESUME = urlParams.get("resume") === "1";

const OffscreenRecorder = () => {
  useEffect(() => {
    if (IS_RESUME) return;
    chrome.runtime.sendMessage({ type: "offscreen-ready" }).catch((err) => {
      console.warn("[OffscreenRecorder] offscreen-ready send failed", err);
    });
  }, []);

  if (IS_RESUME) {
    return null; // minimal shell, handler runs in index.jsx
  }
  return IS_CLOUD ? <CloudRecorder /> : <Recorder />;
};

export default OffscreenRecorder;