REST API: Rooms
概要
The Programmable Video Rooms resource represents a communications session among multiple endpoints using one of Twilio's Programmable Video SDKs. Connected users (Participants) can share video and audio Tracks to the Room, and receive video and audio Tracks from other Participants in the Room.
The Rooms resource lets you dynamically create and complete Rooms and configure a Room's topology and behavior. Use this API to set Room properties such as its name, type, TURN configuration, webhook status callback URL, and the maximum number of Participants.
All Programmable Video REST API resources use the following base URL.
https://video.twilio.com
目次
Room Instance Resource
リソースURI
/v1/Rooms/{RoomNameOrSid}
リソースのプロパティ
Resource Properties in REST API format | |
---|---|
sid
|
The unique string that we created to identify the Room resource. |
status
|
The status of the room. Can be: |
date_created
|
The date and time in GMT when the resource was created specified in ISO 8601 format. |
date_updated
|
The date and time in GMT when the resource was last updated specified in ISO 8601 format. |
account_sid
|
The SID of the Account that created the Room resource. |
enable_turn
|
Deprecated, now always considered to be true. |
unique_name
|
An application-defined string that uniquely identifies the resource. It can be used as a |
status_callback
|
The URL we call using the |
status_callback_method
|
The HTTP method we use to call |
end_time
|
The UTC end time of the room in ISO 8601 format. |
duration
|
The duration of the room in seconds. |
type
|
The type of room. Can be: |
max_participants
|
The maximum number of concurrent Participants allowed in the room. |
max_concurrent_published_tracks
|
The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. |
record_participants_on_connect
|
Whether to start recording when Participants connect. This feature is not available in |
video_codecs
|
An array of the video codecs that are supported when publishing a track in the room. Can be: |
media_region
|
The region for the media server in Group Rooms. Can be: one of the available Media Regions. This feature is not available in |
url
|
The absolute URL of the resource. |
links
|
The URLs of related resources. |
HTTP GET
Returns a single Room resource represented by {RoomNameOrSid}
.
Retrieve an in-progress
Room instance by UniqueName
You can retrieve an in-progress
Room instance object using the Room's UniqueName
. This makes it easier to interact with Twilio's REST API without having to keep track of Twilio's Room SID identifiers.
たとえば、次のようになります。
GET /Rooms/DailyStandup
Will return the Room instance object for the Room DailyStandup
if the room is currently in-progress
. If no Room exists by the name DailyStandup
, or a Room by that name is only in completed
status, the above request will return an HTTP 404 response.
Retrieve an in-progress
or completed
Room instance by RoomSid
A Room's Sid
property is Twilio's own canonical unique identifier for a Room. You can always use the Room Sid
to retrieve the Room, whether the room is in-progress
or completed
.
たとえば、次のようになります。
GET /Rooms/RMxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Will return the Room instance object for the Room with Sid
RMxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
, regardless of its status. If no Room exists with that Sid, the above request will return an HTTP 404 response.
HTTP POST
Modifies a Room resource.
Supported POST parameters
Parameters in REST API format | |
---|---|
sid
Path
|
The SID of the Room resource to update. |
status
必須
|
The new status of the resource. Set to |
Complete a Room
Update a Room's status to completed
with the following request to end the Room. All connected
Participants will be immediately disconnected from the Room.
Rooms List Resource
リソースURI
/v1/Rooms
HTTP POST
Create a new Room with an HTTP POST to the Rooms list resource.
Supported POST parameters
Parameters in REST API format | |
---|---|
enable_turn
オプション
|
Deprecated, now always considered to be true. |
type
オプション
|
The type of room. Can be: |
unique_name
オプション
|
An application-defined string that uniquely identifies the resource. It can be used as a |
status_callback
オプション
|
The URL we should call using the |
status_callback_method
オプション
|
The HTTP method we should use to call |
max_participants
オプション
|
The maximum number of concurrent Participants allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants. |
record_participants_on_connect
オプション
|
Whether to start recording when Participants connect. This feature is not available in |
video_codecs
オプション
|
An array of the video codecs that are supported when publishing a track in the room. Can be: |
media_region
オプション
|
The region for the media server in Group Rooms. Can be: one of the available Media Regions. This feature is not available in |
Note: Rooms created via the REST API exist for five minutes to allow the first Participant to connect. If no Participants join within five minutes, the Room times out and a new Room must be created.
例1: 「DailyStandup」という名前のRoomを作成します
Once a Room is created, generate an Access Token containing the Room name and use one of Twilio's Video SDKs to connect to the Room.
For example, using the JavaScript SDK:
Twilio.Video.connect('$AccessTokenContainingRoomName').then(function(room) { console.log('Successfully joined a Room: ', room); }, function(error) { console.error('Unable to connect to Room: ' + error.message); });
HTTP GET
Returns a list of Room resources created in the given account. The list includes paging information.
リストフィルター
The following GET query string parameters allow you to limit the list returned. Note, parameters are case-sensitive.
Parameters in REST API format | |
---|---|
status
オプション
|
Read only the rooms with this status. Can be: |
unique_name
オプション
|
Read only rooms with the this |
date_created_after
オプション
|
Read only rooms that started on or after this date, given as |
date_created_before
オプション
|
Read only rooms that started before this date, given as |
DailyStandup
という名前を含むRoomsの一覧を返します。
Filter Rooms by Status
ヘルプが必要ですか?
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。