how to get a hangout url from the hangout button

让人想犯罪 __ 提交于 2019-12-07 19:44:26

问题


I want to store the hangout url in a variable after the hangout is initiated on my website. I am using this:

<head>
  <script src="https://apis.google.com/js/platform.js" async defer></script>
</head>

<body>
  <g:hangout render="createhangout" 
   initial_apps="[{ app_id : '184219133185', start_data : 'dQw4w9WgXcQ' }]"             widget_size="175">
  </g:hangout>
</body>

I know I have to use gethangoutUrl() I just don't know the syntax to use it in. Or where to use it.


回答1:


The answer is: In the gadget or xml file.

Nothing gets returned to your website that you render the button, it is all in the hangout itself. Pass a token in the start_data variable and then in the xml that launches the hangout, you will want to use that as the key in an ajax call back to your app along with any other gapi.hangout data you want associated with that initiated hangout.

var registerHangout = function() {
  var hangoutUrl = gapi.hangout.getHangoutUrl();
  var callbackUrl = 'http://yourwebsite.com/hangout_registration';
  var startData = gapi.hangout.getStartData();

  $.ajax({
    type: "POST",
    url: callbackUrl,
    success: successFunc,
    dataType: 'json',
    data: JSON.stringify({
            "hangoutUrl": hangoutUrl,
            "startData": startData
           })
  });
}


来源:https://stackoverflow.com/questions/29925659/how-to-get-a-hangout-url-from-the-hangout-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!