Video


Contents

1. Video

2. Actions

3. Listeners

1. Video

Before we can do something with video, firstly we need to retrieve an InMeetingVideoController from InMeetingService. To implement the video listeners, getting an InMeetingService instance from ZoomSDK would be helpful.

public MeetingVideoHelper(Context activity, VideoCallBack callBack) {
    this.activity = activity;
    this.callBack = callBack;
    mInMeetingVideoController = ZoomSDK.getInstance().getInMeetingService().getInMeetingVideoController();
    InMeetingService mInMeetingService = ZoomSDK.getInstance().getInMeetingService();
}

2. Action

There are multiple actions you can perform with video. For instance:

// Check video rotation.
public void checkVideoRotation(Context context) {
  Display display = ((WindowManager) context.getSystemService(Service.WINDOW_SERVICE)).getDefaultDisplay();
  int displayRotation = display.getRotation();
  mInMeetingVideoController.rotateMyVideo(displayRotation);
}

// Switch Video
public void switchVideo() {
  if (null == callBack || !callBack.requestVideoPermission()) {
      return;
  }
  if (mInMeetingVideoController.isMyVideoMuted()) {
      if (mInMeetingVideoController.canUnmuteMyVideo()) {
          mInMeetingVideoController.muteMyVideo(false);
      }
  } else {
      mInMeetingVideoController.muteMyVideo(true);
  }
}

// Switch camera
public void switchCamera() {
  if (mInMeetingVideoController.canSwitchCamera()) {
      List<CameraDevice> devices = mInMeetingVideoController.getCameraDeviceList();
      if (devices != null && devices.size() > 1) {
          final SimpleMenuAdapter cameraMenuAdapter = new SimpleMenuAdapter(activity);
          for (CameraDevice device : devices) {
              cameraMenuAdapter.addItem(new CameraMenuItem(0, device.getDeviceName(), device.getDeviceId()));
          }

          View popupWindowLayout = LayoutInflater.from(activity).inflate(R.layout.popupwindow, null);

          ListView cameraList = (ListView) popupWindowLayout.findViewById(R.id.actionListView);
          final PopupWindow window = new PopupWindow(popupWindowLayout, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
          window.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.bg_transparent));
          cameraList.setAdapter(cameraMenuAdapter);

          cameraList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                  CameraMenuItem item = (CameraMenuItem) cameraMenuAdapter.getItem(position);
                  mInMeetingVideoController.switchCamera(item.getCameraId());
                  window.dismiss();
              }
          });

          window.setFocusable(true);
          window.setOutsideTouchable(true);
          window.update();
          if (null != callBack) {
              callBack.showCameraList(window);
          }
      } else {
          mInMeetingVideoController.switchToNextCamera();
      }
  }
}

3. Listeners

You can implement the following listeners to listen on video events:

 @Override
public void onUserVideoStatusChanged(long userId) {
    for (VideoEvent event : callbacks) {
        event.onUserVideoStatusChanged(userId);
    }
}

@Override
public void onSpotlightVideoChanged(boolean on) {
    Log.d(TAG, "onSpotlightVideoChanged:" + on);

}