This document refers to the 1.x version of Twilio Video JS. If you are starting with Twilio Video JS, please use the 2.x version. If you are using a 1.x version of Twilio Video JS, we recommend you to upgrade to the 2.x version.
You can customize the video capture by setting video constraints on a LocalVideoTrack. Setting constraints, lets you optimize the video track to network and device conditions. You can set size constraints, frame rate constraints or the aspect ratio constraints of your choice. Note that video constraints are used to resolve the capture format, but the actual video sent to Participant may be downscaled temporally or spatially in response to network and device conditions.
1const { connect, createLocalTracks } = require('twilio-video');23// Option 14createLocalTracks({5audio: true,6video: { width: 640 },7}).then(localTracks => {8return connect('$TOKEN', {9name: 'my-room-name',10tracks: localTracks,11});12}).then(room => {13console.log(`Connected to Room: ${room.name}`);14});1516// Option 217connect('$TOKEN', {18audio: true,19name: 'my-room-name',20video: { width: 640 },21}).then(room => {22console.log(`Connected to Room: ${room.name}`);23});