Custom Video Track - iOS
- You can create a Video Track using
createCameraVideoTrack()
method ofVideoSDK
class. - This method can be used to create video track using different encoding parameters, camera facing mode, and optimization mode.
Parameters
-
encoderConfig:
- type: CustomVideoTrackConfig
- required:
false
- default:
h360p_w640p
- You can chose from the below mentioned list of values for the encoder config.
Encoder Config | Resolution | Frame Rate | Bitrate |
---|---|---|---|
h90p_w160p | 160x90 | 15 fps | 60000 kbps |
h180p_w320p | 320x180 | 15 fps | 120000 kbps |
h216p_w384p | 384x216 | 15 fps | 180000 kbps |
h360p_w640p | 640x360 | 20 fps | 300000 kbps |
h540p_w960p | 960x540 | 25 fps | 600000 kbps |
h720p_w1280p | 1280x720 | 30 fps | 2000000 kbps |
h1080p_w1920p | 1920x1080 | 30 fps | 3000000 kbps |
h1440p_w2560p | 2560x1440 | 30 fps | 5000000 kbps |
h2160p_w3840p | 3840x2160 | 30 fps | 8000000 kbps |
h120p_w160p | 160x120 | 15 fps | 80000 kbps |
h180p_w240p | 240x180 | 15 fps | 100000 kbps |
h240p_w320p | 320x240 | 15 fps | 150000 kbps |
h360p_w480p | 480x360 | 20 fps | 225000 kbps |
h480p_w640p | 640x480 | 25 fps | 300000 kbps |
h540p_w720p | 720x540 | 30 fps | 450000 kbps |
h720p_w960p | 960x720 | 30 fps | 1500000 kbps |
h1080p_w1440p | 1440x1080 | 30 fps | 2500000 kbps |
h1440p_w1920p | 1920x1440 | 30 fps | 3500000 kbps |
note
Above mentioned encoder configurations are valid for both, landscape as well as portrait mode.
-
facingMode:
- type:
String
- 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:
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
) else { return }
Custom Audio Track
- You can create a Video Track using
createAudioTrack()
method ofVideoSDK
class. - 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