# drawImage not working in ImmersiveMode and zoom apps keeps crashing

**URL:** <https://devforum.zoom.us/t/drawimage-not-working-in-immersivemode-and-zoom-apps-keeps-crashing/98231>\
**Category:** Zoom Apps\
**Created:** [November 12, 2023, 6:36am UTC](https://devforum.zoom.us/t/drawimage-not-working-in-immersivemode-and-zoom-apps-keeps-crashing/98231 "2023-11-12T06:36:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yashwanth](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/yashwanth/32/53797_2.png) [@yashwanth](https://devforum.zoom.us/u/yashwanth)\
**Post date:** [November 12, 2023, 6:36am UTC](https://devforum.zoom.us/t/drawimage-not-working-in-immersivemode-and-zoom-apps-keeps-crashing/98231/1 "2023-11-12T06:36:55Z")

</div>

**Zoom Apps Configuration**  
I am working with [GitHub - zoom/zoomapps-cameramode-vuejs: A frontend only sample that shows how to use Camera Mode and Immersive Mode in a Zoom App](https://github.com/zoom/zoomapps-cameramode-vuejs) template to drawImage in immersive mode

**Description**  
If I trigger a drawparticipant, I can do that but when I try drawImage, the zoom app keeps crashing. I was able to drawImage and drawWebView in CameraMode successfully but the same code of drawImage in immersive mode is making zoom app crash.

Here is the sample code which is working in cameraMode but not in Immersive Mode.

const width = 100;  
const height = 100;  
const scaleFactor = window.devicePixelRatio;  
const canvas = document.createElement(“canvas”);  
canvas.width = width \* scaleFactor;  
canvas.height = height \* scaleFactor;  
const ctx = canvas.getContext(‘2d’);  
ctx.scale(scaleFactor, scaleFactor);  
ctx.font = “20px”;  
ctx.fillText(“Hello World!”, 10, 10);  
ctx.fillStyle = “red”;

```
  const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
  console.log(imageData);
  this.zoomSdk.drawImage({
      imageData: imageData,
          x: 0,
          y: 0,
          zIndex: 2
      }).then((ctx) => {
          console.log("drawImage returned", ctx);
      }).catch((e) => {
          console.log(e);
    });

```

**Error?**  
Zoom App Crashes.  
Diagnostic Report:

* * *

## Translated Report (Full Report Below)

Process: [zoom.us](http://zoom.us) [22147]  
Path: /Applications/zoom.us.app/Contents/MacOS/zoom.us  
Identifier: us.zoom.xos  
Version: 5.16.6 (24664) (5.16.6.24664)  
Code Type: ARM-64 (Native)  
Parent Process: launchd [1]  
User ID: 502

Date/Time: 2023-11-12 11:45:46.9358 +0530  
OS Version: macOS 14.1.1 (23B81)  
Report Version: 12  
Anonymous UUID: ----------------------------------------------------------

Sleep/Wake UUID: ----------------------------------------------------------

Time Awake Since Boot: 44000 seconds  
Time Since Wake: 6729 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC\_BREAKPOINT (SIGTRAP)  
Exception Codes: 0x0000000000000001, 0x0000000192d523fc

Termination Reason: Namespace SIGNAL, Code 5 Trace/BPT trap: 5  
Terminating Process: exc handler [22147]

Application Specific Backtrace 0:  
0 CoreFoundation 0x000000018f312800 \_\_exceptionPreprocess + 176  
1 libobjc.A.dylib 0x000000018ee09eb4 objc\_exception\_throw + 60  
2 CoreFoundation 0x000000018f3c43bc -[NSObject(NSObject) \_\_retain\_OA] + 0  
3 CoreFoundation 0x000000018f27c828 _ **forwarding** _ + 968  
4 CoreFoundation 0x000000018f27c3a0 \_CF\_forwarding\_prep\_0 + 96  
5 zVideoUIBridge 0x0000000101167de0 ZMMTChatGetCurrentSession + 49560  
6 zVideoUIBridge 0x0000000101168350 ZMMTChatGetCurrentSession + 50952  
7 zVideoUI 0x000000011e87e5d4 TermModule + 3385656  
8 zVideoUI 0x000000011e92fae8 TermModule + 4111948  
9 zAppUI 0x0000000123775924 zAppUI + 350500  
10 zAppUI 0x0000000123781b4c _ZN18ZMZappClientUISink14OnJ2cDrawImageERKN3Cmm8CStringTIcEES4\_RK10tagCmmRectRKiRKN9zoom\_apps16VirtualImageInfoES4_ + 356  
11 zApp 0x0000000123593630 TermModule + 261404  
12 zApp 0x000000012358662c TermModule + 208152  
13 zApp 0x000000012354b184 zApp + 209284  
14 zApp 0x0000000123542578 zApp + 173432  
15 CoreFoundation 0x000000018f2b9cd0 **CFRUNLOOP\_IS\_CALLING\_OUT\_TO\_A\_TIMER\_CALLBACK\_FUNCTION** + 32  
16 CoreFoundation 0x000000018f2b9978 \_\_CFRunLoopDoTimer + 972  
17 CoreFoundation 0x000000018f2b94b0 \_\_CFRunLoopDoTimers + 356  
18 CoreFoundation 0x000000018f29c9f4 \_\_CFRunLoopRun + 1856  
19 CoreFoundation 0x000000018f29bc5c CFRunLoopRunSpecific + 608  
20 HIToolbox 0x0000000199818448 RunCurrentEventLoopInMode + 292  
21 HIToolbox 0x0000000199818284 ReceiveNextEventCommon + 648  
22 HIToolbox 0x0000000199817fdc \_BlockUntilNextEventMatchingListInModeWithFilter + 76  
23 AppKit 0x0000000192a76c54 \_DPSNextEvent + 660  
24 AppKit 0x000000019324cebc -[NSApplication(NSEventRouting) \_nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716  
25 AppKit 0x0000000192a6a100 -[NSApplication run] + 476  
26 AppKit 0x0000000192a413cc NSApplicationMain + 880  
27 dyld 0x000000018ee450e0 start + 2360

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread  
0 AppKit 0x192d523fc -[NSApplication \_crashOnException:] + 240  
1 AppKit 0x192d521d4 -[NSApplication reportException:] + 440  
2 AppKit 0x192a6a1b0 -[NSApplication run] + 652  
3 AppKit 0x192a413cc NSApplicationMain + 880  
4 dyld 0x18ee450e0 start + 2360

**How To Reproduce**  
OS: Mac,  
ZoomApp version: 5.16.16  
Zoom WebSDK version: 0.16.15
