Twilio Video Rooms allow you to configure the maximum amount of time that a Participant can be connected to the Room. The default maximum Participant duration for Video Rooms is four hours and the maximum amount of time a Participant can be connected to a Room is 24 hours. Once a Participant has been connected to a Room for the Room's maximum Participant duration, they will be disconnected from the Room.
If you wish to configure the maximum Participant duration for you Video Rooms, you can do so in two ways: via the Twilio REST API, or via the Twilio Console.
You can configure the maximum Participant duration for Video Rooms on a per-Room basis during Room creation using the REST API. When creating the Room, you can specify the maximum Participant duration in seconds.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createRoom() {11const room = await client.video.v1.rooms.create({12maxParticipantDuration: 86400,13uniqueName: "My Video Room",14});1516console.log(room.sid);17}1819createRoom();
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"date_created": "2015-07-30T20:00:00Z",4"date_updated": "2015-07-30T20:00:00Z",5"status": "in-progress",6"type": "peer-to-peer",7"sid": "RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",8"enable_turn": true,9"unique_name": "My Video Room",10"max_concurrent_published_tracks": 0,11"max_participants": 10,12"max_participant_duration": 86400,13"duration": 0,14"status_callback_method": "POST",15"status_callback": null,16"record_participants_on_connect": false,17"video_codecs": [18"VP8"19],20"media_region": "us1",21"audio_only": false,22"empty_room_timeout": 5,23"unused_room_timeout": 5,24"end_time": "2015-07-30T20:00:00Z",25"large_room": false,26"url": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",27"links": {28"participants": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",29"recordings": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings",30"recording_rules": "https://video.twilio.com/v1/Rooms/RMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/RecordingRules"31}32}
In the Twilio Console, you can update the default maximum Participant duration for all of the Video Rooms created in your account. After you update this value in the Console, any new Rooms that you create without explicitly setting the maximum Participant duration will take this configured value.
To update this value, navigate to Room Settings section in the Console, where you will be able to update the value. Note that the duration should be specified in seconds.
By default, PSTN Participants are limited to a four-hour maximum duration. You can enable the 24-hour maximum duration in your Programmable Voice Settings console.