this-fifo/jutsu

Returned jitsi object is null from useJitsi call

shawnlauzon opened this issue · 3 comments

Jitsi supports a wide variety of functions that are used to control the iframe. Unfortunately at this point, none of them are available with the React component.

The api object (or client as it's called in the current codebase) might be returned so that it can be used to call functions.

Or is the jitsi object which is returned the thing I can call functions on? And if so, do you happen to have an example?

After looking at the code (and understanding better about hooks), I see that jitsi is the correct object to use. But it's null for me:

  const { loading, error, jitsi } = useJitsi(jitsiConfig);
  jitsi.executeCommand("startRecording", {
    mode: "file",
  });

At runtime:
TypeError: null is not an object (evaluating 'jitsi.executeCommand')

I now see that it normally returns null once, and then returns a proper object later. So if I just ignore the result when it is null, things work out.