This page describes how to manage client objects that an add-on needs to communicate with Google Meet.
First, the add-on needs to establish a session:
const session = await window.meet.addon.createAddonSession({
cloudProjectNumber: "CLOUD_PROJECT_NUMBER",
});
Replace CLOUD_PROJECT_NUMBER with the project number of your Google Cloud project.
From the session, two client objects can be created:
The
MeetMainStageClientfor an add-on running in the main stage, retrievable usingawait session.createMainStageClient().The
MeetSidePanelClientfor an add-on running in the side panel, retrievable usingawait session.createSidePanelClient().
It's important to retrieve the correct client object for either the main stage
or side panel. If the wrong client is retrieved, the Google Meet add-ons SDK throws
an exception. To check which iframe (main stage or side panel) the
add-on is running in, use the
getFrameType()
method.
The following code sample shows how to instantiate the main stage client object:
const session = await window.meet.addon.createAddonSession({
cloudProjectNumber: "CLOUD_PROJECT_NUMBER"
});
const mainStageClient = await session.createMainStageClient();
Replace CLOUD_PROJECT_NUMBER with the project number of your Cloud project.
Shared features
Some features are available in both the MeetMainStageClient and the
MeetSidePanelClient object, whereas other features are specific to a certain
client.
For example, some features that are available in both clients include:
- The
getActivityStartingState()method that gets information about the initial state of the add-on when the participant accepts the invitation to join the activity. - The
getMeetingInfo()method that gets details about the meeting in which the add-on is running. - The
setActivityStartingState()method that sets the initial state of the add-on when the participant accepts the invitation to join the activity. - For a comprehensive list of features in both clients, see the
MeetAddonClientobject.
Client-specific features
Features available only in the
MeetMainStageClient
object:
The
notifySidePanel()method sends a message to the side panel. The message can be received by subscribing to theframeToFrameMessagecallback in the side panel.The
loadSidePanel()method opens the side-panel iframe. The iframe source is set to the side-panel URL from the manifest file.The
unloadSidePanel()method closes the side-panel iframe. The add-on state isn't retained within Meet when the method is called. It's up to the add-on to persist any add-on state before this method is called.
Features available only in the
MeetSidePanelClient
object:
- The
notifyMainStage()method sends a message to the mainStage. The message can be received by subscribing to theframeToFrameMessagecallback property in the mainstage.