# Issues getting camera to flip with video sdk on iOS

**URL:** <https://devforum.zoom.us/t/issues-getting-camera-to-flip-with-video-sdk-on-ios/129416>\
**Category:** iOS\
**Created:** [March 7, 2025, 4:09pm UTC](https://devforum.zoom.us/t/issues-getting-camera-to-flip-with-video-sdk-on-ios/129416 "2025-03-07T16:09:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Madilyn](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/madilyn/32/66973_2.png) [@Madilyn](https://devforum.zoom.us/u/Madilyn)\
**Post date:** [March 7, 2025, 4:09pm UTC](https://devforum.zoom.us/t/issues-getting-camera-to-flip-with-video-sdk-on-ios/129416/1 "2025-03-07T16:09:33Z")

</div>

Hi,  
We are experiencing an issue with zoom code that I am wondering if you can help with. I cannot attach pictures so had to copy and paste the code, so I apologize if it looks a little strange. Here are the details directly from our developer:

**When I try the run the following code via a touch gesture which calls the flipCamera() below:**

```
@objc private func flipCamera() {

    DispatchQueue.global(qos: .userInitiated).async {

        ZoomVideoSDK.shareInstance()?.getVideoHelper()?.switchCamera()

    }

}

```

**The camera flips but the SDK throws the error below. There seems to be some error related to UIApplication statusBarOrientation. Xcode shows the following error on the same switchCamera line: “-[UIApplication statusBarOrientation] must be used from main thread only”**

Main Thread Checker: UI API called on a background thread: -[UIApplication statusBarOrientation]

PID: 13905, TID: 2430792, Thread name: (none), Queue name: com.apple.root.user-initiated-qos, QoS: 25

Backtrace:

4 ZoomVideoSDK 0x000000010d10ec34 ZoomVideoSDK + 76852

5 ZoomVideoSDK 0x000000010d10f664 ZoomVideoSDK + 79460

6 ZoomVideoSDK 0x000000010d102258 ZoomVideoSDK + 25176

7 Petzey.debug.dylib 0x0000000107110f18 $s6Petzey30ConsultationMainViewControllerC10flipCamera33\_5E46F61A6B5CE48BCF8324C8B492A7E1LLyyFyyYbcfU\_ + 336

8 Petzey.debug.dylib 0x00000001070dca6c $sIegh\_IeyBh\_TR + 48

9 libdispatch.dylib 0x00000001051e0598 \_dispatch\_call\_block\_and\_release + 32

10 libdispatch.dylib 0x00000001051e204c \_dispatch\_client\_callout + 20

11 libdispatch.dylib 0x00000001051f669c \_dispatch\_root\_queue\_drain + 972

12 libdispatch.dylib 0x00000001051f6e64 \_dispatch\_worker\_thread2 + 196

13 libsystem\_pthread.dylib 0x0000000226c00dbc \_pthread\_wqthread + 228

14 libsystem\_pthread.dylib 0x0000000226c00b98 start\_wqthread + 8

2025-03-06 19:21:55.036972+0300 Petzey[13905:2430792] [reports] Main Thread Checker: UI API called on a background thread: -[UIApplication statusBarOrientation]

PID: 13905, TID: 2430792, Thread name: (none), Queue name: com.apple.root.user-initiated-qos, QoS: 25

Backtrace:

4 ZoomVideoSDK 0x000000010d10ec34 ZoomVideoSDK + 76852

5 ZoomVideoSDK 0x000000010d10f664 ZoomVideoSDK + 79460

6 ZoomVideoSDK 0x000000010d102258 ZoomVideoSDK + 25176

7 Petzey.debug.dylib 0x0000000107110f18 $s6Petzey30ConsultationMainViewControllerC10flipCamera33\_5E46F61A6B5CE48BCF8324C8B492A7E1LLyyFyyYbcfU\_ + 336

8 Petzey.debug.dylib 0x00000001070dca6c $sIegh\_IeyBh\_TR + 48

9 libdispatch.dylib 0x00000001051e0598 \_dispatch\_call\_block\_and\_release + 32

10 libdispatch.dylib 0x00000001051e204c \_dispatch\_client\_callout + 20

11 libdispatch.dylib 0x00000001051f669c \_dispatch\_root\_queue\_drain + 972

12 libdispatch.dylib 0x00000001051f6e64 \_dispatch\_worker\_thread2 + 196

13 libsystem\_pthread.dylib 0x0000000226c00dbc \_pthread\_wqthread + 228

14 libsystem\_pthread.dylib 0x0000000226c00b98 start\_wqthread + 8

**I move the call to the main thread, using the code below.**

@objc private func flipCamera() {

```
    DispatchQueue.main.async {

        ZoomVideoSDK.shareInstance()?.getVideoHelper()?.switchCamera()

    }

}

```

**I get the warning from xcode: “-[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness”. I also see the following stack trace seen below:**

2025-03-06 19:40:27.894900+0300 Petzey[13948:2438125] [tcp] tcp\_input [C15.1.1.1:3] flags=[R] seq=4100424357, ack=0, win=0 state=CLOSING rcv\_nxt=4100424357, snd\_una=3281410810

Thread Performance Checker: -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness

PID: 13948, TID: 2436914

Backtrace

=================================================================

22 Petzey.debug.dylib 0x0000000103358df8 $s6Petzey30ConsultationMainViewControllerC10flipCamera33\_5E46F61A6B5CE48BCF8324C8B492A7E1LLyyFyyScMYccfU\_ + 180

23 Petzey.debug.dylib 0x00000001030f69f4 $sIeg\_IeyB\_TR + 48

24 libdispatch.dylib 0x0000000101428598 \_dispatch\_call\_block\_and\_release + 32

25 libdispatch.dylib 0x000000010142a04c \_dispatch\_client\_callout + 20

26 libdispatch.dylib 0x000000010143a800 \_dispatch\_main\_queue\_drain + 1196

27 libdispatch.dylib 0x000000010143a344 \_dispatch\_main\_queue\_callback\_4CF + 44

28 CoreFoundation 0x00000001da372a08 42C5C917-0447-3995-B50F-DE4D132C2435 + 633352

29 CoreFoundation 0x00000001da354368 42C5C917-0447-3995-B50F-DE4D132C2435 + 508776

30 CoreFoundation 0x00000001da3591e4 CFRunLoopRunSpecific + 612

31 GraphicsServices 0x0000000213179368 GSEventRunModal + 164

32 UIKitCore 0x00000001dc808d88 7B942FA4-CB76-3375-9972-F58C14492FB4 + 3812744

33 UIKitCore 0x00000001dc8089ec UIApplicationMain + 340

34 libswiftUIKit.dylib 0x00000001e2cb82a0 $s5UIKit17UIApplicationMainys5Int32VAD\_SpySpys4Int8VGGSgSSSgAJtF + 104

35 Petzey.debug.dylib 0x00000001031a3e2c $sSo21UIApplicationDelegateP5UIKitE4mainyyFZ + 120

36 Petzey.debug.dylib 0x00000001031a3da4 $s6Petzey11AppDelegateC5$mainyyFZ + 44

37 Petzey.debug.dylib 0x00000001031a4ca8 \_\_debug\_main\_executable\_dylib\_entry\_point + 28

38 dyld 0x00000001f867d948 341BBF64-6034-357E-8AA6-E1E4B988E03C + 88392

**How would i run this without getting the exceptions seen. Seems like running it on the main or background threads have issues. I’m running this on ZoomVideoSDK iOS version 2.1. Your help will be appreciated.**

Thank you,

---

<div class="post-metadata">

**Author:** ![richard.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/richard.zoom/32/41061_2.png) [@richard.zoom](https://devforum.zoom.us/u/richard.zoom)\
**Post date:** [April 3, 2025, 4:16pm UTC](https://devforum.zoom.us/t/issues-getting-camera-to-flip-with-video-sdk-on-ios/129416/3 "2025-04-03T16:16:29Z")

</div>

Hello Madilyn,

You can safely ignore that warning, which is about calling it on main thread will cause the UI to briefly freeze for a short second, which is expected with the SDK. Therefore, please make sure to do all UI actions on the main thread.

Thank you for your patience,  
Richard

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [May 4, 2025, 2:17am UTC](https://devforum.zoom.us/t/issues-getting-camera-to-flip-with-video-sdk-on-ios/129416/4 "2025-05-04T02:17:06Z")

</div>

Closed on May 4, 2025, 2:17am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
