이 가이드에서는 샘플을 설정하고 실행하는 방법을 설명합니다. Google Meet 부가기능
목표
- 샘플을 설정합니다.
- 샘플을 실행합니다.
기본 요건
- Google Meet에 액세스할 수 있는 Google Workspace 계정
- Google Cloud 프로젝트
- Node.js 및 npm 설치해야 합니다.
샘플 설정
작업 디렉터리에서 다음 명령어를 실행하여 프로젝트:
npm init
작업 디렉터리에 Express.js를 설치합니다.
npm install express --save
Meet 부가기능 웹 SDK를 설치합니다.
npm install @googleworkspace/meet-addons --save
작업 디렉터리에
index.js
라는 파일을 만들고 다음을 붙여넣습니다. 다음 코드를 참조하세요.const express = require('express'); const path = require('path'); var app = express(); app = require("https-localhost")(); app.use(express.static(path.join(__dirname, '/'))); app.use('/', express.static(__dirname + '/node_modules/@googleworkspace/meet-addons')); app.get('/sidepanel', function(req, res){ res.render(path.join(__dirname, 'sidepanel.html')); }); app.get('/mainstage', function(req, res){ res.render(path.join(__dirname, 'mainstage.html')); }); app.listen(3000);
작업 디렉터리에
mainstage.html
라는 파일을 만들고 다음을 붙여넣습니다. 다음 코드를 참조하세요.<html style="width: 100%; height: 100%"> <head> <title>Main Stage Add On</title> <script src="meet.addons.js"></script> </head> <body style="width: 100%; height: 100%; margin: 0; background: white;"> <div style="display: flex; flex-direction: column; height: 100%"> <h1>Main Stage Add-on</h1> <div> <div> <button id="get-collaboration-starting-state"> getCollaborationStartingState </button> </div> <div id="receivedCollaborationStartingState" style="margin-left: 20px; width: 300px; overflow-wrap: anywhere"></div> </div> </div> <script> let mainStageClient; async function init() { const session = await window.meet.addon.createAddonSession({ cloudProjectNumber: "CLOUD_PROJECT_NUMBER", }); console.log("Successfully constructed the add-on session."); const mainStageClient = await session.createMainStageClient(); console.log("Successfully constructed main stage client."); document .getElementById('get-collaboration-starting-state') .addEventListener( 'click', async () => { document.getElementById( 'receivedCollaborationStartingState').textContent = JSON.stringify( await mainStageClient.getCollaborationStartingState()); }); } document.body.onload = () => { init(); }; </script> </body> </html>
작업 디렉터리에
sidepanel.html
라는 파일을 만들고 다음을 붙여넣습니다. 다음 코드를 참조하세요.<html style="width: 100%; height: 100%"> <head> <title>Side Panel Add-on</title> <script src="meet.addons.js"></script> </head> <body style="width: 100%; height: 100%; margin: 0"> <div style="display: flex; flex-direction: column; height: 100%"> <h1>Side Panel Add-on</h1> <div> <div> <button id="set-collaboration-starting-state"> setCollaborationStartingState </button> </div> <div> <input type="text" id="sidePanelIframeUrl" style="margin-left: 20px" value="https://localhost:3000/sidepanel.html" /> </div> <div> <input type="text" id="mainStageIframeUrl" style="margin-left: 20px" value="https://localhost:3000/mainstage.html" /> </div> <div> <input type="text" id="additionalData" style="margin-left: 20px" value="additional data" /> </div> </div> </div> <script> let sidePanelClient; async function init() { const session = await window.meet.addon.createAddonSession({ cloudProjectNumber: "CLOUD_PROJECT_NUMBER", }); console.log("Successfully constructed the add-on session."); sidePanelClient = await session.createSidePanelClient(); console.log("Successfully constructed side panel client."); document .getElementById('set-collaboration-starting-state') .addEventListener( 'click', async () => { const sidePanelIframeUrlInputElement = document.getElementById('sidePanelIframeUrl'); const mainStageIframeUrlInputElement = document.getElementById('mainStageIframeUrl'); const additionalDataInputElement = document.getElementById('additionalData'); await sidePanelClient.setCollaborationStartingState({ sidePanelUrl: sidePanelIframeUrlInputElement.value, mainStageUrl: mainStageIframeUrlInputElement.value, additionalData: additionalDataInputElement.value, }); }); } document.body.onload = () => { init(); }; </script> </body> </html>
mainstage.html
및sidepanel.html
파일에서 다음을 모두 바꿉니다.CLOUD_PROJECT_NUMBER
: 프로젝트의 프로젝트 번호입니다. Google Cloud 프로젝트
작업 디렉터리에 https-localhost를 설치합니다. 패키지:
npm install https-localhost --save
작업 디렉터리에서 샘플을 실행합니다.
node index.js
브라우저에서
https://localhost:3000/mainstage.html
로 이동한 다음https://localhost:3000/sidepanel.html
하여 웹페이지를 인증합니다.
Meet 부가기능 만들기
다음 단계에 따라 부가기능 배포를 설정합니다. Meet 부가기능 빌드 방법에 대한 안내를 따르세요.
샘플 실행
Meet으로 이동합니다.
활동 을 클릭합니다.
내 부가기능 섹션에
Google Meet Add-ons Quickstart
입니다. 이를 선택하여 부가기능