2014-04-30 29 views
3

我試圖使用API​​爲Google環聊製作應用。我想我不是唯一有這個「問題」的人。谷歌環聊API - 按鈕添加/邀請參與者就像在Toyoya環聊應用程序?

我需要自動或半自動地添加參與者。但我找不到辦法。今天我找到了一個類似的應用程序。它被稱爲「Toyoya Hangout App」。有一個視頻解釋它是如何工作的。重點在於,他們在第二十四次點擊一個名爲「與專家對話」的按鈕,添加一位參與者。

https://www.youtube.com/watch?v=vS0NABykrzU#t=38

做一些你知道該怎麼做?在Youtube視頻說明中表示,他們已經在Google+上使用該應用。這是僅適用於「環聊企業」的功能嗎?

謝謝!

回答

4

使用視頻羣聊按鈕下面。

<div class="google_hangout" id="google_hangout"> 
    <h3 class="heading">Google Hangout with requestor</h3> 
    <div id="placeholder-div"></div> 
</div> 

現在,異步加載JS幷包含您想要在初始化時傳遞到環聊的參數。

(function() { 
    var po = document.createElement('script'); 
    po.type = 'text/javascript'; 
    po.async = true; 
    po.src = 'https://apis.google.com/js/platform.js?onload=renderButtons'; 
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); 
})(); 

下面我們將通過電子郵件作爲字符串。

function renderButtons(){ 
    gapi.hangout.render('placeholder-div', { 
    'render': 'createhangout', 
    'invites' : "[{'id': '[email protected]','invite_type': 'EMAIL'}]", 
    'widget_size': 72 
    }); 
}