Error 6114 when starting video with Virtual Background before dualModel.bin finishes loading in slow network

We are experiencing error 6114 when using Virtual Background in slow network environments.

If startVideo() is called with the virtualBackground option before the model (dualModel.bin) finishes loading, the SDK returns error 6114 and the camera cannot be started.

Currently we are considering the following flow:

  1. Call startVideo() without Virtual Background.
  2. Wait for the event video-virtual-background-preload-change to confirm the model is ready.
  3. Apply Virtual Background only after the event is received.

We would like to clarify:

  1. Is using the video-virtual-background-preload-change event the recommended and optimal approach to avoid error 6114?
  2. Does this event only fire after joining a session?
  3. If yes, how should we handle Preview mode (startPreviewVideo)?
    • Since preview mode does not seem to trigger the preload event, what is the recommended way to apply Virtual Background safely in preview?
  4. Is there any official lazy loading mechanism or best practice for loading the Virtual Background model before startPreviewVideo?
  5. What is the official recommended sequence for enabling Virtual Background in both meeting mode and preview mode?

Please advise the optimal implementation to handle slow networks and avoid error 6114.

Hey @Thong1

Thanks for your feedback.

  1. Is using the video-virtual-background-preload-change event the recommended and optimal approach to avoid error 6114?

In fact, even without listening to the video-virtual-background-preload-change event, if a virtual background is set, the Video SDK will wait until the VB model is ready before starting video.

This event simply provides more detailed information about the virtual background status. Typically, error 6114 occurs because the GPU does not support loading and compiling the model. We will improve stream.isSupportVirtualBackground() to return more accurate results in the next release.

  1. Does this event only fire after joining a session?

Yes. But if the browser does not support virtual background, the Video SDK will not initialize the VB model, and therefore this event will not be triggered.

  1. If yes, how should we handle Preview mode (startPreviewVideo)?
  • Since preview mode does not seem to trigger the preload event, what is the recommended way to apply Virtual Background safely in preview?

If it is not supported, we will throw an error when calling localVideoTrack.start() with a virtual background image.

  1. Is there any official lazy loading mechanism or best practice for loading the Virtual Background model before startPreviewVideo?

Currently, no lazy loading mechanism.

  1. What is the official recommended sequence for enabling Virtual Background in both meeting mode and preview mode?

Before enabling virtual background, call the stream.isSupportVirtualBackground() method to check whether the current browser supports it.

Thanks
Vic

@vic.yang Thanks for the explanation.

Currently we are considering the following implementation flow:

  • Call startVideo() without enabling Virtual Background.
  • Wait for the video-virtual-background-preload-change event to confirm that the VB model has finished loading.
  • Apply Virtual Background only after this event is received.

With this approach, we would like to confirm the following:

  1. Is this flow considered the correct and recommended way to avoid error 6114 in meeting mode?
  2. In Preview mode (startPreviewVideo), since the preload-change event is not triggered, what is the recommended approach to safely enable Virtual Background?
  3. Should we always rely only on stream.isSupportVirtualBackground() in preview mode, or is there any other reliable method to determine whether the VB model is ready before starting preview?
  4. Is there any best practice or official sample flow you can suggest for handling both meeting mode and preview mode consistently?

Any guidance would be greatly appreciated.

Hi @Thong1

Should we always rely only on stream.isSupportVirtualBackground() in preview mode, or is there any other reliable method to determine whether the VB model is ready before starting preview?

Yes. Currently, the only static detection method is stream.isSupportVirtualBackground(). However, whether virtual background can actually enable may also depend on runtime conditions such as available memory. If enabling it fails, an error will still be returned.

Thanks
Vic