Skip to content

The free and privacy-friendly screen recorder with no limits 🎥

527 B
Raw Blame
// One id per page load, which is one recording host. Two ids against the same
// bunnyVideoId means two hosts were writing to it. The same id twice means one
// host re-signed. Deliberately not persisted: a reload is a new host.
let _clientSessionId = null;

export const getClientSessionId = () => {
  if (_clientSessionId) return _clientSessionId;
  try {
    _clientSessionId = crypto.randomUUID();
  } catch {
    _clientSessionId = `cs-${Date.now()}-${Math.floor(Math.random() * 1e9)}`;
  }
  return _clientSessionId;
};