This page 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, 2024.
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.
Deprecation Notice - all 1.x Versions |
---|
Please note that all Programmable Video iOS SDK 1.x versions are deprecated. Version 3.x is the latest version of the Programmable Video iOS SDK. Please see the Getting Started Guide for more information. |
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
_20// Create camera object_20let camera = TVICameraCapturer(source: .frontCamera)_20_20// Setup the video constraints_20let videoConstraints = TVIVideoConstraints { (constraints) in_20 constraints.maxSize = TVIVideoConstraintsSize960x540_20 constraints.minSize = TVIVideoConstraintsSize960x540_20 constraints.maxFrameRate = TVIVideoConstraintsFrameRateNone_20 constraints.minFrameRate = TVIVideoConstraintsFrameRateNone_20}_20_20// Add local video track with camera and video constraints_20localVideoTrack = TVILocalVideoTrack(capturer: capturer,_20 enabled: true,_20 constraints: videoConstraints)_20_20// If the constraints are not satisfied, a nil track will be returned._20if (localVideoTrack == nil) {_20 print ("Error: Failed to create a video track using the local camera.")_20}
In Objective-C
_21// Create camera object_21TVICameraCapturer *camera = = [[TVICameraCapturer alloc] init];_21_21// Setup the video constraints_21TVIVideoConstraints *videoConstraints = [TVIVideoConstraints constraintsWithBlock:_21 ^(TVIVideoConstraintsBuilder * _Nonnull builder) {_21 builder.maxSize = TVIVideoConstraintsSize960x540;_21 builder.minSize = TVIVideoConstraintsSize960x540;_21 builder.maxFrameRate = TVIVideoConstraintsFrameRateNone;_21 builder.minFrameRate = TVIVideoConstraintsFrameRateNone;_21}];_21_21// Add local video track with camera and video constraints_21TVIVideoTrack *localVideoTrack = [TVILocalVideoTrack trackWithCapturer:camera_21 enabled:YES_21 constraints:videoConstraints];_21_21// If the constraints are not satisfied, a nil track will be returned._21if (localVideoTrack == nil) {_21 NSLog(@"Error: Failed to create a video track using the local camera.");_21}