This message was deleted.
# helpdesk
s
This message was deleted.
a
Hmm what version of NextJS are you running? We may need to update the Egress SDK
g
"@livekit/egress-sdk": "^0.1.2"
with
NEXT JS 13
Any insights what version should be compatible with this next js version
a
Oh so I think the problem is you’re calling this from a server component
The Egress SDK will only work on client components
(Server side rendering of live video doesn’t really make sense)
g
Sorry to mention in code i have made this component a client component by declaring 'use client' at top of the component
a
🤨 hmmm okay. If you can upload a minimal reproduction on GitHub or something, that would help a ton. Otherwise I’ll try to reproduce after lunch
… oh wait I just remembered that I’m taking lunch now because GitHub is down 😅
🤣 1
g
Thank you for taking time between your lunch though. I will try to upload a sample POC so you can reproduce
🙏 1
https://github.com/avigator003/Egress-POC commands to run:-
Copy code
npm i 
yarn build
Expected Error: ReferenceError: window is not defined
b
hi akshat, try applying the following changes:
Copy code
function CustomRoom() {
  const [url, setUrl] = useState("");
  const [token, setToken] = useState("");
  const [layout, setLayout] = useState("");

  useEffect(() => {
    setUrl(EgressHelper.getLiveKitURL());
    setToken(EgressHelper.getAccessToken());
    setLayout(EgressHelper.getLayout());
  }, []);

  return (
    <div>
      <RoomPage
        // EgressHelper retrieves parameters passed to the page
        url={url}
        token={token}
        layout={layout}
      />
    </div>
  );
}
you previous code didn't work because we only really have access to the browser's
window
object within a useEffect hook
➕ 1
g
Thank you for the insights.Now egress with custom URL is in working state