2

将 videoroom 插件附加到 Janus 后,在“成功”回调中,我向它发送同步消息

janus.attach(
    {           
        plugin: "janus.plugin.videoroom",
        opaqueId: opaqueId,
        success: function(pluginHandle) {
            roomMaster = pluginHandle;
            var isExist = {
                "request" : "exists",
                "room" : myroom
            };

            roomMaster.send({"message": isExist})
        },

并在控制台中获得响应janus.js,但在文档中告诉插件将向我response发送消息。而且我无法理解 - 我在哪里可以抓住它?

onmessage: function(msg, jsep){

    // is fired only after sending async requests like "join", "start" - not "exists"
    conslole.log(msg);  
}

有人知道吗?

谢谢

4

1 回答 1

7

您可以在请求对象中定义成功回调:

  roomHandle.send({ 
    "message" : {
      request : 'list'
    },
    success: function(result) {
      console.log(result);
    }      
  });
于 2019-04-09T15:50:03.660 回答