# swapToShowShareViewOrVideo is not working as intended

**URL:** <https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479>\
**Category:** macOS\
**Created:** [January 13, 2021, 7:08pm UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479 "2021-01-13T19:08:24Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![j\_a\_z\_z](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@j\_a\_z\_z](https://devforum.zoom.us/u/j_a_z_z)\
**Post date:** [January 13, 2021, 7:08pm UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479/1 "2021-01-13T19:08:24Z")

</div>

**Description**  
Hello,

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](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/5/1/515701793772b0a484c0157409d723cb80830749.png)

Here is my code for it.

```auto
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.

```auto
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?**  
`5.4.54528.1230`

**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

---

<div class="post-metadata">

**Author:** ![j\_a\_z\_z](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@j\_a\_z\_z](https://devforum.zoom.us/u/j_a_z_z)\
**Post date:** [January 13, 2021, 7:31pm UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479/2 "2021-01-13T19:31:15Z")

</div>

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`

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

```

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

---

<div class="post-metadata">

**Author:** ![j\_a\_z\_z](https://avatars.discourse-cdn.com/v4/letter/j/439d5e/32.png) [@j\_a\_z\_z](https://devforum.zoom.us/u/j_a_z_z)\
**Post date:** [January 15, 2021, 11:50am UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479/3 "2021-01-15T11:50:16Z")

</div>

@Michael_Condon  
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`

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [January 20, 2021, 1:36am UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479/4 "2021-01-20T01:36:23Z")

</div>

Hi @j_a_z_z, thanks for the post.

I can certainly see where the confusion comes from regarding the methods around this feature. Please allow me some time to gather the requirements internally around the behavior for this so that we can work on making these interfaces clearer.

I am sure that, as we are looking into the expected behavior of these swap-related methods, we will also be able to improve the readability/usability of this flow.

In the meantime, it will take some time to investigate the proper usage of these methods, which will require a bit of testing internally. As soon as we have anything concrete on either front, you will be the first to know. 🙂

Thanks!

---

<div class="post-metadata">

**Author:** ![tmiskiew](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tmiskiew/32/9174_2.png) [@tmiskiew](https://devforum.zoom.us/u/tmiskiew)\
**Post date:** [January 20, 2021, 6:24am UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479/5 "2021-01-20T06:24:33Z")

</div>

@jon.zoom as @j_a_z_z pointed out this method worked with the previous version of the SDK now it stopped. We cannot however go to previous version because in that version the floating interface calls don’t work.

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [January 20, 2021, 7:02pm UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479/6 "2021-01-20T19:02:58Z")

</div>

Hi @tmiskiew,

Thanks for clarifying that this was working properly in the previous release of the SDK.

I think I could have been a little clearer in my explanation, so apologies for that. We are going to investigate what caused this method to stop working and fix it in a future version. In addition to restoring the functionality to match that of the previous version, we will also investigate whether or not we can improve the usability of the `swapToShowShareViewOrVideo` and `isDisplayingShareViewOrVideo` methods.

The reasoning for the second action is that we have made note that the wording and return types of these methods are not as intuitive as they could be, so we would like to see if that’s something we can improve significantly without major breaking changes.

Please let me know if any of this is unclear and I will be happy to clarify further.

Thanks!

---

<div class="post-metadata">

**Author:** ![tmiskiew](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tmiskiew/32/9174_2.png) [@tmiskiew](https://devforum.zoom.us/u/tmiskiew)\
**Post date:** [January 20, 2021, 9:35pm UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479/7 "2021-01-20T21:35:22Z")

</div>

I think everything is clear it it’s only that the latest sdk update broke our app… if Zoom releases a bug free sdk one day I will copy it to diskettes and lock it in a safe 😂 We would really appreciate if you could get this fixed without breaking anything else. We want to launch our product and we can’t because if this and numerous other bugs.

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [January 21, 2021, 12:21am UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479/8 "2021-01-21T00:21:50Z")

</div>

Hi @tmiskiew,

> I think everything is clear it it’s only that the latest sdk update broke our app

Absolutely agreed, we will definitely work on getting the change that introduced this behavior reverted!

> We would really appreciate if you could get this fixed without breaking anything else

No need to worry. If we make any additional changes alongside this fix, they would be surface level changes that couldn’t impact the underlying logic. The largest change I could see happening around this would be renaming a couple of methods for the sake of clarity. 🙂

Thanks!

---

<div class="post-metadata">

**Author:** ![stalefishlabs](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/stalefishlabs/32/16374_2.png) [@stalefishlabs](https://devforum.zoom.us/u/stalefishlabs)\
**Post date:** [July 19, 2021, 9:58pm UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479/9 "2021-07-19T21:58:48Z")

</div>

This bug is still happening for me in v5.5.12511.0420. I’ll add that it returns the appropriate sharing value for the meeting host, I only get ZoomSDKError\_WrongUsage (4) for non-hosts.

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [July 20, 2021, 8:35pm UTC](https://devforum.zoom.us/t/swaptoshowsharevieworvideo-is-not-working-as-intended/40479/10 "2021-07-20T20:35:52Z")

</div>

Hi @stalefishlabs,

Sorry to hear you are running into this issue as well. Usually when you get the WrongUsage error for this method, it means one of two things:

1. No one is sharing (probably not the case, since you are able to use it as the host)
2. You are using one of the side-by-side views in the UI. This feature is only supported when using standard view.

Please let me know if neither of these are applicable to your scenario and we can continue looking into this.

Thanks!
