@@ -188,45 +188,40 @@ class VideoProcessMain : BaseViewController
188188 }
189189
190190 @IBAction func onChangeLowLightEnhance( _ sender: UISwitch ) {
191- let options : [ String : Any ] = [ " enable " : sender . isOn ? 1 : 0 ,
192- " level " : 1 ,
193- " mode " : 0 ]
194- changeVideoEnhancement ( value : options , key : " lowlight_enhance_option " )
191+ let options = AgoraLowlightEnhanceOptions ( )
192+ options . level = . fast
193+ options . mode = . auto
194+ agoraKit . setLowlightEnhanceOptions ( sender . isOn , options : options )
195195 }
196196
197197 @IBAction func onChangeVideoDenoise( _ sender: UISwitch ) {
198- let options : [ String : Any ] = [ " enable " : sender . isOn ? 1 : 0 ,
199- " level " : 0 ,
200- " mode " : 0 ]
201- changeVideoEnhancement ( value : options , key : " video_denoiser_option " )
198+ let options = AgoraVideoDenoiserOptions ( )
199+ options . level = . highQuality
200+ options . mode = . manual
201+ agoraKit . setVideoDenoiserOptions ( sender . isOn , options : options )
202202 }
203203
204204 @IBAction func onChangeColorEnhance( _ sender: UISwitch ) {
205- let options : [ String : Any ] = [ " enable " : colorEnhanceSwitch . isOn ? 1 : 0 ,
206- " strength " : strength ,
207- " skinProtect " : skinProtect ]
208- changeVideoEnhancement ( value : options , key : " color_enhance_option " )
205+ let options = AgoraColorEnhanceOptions ( )
206+ options . strengthLevel = Float ( strength)
207+ options . skinProtectLevel = Float ( skinProtect)
208+ agoraKit . setColorEnhanceOptions ( sender . isOn , options : options )
209209 }
210210
211211 @IBAction func onStrengthSlider( _ sender: UISlider ) {
212212 strength = Double ( sender. value)
213- let options : [ String : Any ] = [ " enable " : colorEnhanceSwitch . isOn ? 1 : 0 ,
214- " strength " : strength ,
215- " skinProtect " : skinProtect ]
216- changeVideoEnhancement ( value : options , key : " color_enhance_option " )
213+ let options = AgoraColorEnhanceOptions ( )
214+ options . strengthLevel = Float ( strength)
215+ options . skinProtectLevel = Float ( skinProtect)
216+ agoraKit . setColorEnhanceOptions ( colorEnhanceSwitch . isOn , options : options )
217217 }
218218
219219 @IBAction func onSkinProtectSlider( _ sender: UISlider ) {
220220 skinProtect = Double ( sender. value)
221- let options : [ String : Any ] = [ " enable " : colorEnhanceSwitch. isOn ? 1 : 0 ,
222- " strength " : strength,
223- " skinProtect " : skinProtect]
224- changeVideoEnhancement ( value: options, key: " color_enhance_option " )
225- }
226-
227- func changeVideoEnhancement( value: [ String : Any ] , key: String ) {
228- guard let data = try ? JSONSerialization . data ( withJSONObject: value, options: . prettyPrinted) else { return }
229- agoraKit. setExtensionPropertyWithVendor ( " agora " , extension: " beauty " , key: key, value: String ( data: data, encoding: . utf8) !)
221+ let options = AgoraColorEnhanceOptions ( )
222+ options. strengthLevel = Float ( strength)
223+ options. skinProtectLevel = Float ( skinProtect)
224+ agoraKit. setColorEnhanceOptions ( colorEnhanceSwitch. isOn, options: options)
230225 }
231226
232227 @IBAction func onChangeVirtualBgSwtich( _ sender: UISwitch ) {
0 commit comments