swapToShowShareViewOrVideo is not working as intended


I am trying to perform the action of below button (in red) using swapToShowShareViewOrVideo but it doesn’t seem to work. It always returns ZoomSDKError(rawValue: 4)

Screenshot 2021-01-13 at 18.52.11

Here is my code for it.

func swapToShowShareViewOrVideo() {
    let shouldSwap = !(sdkMeetingActionController?.isDisplayingShareViewOrVideo() ?? false)
    let result = sdkMeetingActionController?.swap(toShowShareViewOrVideo: shouldSwap)
    print("swap(toShowShareViewOrVideo \(shouldSwap)) result: \(String(describing: result))")

Here are some logs which can be useful.

po sdkMeetingActionController?.isDisplayingShareViewOrVideo()
▿ Optional<Bool>
  - some : true

po sdkMeetingActionController?.canSwapToShowShareViewOrVideo()
▿ Optional<Bool>
  - some : false

swap(toShowShareViewOrVideo false) result: Optional(__C.ZoomSDKError(rawValue: 4))

I checked my code and everything seems to be fine, Can you please let me know what could be the reason for error code 4?
I think this use to work in older version of SDK, but after upgrading to 5.4.54528.1230 it doesn’t work.

Related to that, isDisplayingShareViewOrVideo() is not returning value as false, in case my video is visible in the UI and not the sharing screen.

Please review my code and let me know if I am doing something wrong.

Which version?

To Reproduce(If applicable)
Steps to reproduce the behavior:

  1. Join a meeting with multiple participants, with somebody sharing the screen and video.
  2. Call the function swapToShowShareViewOrVideo with true/false based on isDisplayingShareViewOrVideo
  3. Check the response code of function call
  4. See error

I can confirm there are definitely some differences in latest SDK update vs 5.2.42037.1112
I am always getting isDisplayingShareViewOrVideo false in old SDK but in new one it is always true

po sdkMeetingActionController?.isDisplayingShareViewOrVideo()
▿ Optional<Bool>
  - some : false

In both versions calling swapToShowShareViewOrVideo returns ZoomSDKError(rawValue: 4)

Correction: (I can’t edit my previous reply)

In both versions calling swapToShowShareViewOrVideo returns ZoomSDKError(rawValue: 4), even though the user is sharing screen and the video is on