Camera/Microphone fails to start or takes too long to initialize

Description
We’re experiencing issues where some users are unable to successfully start their camera and microphone using the Video SDK. In some cases, users report significantly delayed camera/microphone activation, while in others, the camera/microphone fails to start entirely.

Here is sessionIds related to the issue:

Rj6yFdiuQUOMf0/FU9OvGw==
3NojTehpTQ60nFnYHdGVhg 
ouDpy1//TO2D++cXg2jX/Q==

Which Web Video SDK version?
2.1.0

Video SDK Code Snippets

      let videoOptions = {
        cameraId: cameraId,
        originalRatio: window.isMobile
      };

      if (state.mediaStream.isSupportVirtualBackground() && virtualBackground) {
        videoOptions.virtualBackground = { imageUrl: virtualBackground };
      }
      await state.mediaStream.startVideo(videoOptions);
      if (speakerOnly) {
        await state.mediaStream.startAudio({ speakerOnly: true });
      } else {
        await state.mediaStream.startAudio({ mute: mute });
      }

Device (please complete the following information):

  • OS: Window
  • Browser: Edge
  • Browser Version: 138

Hey @lmtruong1512

Rj6yFdiuQUOMf0/FU9OvGw==
3NojTehpTQ60nFnYHdGVhg==
ouDpy1//TO2D++cXg2jX/Q==

After analysis, this is a known issue. In edge cases, it can cause media initialization to fail, resulting in audio and video not starting properly. You can upgrade to version 2.2.0, where we’ve fixed this issue.

Thanks
Vic

1 Like

Hi @vic.yang ,
Could you let us know the conditions under which this bug occurs? We’ve noticed that the frequency of this issue has increased recently, but we’re not sure why.

Recently, we made the following changes:

  • Switched from canvas rendering to video-player rendering
  • Enabled video WebRTC for headless Chrome browsers (This might be unrelated, but could it affect regular users who are not using headless browsers?)

Thank you for your support!

@vic.yang
If we set a timeout when starting the camera and microphone, and automatically retry if the startup hasn’t succeeded within that time, would this temporarily help mitigate the slow CAM/MIC startup issue?

If so, what timeout duration would you recommend for the camera and microphone?

Alternatively, is there another workaround you’d suggest for this problem?

Hi @lmtruong1512

Regarding the timing of the retry, I’m not sure how you’re detecting that the camera and microphone initialization has failed. Since startup times vary across different devices, it’s difficult to define a consistent timeout duration.

Thanks
Vic

Hi @vic.yang,
We don’t determine whether the camera and microphone initialization failed — instead, whenever starting the camera or microphone takes longer than the timeout duration (we’re currently setting it to around 4–5 seconds), we simply restart the process. (We try starting the cam/mic again)
Would this approach have any side effects or potentially affect normal functionality?

Thank you for your time and support!

Hi @lmtruong1512

It seems to be the same issue. I’ve replied in another thread — I’ll include the link here for reference.

Thanks
Vic

1 Like