Preview audio issue

On us.zoom.videosdk:zoomvideosdk-core 2.1.0 I was doing some testing for Preview of camera , Preview microphone and Preview Speaker.

For this I started a session with these values sessionName = “preCallTest”, sessionPassword = data.sessionPassword, jwtToken = data.token, and I was able to get the self camera feed using the bellow function

fun sdkStartSelfieZoomVideo(screen: ZoomVideoSDKVideoView) {
    val helper = ZoomVideoSDK.getInstance().videoHelper
    helper.startVideo()
    helper.rotateMyVideo(deviceRotation)
    helper.startVideoCanvasPreview(
        // videoView =
        screen,
        // aspect =
        ZoomVideoSDKVideoAspect.ZoomVideoSDKVideoAspect_Original,
    )
}

Then I used the bellow function to test the mic

fun startMicroPhoneTest(testAudioDeviceHelper: ZoomVideoSDKTestAudioDeviceHelper) {
    try {
        val testAudioDeviceHelper = ZoomVideoSDK.getInstance().testAudioDeviceHelper
        val ret: Int = testAudioDeviceHelper.startMicTest()
        loge("startMicroPhoneTest test ret", " $ret -> ${ZoomErrorCode.parseErrorCode(ret)}")
    } catch (ex: Exception) {
        ex.printStackTrace()
    }
}

and I’m getting 9002 → UNKNOWN_ERROR_CODE .
because of that I’m unable to run the bellow code for play mic test.

fun playMicTest() {
    val testAudioDeviceHelper = ZoomVideoSDK.getInstance().testAudioDeviceHelper
    val ret: Int = testAudioDeviceHelper.playMicTest()
    loge("startMicroPhoneTest test ret", " $ret -> ${ZoomErrorCode.parseErrorCode(ret)}")
}

there I’m getting 1 → ERRORS_WRONG_USAGE error.
Am I missing something here.. ? can you please help me here ?

@ekaansh.zoom @ticorrian.heard @chunsiong.zoom @rehema.zoom @tommy @jon.zoom

@ekaansh.zoom @ticorrian.heard can you please have a look into this

Hi @paul.mathew Are you running these test outside of your actual sessions? These functions should be used before or after your session.

Hi @ticorrian.heard ,
I’m using these function while the user is in the session . Because in this doc for Android preview

it says
Users can only test their audio after joining a session with the SDK, for example, if they’re in a waiting room.

In my testing, I use this function before joining a session and while in-session with no issue:

fun startMicroPhoneTest() {
    val testAudioDeviceHelper = ZoomVideoSDK.getInstance().testAudioDeviceHelper
    try {
        val ret: Int = testAudioDeviceHelper.startMicTest()
        println("startMicroPhoneTest test ret")
    } catch (ex: Exception) {
        ex.printStackTrace()
    }
}

Can you try that and let me know if that works?