This documentation is for reference only. We are no longer onboarding new customers to Programmable Video. Existing customers can continue to use the product until December 5, 2026.
We recommend migrating your application to the API provided by our preferred video partner, Zoom. We've prepared this migration guide to assist you in minimizing any service disruption.
You can customize the properties of the video produced by a TVIVideoCapturer
using TVIVideoConstraints
. Constraints allow you to choose at runtime between one of the many TVIVideoFormat
s that are supported by the capturer. The included TVICameraCapturer
class exposes formats based upon what your device's cameras are capable of.
Constraints allow you to filter by several criteria including size, frame rate, and aspect ratio. While constraints are used to resolve the actual capture format, the video sent to other Participants may be downscaled (temporally or spatially) in response to network and device conditions.
In Swift
_21// Create camera object_21let camera = TVICameraCapturer(source: .frontCamera)_21_21// Setup the video constraints_21let videoConstraints = TVIVideoConstraints { (constraints) in_21 constraints.maxSize = TVIVideoConstraintsSize960x540_21 constraints.minSize = TVIVideoConstraintsSize960x540_21 constraints.maxFrameRate = TVIVideoConstraintsFrameRateNone_21 constraints.minFrameRate = TVIVideoConstraintsFrameRateNone_21}_21_21// Add local video track with camera and video constraints_21localVideoTrack = TVILocalVideoTrack(capturer: capturer,_21 enabled: true,_21 constraints: videoConstraints,_21 name: "Screen")_21_21// If the constraints are not satisfied, a nil track will be returned._21if (localVideoTrack == nil) {_21 print ("Error: Failed to create a video track using the local camera.")_21}
In Objective-C
_22// Create camera object_22TVICameraCapturer *camera = = [[TVICameraCapturer alloc] init];_22_22// Setup the video constraints_22TVIVideoConstraints *videoConstraints = [TVIVideoConstraints constraintsWithBlock:_22 ^(TVIVideoConstraintsBuilder * _Nonnull builder) {_22 builder.maxSize = TVIVideoConstraintsSize960x540;_22 builder.minSize = TVIVideoConstraintsSize960x540;_22 builder.maxFrameRate = TVIVideoConstraintsFrameRateNone;_22 builder.minFrameRate = TVIVideoConstraintsFrameRateNone;_22}];_22_22// Add local video track with camera and video constraints_22TVIVideoTrack *localVideoTrack = [TVILocalVideoTrack trackWithCapturer:camera_22 enabled:YES_22 constraints:videoConstraints_22 name:@"Camera"];_22_22// If the constraints are not satisfied, a nil track will be returned._22if (localVideoTrack == nil) {_22 NSLog(@"Error: Failed to create a video track using the local camera.");_22}