@@ -222,8 +222,8 @@ class JoinChannelVideoMain: BaseViewController {
222222 --- Background Picker ---
223223 */
224224 @IBOutlet weak var selectBackgroundPicker : Picker !
225- private let backgroundTypes = AgoraVideoBackgroundSourceType . allValues ( )
226- var selectedBackgroundType : AgoraVideoBackgroundSourceType ? {
225+ private let backgroundTypes = AgoraVirtualBackgroundSourceType . allValues ( )
226+ var selectedBackgroundType : AgoraVirtualBackgroundSourceType ? {
227227 let index = self . selectBackgroundPicker. indexOfSelectedItem
228228 if index >= 0 && index < backgroundTypes. count {
229229 return backgroundTypes [ index]
@@ -294,8 +294,8 @@ class JoinChannelVideoMain: BaseViewController {
294294 }
295295
296296 private func setBackground( ) {
297- let backgroundSource = AgoraVideoBackgroundSource ( )
298- backgroundSource. backgroundSourceType = selectedBackgroundType ?? . none
297+ let backgroundSource = AgoraVirtualBackgroundSource ( )
298+ backgroundSource. backgroundSourceType = selectedBackgroundType ?? . img
299299 switch self . selectedBackgroundType {
300300 case . color:
301301 backgroundSource. color = 0x000000
@@ -308,7 +308,7 @@ class JoinChannelVideoMain: BaseViewController {
308308 default :
309309 break
310310 }
311- agoraKit. enableVideoBackgroundSubstitution ( true , backData: backgroundSource)
311+ agoraKit. enableVirtualBackground ( true , backData: backgroundSource)
312312 }
313313
314314 func layoutVideos( _ count: Int ) {
@@ -530,7 +530,8 @@ extension JoinChannelVideoMain: AgoraRtcEngineDelegate {
530530 /// Reports the video background substitution success or failed.
531531 /// @param enabled whether background substitution is enabled.
532532 /// @param reason The reason of the background substitution callback. See [AgoraVideoBackgroundSourceStateReason](AgoraVideoBackgroundSourceStateReason).
533- func rtcEngine( _ engine: AgoraRtcEngineKit , videoBackgroundSourceEnabled enabled: Bool , reason: AgoraVideoBackgroundSourceStateReason ) {
533+
534+ func rtcEngine( _ engine: AgoraRtcEngineKit , virtualBackgroundSourceEnabled enabled: Bool , reason: AgoraVirtualBackgroundSourceStateReason ) {
534535 if reason != . vbsStateReasonSuccess {
535536 LogUtils . log ( message: " background substitution failed to enabled for \( reason. rawValue) " , level: . warning)
536537 }
0 commit comments