Skip to content

Publishing bitrate constraints support

Since iOS SDK build 2.6.53 it is possible to set minimum and maximum publishing bitrate constrains using FPWCSApi2VideoConstraints.minBitrate, FPWCSApi2VideoConstraints.maxBitrate parameters. The bitrate constraints values are set in kbps.

ObjectiveC sample code

- (FPWCSApi2MediaConstraints *)toMediaConstraints {
    FPWCSApi2MediaConstraints *ret = [[FPWCSApi2MediaConstraints alloc] init];
    if ([_sendVideo.control isOn]) {
        FPWCSApi2VideoConstraints *video = [[FPWCSApi2VideoConstraints alloc] init];
        ...
        video.minBitrate = [_minVideoBitrate.input.text integerValue];
        video.maxBitrate = [_maxVideoBitrate.input.text integerValue];
        ret.video = video;
    }
    return ret;
}

Swift sample code

func toMediaConstraints() -> FPWCSApi2MediaConstraints {
    let ret = FPWCSApi2MediaConstraints()
    if (self.videoSend.isOn) {
        let video = FPWCSApi2VideoConstraints()
        ...
        video.minBitrate = Int(videoMinBitrate.text ?? "0") ?? 0
        video.maxBitrate = Int(videoMaxBitrate.text ?? "0") ?? 0
        ret.video = video;
    }
    return ret;
}