JS API中出现Twilio“无法创建房间”错误

问题描述 投票:0回答:1

由于某种原因,我无法像这样直接用JS API创建房间:

TwillioVideo.connect(twillioToken, {name: 'my-name'})
  .then(room => {
    ....
  }, error => {
    console.error('Unable to connect to Room: ' + error.message);
  })

[.connect]方法仅对先前创建的房间有效,例如:

我首先使用C#这样创建房间:

public string CreateRoom(string roomName) {
 TwilioClient.Init(_twilioSettings.AccountSid, _twilioSettings.AuthToken);
 RoomResource room = RoomResource.Create(uniqueName: roomName);
 return room.Sid;
}

然后创建它之后,我可以连接到它没有问题。因此,我被迫在C#API中创建一个房间,然后在JS API中使用它。但我宁愿避免此步骤。

而且,在调用RoomResource.Create(uniqueName: roomName)之前,我还没有找到一种方法来确定具有唯一名称的房间是否已经存在,因为如果存在,则此方法将引发异常。但在这种情况下,我宁愿返回现有房间的SID

请告知

twilio twilio-api
1个回答
0
投票

Twilio开发人员推广人员在这里。

为了通过JS SDK创建房间,您需要在video settings in the Twilio console中启用客户端房间的创建。

Click the button at the bottom of the video settings page to enable client side room creation.

© www.soinside.com 2019 - 2024. All rights reserved.