Bu kılavuzda, örneğin nasıl ayarlanacağı ve çalıştırılacağı açıklanmaktadır Google Meet eklentisi.
Hedefler
- Örneği ayarlayın.
- Örneği çalıştırın.
Ön koşullar
- Google Meet'e erişimi olan bir Google Workspace hesabı.
- Bir Google Cloud projesi.
- Node.js ve npm yüklendi.
Örneği ayarlayın
Çalışma dizininizde şu komutu çalıştırarak proje:
npm init
Çalışma dizininize Express.js'yi yükleyin:
npm install express --save
Meet Eklentileri Web SDK'sını yükleyin:
npm install @googleworkspace/meet-addons --save
Çalışma dizininizde
index.js
adında bir dosya oluşturun ve şu kodu kullanabilirsiniz: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);
Çalışma dizininizde
mainstage.html
adında bir dosya oluşturun ve şu kodu kullanabilirsiniz:<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>
Çalışma dizininizde
sidepanel.html
adında bir dosya oluşturun ve şu kodu kullanabilirsiniz:<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
vesidepanel.html
dosyaları için aşağıdakini değiştirin:CLOUD_PROJECT_NUMBER
: Kuruluşunuzun proje numarası Google Cloud projesi
Çalışma dizininizde https-localhost'u yükleyin. paket:
npm install https-localhost --save
Çalışma dizininizde örneği çalıştırın:
node index.js
Tarayıcınızda
https://localhost:3000/mainstage.html
adresine gidin ve Web sayfalarını doğrulamak içinhttps://localhost:3000/sidepanel.html
.
Meet eklentisini oluşturma
Şu adımları uygulayarak eklentinin dağıtımını ayarlayın: Meet eklentisi oluşturma hakkındaki talimatları inceleyin.
Örneği çalıştırma
Meet'e gidin.
Etkinlikler'i tıklayın.
Eklentileriniz bölümünde
Google Meet Add-ons Quickstart
. Bunu çalıştırmak için ekleyebilirsiniz.