[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-08-29 UTC"],[],[],null,["# Collaborate using a Meet add-on\n\nParticipants in a meeting can work collaboratively on a\nGoogle Meet add-on activity. When a collaborative activity starts,\nall participants in the meeting receive a notification that the activity is\nongoing.\n\nThis notification is adapted to the availability and installation status of the\nadd-on:\n\n- **If the participant has the add-on installed**:\n They can join the activity.\n\n- **If the participant doesn't have the add-on\n installed**: They're directed to install the\n add-on.\n\n- **If the add-on isn't available for the\n participant's platform**: They're informed that they can't join the activity\n using their current device.\n\nWhen a user joins the activity they will load their own iframes with your\nadd-on content. You can customize whether new joiners\nshould open the collaborative activity in the main stage or side panel.\n\nStart the activity\n------------------\n\nAn activity is started by calling the\n[`startActivity()`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetaddonclient.startactivity)\nmethod, which uses the\n[`ActivityStartingState`](/workspace/meet/add-ons/reference/websdk/addon_sdk.activitystartingstate)\ninterface.\n\n### Step 1 (Optional): The add-on sets the activity starting state\n\nThe [`ActivityStartingState`](/workspace/meet/add-ons/reference/websdk/addon_sdk.activitystartingstate)\ncontains information about the initial state of the\nadd-on that's used when the participant accepts the\ninvitation to join the activity.\n\nThe add-on can set or update the\n`ActivityStartingState` by calling the [`setActivityStartingState()`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetaddonclient.setactivitystartingstate)\nmethod anytime before or during the activity. Calls to\n`setActivityStartingState()` can be omitted if the `ActivityStartingState` is\nexclusively set in the call to `startActivity()`.\n\n### Step 2: The add-on starts the activity\n\nThe activity begins when the add-on calls the\n[`startActivity()`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetaddonclient.startactivity)\nmethod on the [`MeetSidePanelClient`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetsidepanelclient).\nThe `startActivity()` method takes an `ActivityStartingState` object as a\nparameter, so `startActivity()` can be called instead of calling\n`setActivityStartingState()`.\n\nOnce the user completes the content selection and is ready to start an activity,\ncall the `startActivity()` method in your add-on as\nfollows: \n\n sidePanelClient.startActivity({\n mainStageUrl: \"https://app.example.com/mainstage\",\n additionalData: JSON.stringify({\n // State to send to participants.\n })\n });\n\nWhen `startActivity()` method is invoked, Meet performs the\nfollowing actions:\n\n- **For other participants**: Meet shows a notification that\n the activity is ongoing.\n\n- **For the initiator** : If a main stage URL was specified in the\n `ActivityStartingState`, Meet opens the main stage using\n the URL from the `ActivityStartingState`.\n\n### Step 3: Get the activity starting state\n\nWhen a user joins the activity, they load your add-on\ninto the main stage or side panel depending on the `ActivityStartingState`.\n\nWith the `additionalData` property, you can share initial data (also referred to\nas state) with users joining the activity. After [initializing a\n`MainStageClient` or `SidePanelClient`](/workspace/meet/add-ons/guides/get-client), you\ncan call the\n[`getActivityStartingState()`](/workspace/meet/add-ons/reference/websdk/addon_sdk.meetaddonclient.getactivitystartingstate)\nmethod to retrieve the `additionalData` property. \n\n const startingState = client.getActivityStartingState();\n const additionalData = JSON.parse(startingState.additionalData);\n\n### Step 4 (Optional): Share add-on state in an activity\n\nYou may also share state between users while the activity is ongoing. You can\nshare state in two ways:\n\n- Handle it yourself by authoring your own synchronization backend.\n- Use the [Co-Doing API](/workspace/meet/add-ons/guides/use-CoDoingAPI), which is a convenient and fast way to share arbitrary data between users.\n\nExample: Animation add-on on GitHub\n-----------------------------------\n\nThe [\"Animation\" sample add-on on GitHub](https://github.com/googleworkspace/meet/tree/3311b735550b8927c8b7ef2c6d06f768d9fe0476/addons-web-sdk/samples/animation-next-js)\nincludes collaboration in an add-on. [Step 1](#set-state)\nfrom this guide is not included in the sample. Instead, when the\nadd-on initiator clicks the\n[\"Start the Animation\" button](https://github.com/googleworkspace/meet/blob/3311b735550b8927c8b7ef2c6d06f768d9fe0476/addons-web-sdk/samples/animation-next-js/src/app/sidepanel/page.tsx#L72)\nin the side panel, the `startActivity()` method is called ([Step 2](#start-add-on-activity))\nby populating the starting state with the user's selected color. After the\nactivity starts, the main stage retrieves the starting state by\n[calling the `getActivityStartingState()` method](https://github.com/googleworkspace/meet/blob/3311b735550b8927c8b7ef2c6d06f768d9fe0476/addons-web-sdk/samples/animation-next-js/src/app/mainstage/page.tsx#L34)\n([Step 3](#get-state)). [Step 4](#share-state) is omitted, as state (the\nselected color) is not shared between participants during the activity in this\nsample add-on. Individual users can, however, change\ntheir own state by selecting a color, which is sent from the side panel frame to\nthe main stage frame using [frame-to-frame messaging](/workspace/meet/add-ons/guides/frame-to-frame-messaging).\n\nConstraints\n-----------\n\n- The URLs specified in the `ActivityStartingState` must belong to the same [origin](/workspace/meet/add-ons/guides/overview#origin) as the origins specified in the [add-on manifest](/workspace/meet/add-ons/guides/deploy-add-on#create-deployment). For more information, see [Add-on security](/workspace/meet/add-ons/guides/add-on-security).\n- The [`sidePanelUrl`](/workspace/meet/add-ons/reference/websdk/addon_sdk.activitystartingstate.sidepanelurl) property, [`mainStageUrl`](/workspace/meet/add-ons/reference/websdk/addon_sdk.activitystartingstate.mainstageurl) property, and [`additionalData`](/workspace/meet/add-ons/reference/websdk/addon_sdk.activitystartingstate.additionaldata) property character lengths must conform to their respective size limits as published in the SDK reference docs.\n\nRelated topics\n--------------\n\n- [Use the activity starting state](/workspace/meet/add-ons/guides/activity-starting-state)\n- [Use a Meet add-on](/workspace/meet/add-ons/guides/use-add-on)\n- [Implement the Co-Doing API](/workspace/meet/add-ons/guides/use-CoDoingAPI)\n- [Add-on security](/workspace/meet/add-ons/guides/add-on-security)"]]