ZoomVideoSDKVideoSource onInitialize() is not called

Meeting SDK Type and Version

Android Version 2.2.10 Kotlin (and lower, see description)

Description

When joining a session with an external video source, source’s onInitialize function is only called rarely. onStartSend is called reliably, whether I begin my session with localVideoOn = true or if I start with it false and wait for the onSessionJoin callback and run ZoomVideoSDK.getInstance().videoHelper.startVideo() inside it (which returns a success code).

I have a custom audio capturer and renderer in the same session and both are working reliably.

Here is how I join the session:

val sdk = ZoomVideoSDK.getInstance()
sdk.addListener(zoomListener)

// Implements ZoomVideoSDKVideoSource
// videoCapturer is a class variable, so I maintain a strong reference to it.
// It has a pushFrame method which internally calls sender.sendVideoFrame, and I can call this reliably.
videoCapturer = ZoomVideoCapturer(familyID, callbacks::onPublishStarted, callbacks::onPublishEnded)

audioRenderer = ZoomAudioRenderer(activity.applicationContext)

val sessionContext = ZoomVideoSDKSessionContext().apply {
    audioOption = ZoomVideoSDKAudioOption().apply {
        connect = true
        mute = false
        isMyVoiceInMix = false
    }
    videoOption = ZoomVideoSDKVideoOption().apply {
        localVideoOn = true
    }
    sessionName = sessionID
    userName = userID
    token = jwtToken
    virtualAudioMic = ZoomAudioCapturer(activity.applicationContext)
    virtualAudioSpeaker = audioRenderer
    externalVideoSource = videoCapturer
}
sdk.joinSession(sessionContext)

ZoomVideoCapturer has this in it:

override fun onInitialize(
    sender: ZoomVideoSDKVideoSender?,
    support_cap_list: MutableList<ZoomVideoSDKVideoCapability>?,
    suggest_cap: ZoomVideoSDKVideoCapability?
) {
    Timber.d("onInitialize, null = ${sender == null}, ${support_cap_list == null}, ${suggest_cap == null}")
    this.sender = sender
    readyToSend = sender != null
}

The SDK has previously been initialized like this:

val sdk = ZoomVideoSDK.getInstance()
val params = ZoomVideoSDKInitParams().apply {
    domain = "zoom.us"
    enableLog = true // Optional: enable logging for debugging
    videoRawDataMemoryMode = ZoomVideoSDKRawDataMemoryMode.ZoomVideoSDKRawDataMemoryModeHeap
    audioRawDataMemoryMode = ZoomVideoSDKRawDataMemoryMode.ZoomVideoSDKRawDataMemoryModeHeap
}
sdk.initialize(context, params).let {
    ZoomErrors.msgOrNull(it)?.let { msg ->
        Timber.e("Failed to init zoom sdk: $msg")
    }
}

Troubleshooting Routes

I’ve experimented with the following SDK versions with no difference in behaviour:
2.2.10, 2.2.5, 2.2.0, 2.1.13, 1.14.1

Restarting the app, or rebooting the device seems to make no difference.

Comments

Because of the intermittent nature, I’m wondering about the possibility of a race condition, or sensitivity to network conditions. Are there any other pieces of setup I need ensure have finished before starting the session with an external video source? Or are there any known reasons why onInitialize wouldn’t be called, but onStartSend would?

Thanks a lot!
Michael

Well, it looks like the key here is to join the session on the main thread. Changing to this code solved the problem.

activity.runOnUiThread {
    sdk.joinSession(sessionContext)
}

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