Preview

Before and after joining a session, you can give users a preview of their video and audio by starting the camera and microphone locally. The local video and audio can be accessed through IZoomVideoSDKVideoHelper and IZoomVideoSDKTestAudioDeviceHelper respectively.

Preview camera

To preview a camera on Android, you will need a video UI control to stream YUV420 raw data frames into the UI control as a video.

val cameras = ZoomVideoSDK.getInstance().videoHelper.cameraList
// Get ID of selected camera
val deviceId = cameras[0].deviceId
// Start preview and handle the callback in a ZoomVideoSDKRawDataPipeDelegate instance
ZoomVideoSDK.getInstance().videoHelper.startVideoPreview(this)
List<ZoomVideoSDKCameraDevice> cameras = ZoomVideoSDK.getInstance().getVideoHelper().getCameraList();
// Get ID of selected camera
String deviceID = cameras.get(0).getDeviceId();
// Start [review and handle the callback in a ZoomVideoSDKRawDataPipeDelegate instance
ZoomVideoSDK.getInstance().getVideoHelper().startVideoPreview(this);

Alternatively on Android, there is a ZoomVideoSDKVideoView control provided. If you wish to use this control, add it to your layout, name it (for example, video_view), and use startVideoCanvasPreview instead of startVideoPreview.

ZoomVideoSDK.getInstance().videoHelper.startVideoCanvasPreview(video_view, ZoomVideoSDKVideoAspect.ZoomVideoSDKVideoAspect_Full_Filled)
ZoomVideoSDK.getInstance().getVideoHelper().startVideoCanvasPreview(video_view, ZoomVideoSDKVideoAspect.ZoomVideoSDKVideoAspect_Full_Filled)

Preview audio

See the following restrictions and prerequisites for testing the microphone and speakers.

Restriction

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

Prerequisites

  • Video SDK Account
  • Microphone, such as the built in microphone, a USB microphone (if supported), or an inline microphone on headphones
  • Speaker or headphones

Preview microphone

Note: Microphone playback only works after users join a session. However, you can still get volume changes before and after joining a session.

  1. Override the following two callbacks in ZoomVideoSDKDelegate. For example, when the volume changes (available levels are from 0 to 10).

    override fun onMicSpeakerVolumeChanged(micVolume: Int, speakerVolume: Int) {
        //TO DO
    }
    override fun onTestMicStatusChanged(status: ZoomVideoSDKTestMicStatus) {
        //TO DO
    }
    
    @Override
    public void onMicSpeakerVolumeChanged(int micVolume, int speakerVolume) {
        //TO DO
    }
    @Override
      public void onTestMicStatusChanged(ZoomVideoSDKTestMicStatus status) {
        //TO DO
    }
    
  2. Start a microphone testing session.

    // Use ZoomVideoSDKTestAudioDeviceHelper start the microphone test.
    val testAudioDeviceHelper = ZoomVideoSDK.getInstance().testAudioDeviceHelper
    val ret: Int = testAudioDeviceHelper.startMicTest()
    
    // Use ZoomVideoSDKTestAudioDeviceHelper start the microphone test.
    ZoomVideoSDKTestAudioDeviceHelper testAudioDeviceHelper = ZoomVideoSDK.getInstance().getTestAudioDeviceHelper();
    int ret =  testAudioDeviceHelper.startMicTest();
    
  3. Stop the microphone testing session

    val ret: Int = testAudioDeviceHelper.stopMicTest()
    
    int ret =  testAudioDeviceHelper.stopMicTest();
    

Preview speakers

Zoom Video SDK currently only supports MP3 files for speaker tests. The size of the file cannot exceed 1 MB. You must add your own MP3 file and make it accessible from the user's device when they run the test. Follow these steps to configure and run the test.

  1. Add the MP3 file to your project.

  2. Ensure that the user's device can access the MP3 file to use for the test. Define the speaker test audio file path in ZoomVideoSDKInitParams, create a ZoomVideoSDKExtendParams, and add the MP3 file path under its speakerTestFilePath variable. Be sure that the path is valid and not null.

    val params =  ZoomVideoSDKInitParams()
    val extendParams = ZoomVideoSDKExtendParams()
    extendParams.speakerTestFilePath = "/sdcard/Android/data/com.example.videosdkonandroidfromscratch/example.mp3"
    
    ZoomVideoSDKInitParams params = new ZoomVideoSDKInitParams();
    ZoomVideoSDKExtendParams extendParams = new ZoomVideoSDKExtendParams();
    extendParams.speakerTestFilePath = "/sdcard/Android/data/com.example.videosdkonandroidfromscratch/test.mp3";
    
  3. Under the same ZoomVideoSDKInitParams, which is used to set the domain and enable the log, add the ZoomVideoSDKExtendParams variable under its extendParam. Then get the helper to test the speaker.

    params.extendParam = extendParams
    val testAudioDeviceHelper = ZoomVideoSDK.getInstance().testAudioDeviceHelper
    
    params.extendParam = extendParams;
    ZoomVideoSDKTestAudioDeviceHelper testAudioDeviceHelper = ZoomVideoSDK.getInstance().getTestAudioDeviceHelper();
    
  4. Start the speaker test. You'll receive the callback onMicSpeakerVolumeChanged with the speaker volume if it's successful.

    val ret: Int = testAudioDeviceHelper.startSpeakerTest()
    
    ZoomVideoSDKErrors ret = testAudioDeviceHelper.startSpeakerTest();
    
  5. Stop the speaker test.

    val ret: Int = testAudioDeviceHelper.stopSpeakerTest()
    
    ZoomVideoSDKErrors ret = testAudioDeviceHelper.stopSpeakerTest();