Video

You can programmatically control user video for an ongoing session using the methods provided by the Video SDK.

Video SDK for web can render up to 25 videos at a time on desktop browsers, and 4 videos on mobile browsers. You can show additional videos using pagination. The maximum video quality on web is 720p.

Render a user's video

This section describes how to render video using the Video SDK for Unity. Unity renders video using raw video data.

First, subscribe to receive raw video data. Create an instance of ZMVideoSDKRawDataPipeDelegate, get a video pipe from the user, and subscribe to the video.

ZMVideoSDKRawDataPipeDelegate rawDataPipeDelegate = new ZMVideoSDKRawDataPipeDelegateImpl(userId, introScreen);
ZMVideoSDKRawDataPipe pipe = user.GetVideoPipe();
pipe.Subscribe(ZMVideoSDKResolution.ZMVideoSDKResolution_360P, rawDataPipeDelegate);

After subscribing to raw video, the status of raw video data change will be invoked in onRawDataStatusChanged:

onRawDataStatusChanged(ZMVideoSDKRawDataStatus status)

New data invokes the callback in onRawDataFrameReceived.

onRawDataFrameReceived(ZMVideoSDKVideoRawData rawDataObject);

The SetData method renders the video onto a Unity object. You can see this in the sample app in Screen/RawDataRender.cs.

public void onRawDataFrameReceived(ZMVideoSDKVideoRawData rawDataObject)
   {
      Dispatcher.RunOnMainThread(() =>
      {
         render.SetData(rawDataObject, userId);
      });
   }

Video quality preference

When network bandwidth is limited, you can adjust video quality preferences between resolution and frame rate. For example, you can choose to preserve the video sharpness or smoothness. If bandwidth is not a concern, you can receive the best quality video using a high video resolution and maximum frame rate.

Set your video quality preferences with the ZoomVideoSDKVideoPreferenceSetting.

Video preference modes

Choose from the following modes, depending on what you'd like to prioritize.

  • Balance mode. Zoom will do what is best under the current bandwidth situation and make adjustments as needed. You don't need to set any additional parameters for this mode. This mode is suitable for video conference usage. This is the default preference.
  • Smoothness mode. Preserves the frame rate as much as possible. If network bandwidth degrades, Zoom will sacrifice video resolution to preserve the frame rate. This prioritizes a smooth video frame transition.
  • Sharpness mode. Preserves the resolution as much as possible. If network bandwidth degrades, Zoom will sacrifice the frame rate to preserve video resolution. This prioritizes a sharp video image.
  • Custom mode. Allows you to provide the minimum and maximum frame rate. Use this mode if you have an understanding of your network behavior and a clear idea of how to adjust the frame rate to achieve the desired video quality. You can also use this mode to influence bandwidth usage by increasing or decreasing the maximum frame rate setting. Given a resolution, a lower maximum frame rate results in less bandwidth usage. Note that if the bandwidth cannot be sustained by following the minimum and maximum frame rates, the system will drop down to the next lower resolution.

See the reference documentation for details.

Use cases

Video quality preferences are useful when the primary focus is not the image of a person attending the session, but on other video images where smoothness or sharpness is preferred.

Aside from video conferencing, you may want to set video quality preferences for the following use cases.

  • Transmission of medical X-ray images.
  • Transmission of video captured by endoscopic cameras during a medical operation.
  • Live sporting event broadcasts, such as co-watching or broadcasting a football game.

Callbacks

The following is an example video callback.

Get notified when a user's video status has changed

public void onUserVideoStatusChanged(ZMVideoSDKVideoHelper videoHelper, List<ZMVideoSDKUser> userArray)
{
   foreach (ZMVideoSDKUser user in userArray)
   {
      ZMVideoSDKRawDataPipe pipe = user.GetVideoPipe();
      ZMVideoSDKVideoStatus videoStatus = pipe.GetVideoStatus();
   }
}