# DrawWebView and ClearWebView Issues "Error: clearWebView took longer than 10000ms to respond"

**URL:** <https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988>\
**Category:** Zoom Apps\
**Created:** [November 18, 2022, 1:23am UTC](https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988 "2022-11-18T01:23:15Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![evan.cheng](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/evan.cheng/32/42970_2.png) [@evan.cheng](https://devforum.zoom.us/u/evan.cheng)\
**Post date:** [November 18, 2022, 1:23am UTC](https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988/1 "2022-11-18T01:23:16Z")

</div>

**Zoom Apps Configuration**  
PHP + Vanilla JS  
loaded zoomSDK via CDN

I’m running into problems with DrawWebView and ClearWebView. They are separate issues but I figured I’d write about them in one post.

**DrawWebView Doesn’t Update When innerHTML Changes**  
I’m able to DrawWebView the first time successfully, but when I change the text on a `<h1>` tag, and click a button to DrawWebView again, the resultant render on my camera is NOT updated. It does not show the new text that is displayed on the sidebar. I do get the “success” callback, however.

I figure that I would try to clear the Webview first, but then I run into a second problem:

**Error: clearWebView took longer than 10000ms to respond**  
This is when triggering a function that calls zoomSdk.clearWebView() via an HTML button.

Any help would be appreciated. Below is a code snippet:

```auto
<input type="text" id="userInput"><br>
<button type="button" id="displayBtn" onclick="setDisplayedText()" >Display Text</button>
<br>
<button type="button" id="clearImageBtn" onclick="clearImage()">Clear Image</button>
<br>
<br>
<h1>displayed text: <span id="display"></span></h1>

<script>
var inMeeting = <?php echo json_encode($zoomAppContext->typ === 'meeting'); ?>;

function setDisplayedText() {
    const gName = document.getElementById("userInput").value;
    document.getElementById("display").innerHTML = gName;
    if(inMeeting) {
        draw();
    }
}

async function draw() {
    await zoomSdk.drawWebView({
        webviewId: "123", x: 0, y: 0, width: 1280, height: 720, zIndex: 1
    })
    .then((ctx) => {
        console.log("drawWebView returned", ctx);
    })
    .catch((e) => {
        console.log(e);
    });
}

async function clearImage() {
    await zoomSdk.clearWebView({webviewId: "123"})
    .catch((e) => {
    console.log(e);
    });
}

async function setup() {
    var localParticipantUUID = -1; //the UUID of the local user.

    //configure zoom app with api features, popout size, etc
    const configResponse = await zoomSdk.config({
        version: '0.16',
        popoutSize: { width: 480, height: 360 },
        capabilities: [
        // The following are needed for Layers API.
        `getRunningContext`,
        'getUserContext',
        'getMeetingContext',
        'getMeetingParticipants',
        'openUrl',
        `runRenderingContext`,
        `closeRenderingContext`,
        `drawParticipant`,
        `clearParticipant`,
        `drawImage`,
        `clearImage`,
        `drawWebView`,
        `clearWebview`,
        `postMessage`,
        `sendAppInvitationToAllParticipants`,
        `onMessage`,
        `onMyMediaChange`,
        `onRenderedAppOpened`
        ],
    });

    //Only render to camera if in meeting
    if(inMeeting){
        //set up Layers API - Camera Rendering Mode
        await zoomSdk.runRenderingContext({view: 'camera'})
        .then((ctx) => {
            console.log("runRenderingContext returned", ctx);
        })
        .catch((e) => {
            console.log(e);
        });
    }
}
setup();

</script>

```

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [November 18, 2022, 6:02pm UTC](https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988/2 "2022-11-18T18:02:12Z")

</div>

@evan.cheng Sorry for the silly question but have you confirmed that the webViewID you are attempting to delete exists? As in, it hasn’t been deleted in a previous loop or in another piece of code.

---

<div class="post-metadata">

**Author:** ![evan.cheng](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/evan.cheng/32/42970_2.png) [@evan.cheng](https://devforum.zoom.us/u/evan.cheng)\
**Post date:** [November 21, 2022, 8:05pm UTC](https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988/3 "2022-11-21T20:05:53Z")

</div>

@MaxM Hm, how would I confirm this? I see the webview rendered onto the camera - albeit without the runtime changes brought on by the javascript.

Some things I’ve tried since then:

1. calling the Draw and Clear functions without a WebviewID - no change
2. calling runRenderingContext after page load with a similar button - no change
3. calling `await new Promise(r => setTimeout(r, 2000));` in between setting the inner html , runRenderingContext, and drawWebView() - no change.

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [November 22, 2022, 8:47pm UTC](https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988/4 "2022-11-22T20:47:41Z")

</div>

@evan.cheng What client version and SDK version are you using when you see this behavior?

---

<div class="post-metadata">

**Author:** ![evan.cheng](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/evan.cheng/32/42970_2.png) [@evan.cheng](https://devforum.zoom.us/u/evan.cheng)\
**Post date:** [November 22, 2022, 10:07pm UTC](https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988/5 "2022-11-22T22:07:26Z")

</div>

@MaxM  
Zoom: Version: 5.12.8 (12565)  
SDK: should be the latest one since I’m loading it from CDN via  
` <script src="https://appssdk.zoom.us/sdk.js"></script>`

---

<div class="post-metadata">

**Author:** ![evan.cheng](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/evan.cheng/32/42970_2.png) [@evan.cheng](https://devforum.zoom.us/u/evan.cheng)\
**Post date:** [November 28, 2022, 7:39pm UTC](https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988/6 "2022-11-28T19:39:21Z")

</div>

@MaxM I’m going forward with a work-around by using `zoomSdk.drawImage()` instead of `drawWebView()`

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [November 28, 2022, 11:43pm UTC](https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988/7 "2022-11-28T23:43:15Z")

</div>

It looks like the clearWebView function doesn’t take an ID so the only other possibility I can of is that the app is not in camera mode when that function is called?

I was working to reproduce this myself but ran into a separate issue. I’m going to gather sample code that we have internally and see if I can put together an example demonstrating this issue if not working around it.

With that being said, does using drawImage work well for your use case instead?

---

<div class="post-metadata">

**Author:** ![evan.cheng](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/evan.cheng/32/42970_2.png) [@evan.cheng](https://devforum.zoom.us/u/evan.cheng)\
**Post date:** [November 28, 2022, 11:46pm UTC](https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988/9 "2022-11-28T23:46:56Z")

</div>

> It looks like the clearWebView function doesn’t take an ID so the only other possibility I can of is that the app is not in camera mode when that function is called?

Hm, I tried to rule that out already. Confirmed the rendering context is in camera mode with console logs. I also tried clearWebView() without an ID - no success.

> With that being said, does using drawImage work well for your use case instead?

yep! thanks for the quick responses

---

<div class="post-metadata">

**Author:** ![Robert.Wallis](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/robert.wallis/32/38438_2.png) [@Robert.Wallis](https://devforum.zoom.us/u/Robert.Wallis)\
**Post date:** [November 29, 2022, 5:34pm UTC](https://devforum.zoom.us/t/drawwebview-and-clearwebview-issues-error-clearwebview-took-longer-than-10000ms-to-respond/78988/10 "2022-11-29T17:34:55Z")

</div>

If you want to refresh the webview you’ll need to either do something like

```auto
document.location.href = document.location.href

```

to reload the page, or

```auto
closeRenderingContext();
runRenderingContext({view: 'camera'})

```

Draw and Clear webview functions don’t reload the webview, they just show or hide it somewhere on the camera.

`clearWebView` should be faster than 10 seconds so that sounds like an issue, and I’ll bring it up with the Layers team.

Hope that helps!
