I couldn't reach APP object inside an embedded jitsi iFrame

Hello,

I hope my post is respecting community guildelines, please tell me if anything is wrong.

I have to work with the external API of Jitsi.
The iFrame is already embedded in the project where I’m working.

It’s a web app, running on node and express. Nothing too special.

I have a need where I have to listen to a specific events (which are LOCAL_STATE_UPDATED and REMOTE_STATE_UPDATED).

The iFrame API seems to not provide a listener for those.

I’ve seen that if I use the ‘APP’ object inside a meet.jit.si conference, I have access to a method called ‘addConferenceListener’ inside the ‘conference’ property.

Which actually let me listen to my two events (LOCAL/REMOTE + _STATE_UPDATED).

But, in my embedded iFrame, I do not have this property.

I obviously get this error :

Uncaught ReferenceError: APP is not defined
at <anonymous>:1:1

I do not understand why.

So far, I understood that the ‘APP’ object is a wrapper that use the lib-jitsi-meet API (the low level one). So why do I not have access to it in my embedded iFrame (on localhost AND on the hosted domain which is the production mode), but I have access in the official meet jit si website ?

Thanks.

I can provide more informations if needed.

If you are talking about the dev console in the web browser, there is a drop-down with context which you can switch and when you are inside the iframe context, that will work from the console. But if you want to use that outside the iframe context, in your js code, that will not work.

Thanks for your answer,

Yes I’ve tested on the console. So yes, the contexte was already selected in the cases where i got this APP object.

I understand now.

So really it’s not doable to access those within our code ? It is because the iFrame is from another domain?
I’m going to research that by myself of course, but if you have a hint, it will be appreciated!

Thanks again, have a great day.

[EDIT]
Okay I managed to get a good grasp of that. I got to access to the APP property through the contentWindow property of the iFrame DOM element.
Which eventually return me sort of a CORS error, which is normal.
It will work if I host my own jitsi instance on the same domain !