1

我有以下视频群聊按钮 js 代码,当用户点击视频群聊按钮时,我希望回调。它不起作用,有什么问题吗?

 gapi.hangout.render('hangout-button', {
  'render': 'createhangout',
  'topic': 'hangout_test',
  'invites': "[{'id': 'xxx@gmail.com', 'invite_type': 'EMAIL'}]",
  'initial_apps': [{
    'app_id': "google_app_id",
    'app_type': 'ROOM_APP',
    'start_data': {
      "user_id": "user_id",
      "user_email": "user_email",
      "token": "token",
      "callback_url": "abc.com/hooks/hangout",
      "host": "abc.com",
      "callback_data": "user_data"
    }
   }],
  'hangout_type': "normal",
  'widget_size': 130
});
4

1 回答 1

0

您需要从 Hanogut 监听事件,onApiReady然后调用getHangoutUrl. gapi.hangout正如他们在此处的文档中所解释的: https ://developers.google.com/+/hangouts/api/gapi.hangout.html#gapi.hangout.ApiReadyEvent

在下面添加相同的代码:

  gapi.hangout.onApiReady.add(function(eventObj) {
    var hangoutUrl = gapi.hangout.getHangoutUrl();
       // After saving the url to a variable, pass it using an Ajax call
    $.ajax({
        type: "POST",
        url: callbackUrl,
        success: successFunc,
        dataType: 'json',
        data: JSON.stringify({
                "hangoutUrl": hangoutUrl,
               })
      });
    });

参考:https ://stackoverflow.com/a/30609147/2545197

于 2016-09-26T19:34:43.963 回答