Black Screen Issue When Toggling Video On/Off – iOS Video SDK

Hello Team,

We are currently facing a black screen issue during the session when toggling the video on/off in our app.

Issue Details:

  • Occurs when toggling the video on/off.
  • The screen goes black temporarily.
  • It resolves automatically or after toggling the video again.
  • Observed primarily in low network conditions.

Technical Details:

  • We are using the latest iOS Video SDK.
  • The issue seems to be SDK-dependent.

Could you please provide insights or suggest any potential fixes for this behavior? Additionally, if required, we can share logs for further analysis.

Looking forward to your guidance.
CC: @ekaansh.zoom

1 Like

Hello Prashant,

Can you please share a code snippet of how you are calling startVideo() / stopVideo() on the Video Helper? Please ensure that you are calling either function on the main thread. Also, you would simply need to call those two functions and not subscribe/unsubscribe, except when the corresponding user joins and leaves.

Thank you for your patience,
Richard

Hello Richard, I am not calling subscribe/unsubscribe at toggle. However, the app was previously crashing when startVideo() was used on the main thread. To resolve this, we moved it to a background thread, as explained in the commented code. Please let me know if there is any quick fix I can apply.

func startVideo() {
if let videoHelper = ZoomVideoSDK.shareInstance()?.getVideoHelper() {
// Start local User’s video.

        /*
         // -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness
         // https://developer.apple.com/forums/thread/722309
         */
        DispatchQueue.global(qos: .background).async { [weak self] in
            guard let self = self else { return }
            videoHelper.startVideo()
            DispatchQueue.main.async {                
                videoHelper.rotateMyVideo(.portrait)
            }
        }
    }
}

func stopVideo() {
    if let videoHelper = ZoomVideoSDK.shareInstance()?.getVideoHelper() {
        // Stop local User's video.
        DispatchQueue.main.async {  [weak self] in
            guard let self = self else { return }
            videoHelper.stopVideo()
        }
    }
}

Hello Prashant,

Thank you for sending in your snippet, I will try to reproduce the issue locally with it. One thing I also want to mention is that start/stop video functionality involves sending this info the MMR so that other people would know your video is on/off. It takes time and cannot be called too frequently. So if someone is toggling the video on/off in quick succession, this might be expected behavior, especially if in an environment with an unstable connection.

Are you experiencing this issue even when someone toggles the video at, say, once every 5+ more seconds?

Thank you for your patience,
Richard

1 Like

Hello Prashant,

An additional thing- startVideo() returns an ZoomVideoSDKError object- you could try printing it out to determine what error code it returns when you receive a black screen.

Also, what kind of crash is occurring when you call startVideo() from the main thread? I must reiterate, you DO need to call start/stop video functions on the main thread. That is a requirement of our SDK.

Thank you for your patience,
Richard

1 Like

Thanks @richard.zoom, currently frequency is very minimal for video on/off black scree.
Will check startVideo() thread changes if that work for me.

I think for now we can close this :slight_smile:

1 Like

This topic was automatically closed 25 hours after the last reply. New replies are no longer allowed.