Custom Video Track - iOS
- You can create a Video Track using
createCameraVideoTrack()method ofVideoSDKclass. - This method can be used to create video track using different encoding parameters, camera facing mode, bitrateMode and optimization mode.
Parameters
-
encoderConfig:
- type:
CustomVideoTrackConfig - required:
false - default:
h360p_w640p - You can choose from the below mentioned list of values for the encoder config.
- type:
| Config | Resolution | Frame Rate | Optimized (kbps) | Balanced (kbps) | High Quality (kbps) |
|---|---|---|---|---|---|
| h90p_w160p | 160x90 | 30 fps | 40 | 90 | 120 |
| h180p_w320p | 320x180 | 30 fps | 60 | 120 | 180 |
| h360p_w640p | 640x360 | 30 fps | 300 | 450 | 600 |
| h540p_w960p | 960x540 | 30 fps | 600 | 900 | 1200 |
| h720p_w1280p | 1280x720 | 30 fps | 1000 | 1500 | 2000 |
| h1080p_w1920p | 1920x1080 | 30 fps | 1500 | 2500 | 3500 |
| h120p_w160p | 160x120 | 30 fps | 40 | 90 | 120 |
| h180p_w240p | 240x180 | 30 fps | 90 | 120 | 180 |
| h240p_w320p | 320x240 | 30 fps | 100 | 150 | 200 |
| h360p_w480p | 480x360 | 30 fps | 270 | 360 | 540 |
| h480p_w640p | 640x480 | 30 fps | 350 | 600 | 900 |
| h720p_w960p | 960x720 | 30 fps | 900 | 1200 | 1600 |
| h1080p_w1440p | 1440x1080 | 30 fps | 1800 | 2200 | 3000 |
note
Above mentioned encoder configurations are valid for both, landscape as well as portrait mode.
-
facingMode:
- type:
AVCaptureDevice.Position - required:
false - Allowed values :
.front|.back - It will specify whether to use front or back camera for the video track.
- type:
-
multiStream
- type:
boolean - required:
false - default:
true - It will specify if the stream should send multiple resolution layers or single resolution layer.
- type:
-
codec
- type:
String - required:
false - default:
VP8 - A video codec for compresses video data for efficient transmission over the internet, balancing quality and bandwidth usage.
- type:
-
bitrateMode:
- type:
BitrateMode - required:
false - Allowed values :
BitrateMode.BANDWIDTH_OPTIMIZED|BitrateMode.BALANCED|BitrateMode.HIGH_QUALITY - Controls the video quality and bandwidth consumption. You can choose between
BitrateMode.HIGH_QUALITYfor the best picture,BitrateMode.BANDWIDTH_OPTIMIZEDto save data, orBitrateMode.BALANCEDfor a mix of both. Defaults toBitrateMode.BALANCED.
- type:
-
maxLayer:
- type:
EncodingLayer - required:
false - Allowed values :
MAX_LAYER_2|MAX_LAYER_3 - default:
MAX_LAYER_3 - Specifies the maximum number of simulcast layers to publish. This parameter only has an effect if
multiStreamis set to true.
- type:
info
- To learn more about optimizations and best practices for using custom video tracks, follow this guide.
- This parameter is only available from
v2.0.6.
Returns
RTCVideoTrack
Example
guard let videoMediaTrack = try? VideoSDK.createCameraVideoTrack(
encoderConfig: .h720p_w1280p,
facingMode: .front,
multiStream: true,
codec: .H264, // Default: .VP8
bitrateMode: .HIGH_QUALITY, // Default: .BALANCED,
maxLayer: .MAX_LAYER_2 // Default: .MAX_LAYER_3
) else { return }
Custom Audio Track
- You can create a Video Track using
createAudioTrack()method ofVideoSDKclass. - This method can be used to create audio track using different noise configs.
Parameters
-
noiseConfig
-
noiseSuppression
- type:
Bool - required:
false - If
true, noise suppression would be turned on; otherwise, it would be off.
- type:
-
echoCancellation
- type:
Bool - required:
false - If
true, echo cancellation would be turned on; otherwise, it would be off.
- type:
-
autoGainControl
- type:
Bool - required:
false - If
true, autogain control would be turned on; otherwise, it would be off.
- type:
-
highPassFilter
- type:
Bool - required:
false - If
true, highpass filter would be turned on; otherwise, it would be off.
- type:
-
Returns
RTCAudioTrack
Example
guard
let audioMediaTrack = try? VideoSDK.createAudioTrack(
noiseConfig: noiseConfig(
noiseSupression: true,
echoCancellation: true,
autoGainControl: true,
highPassFilter: true
)
)
else { return }
Got a Question? Ask us on discord

