# DestroyAllVideoElement() crashes my app when meeting is stopped from API

**URL:** <https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546>\
**Category:** API and Webhooks\
**Created:** [May 29, 2020, 1:31pm UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546 "2020-05-29T13:31:42Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![bragma](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bragma/32/4213_2.png) [@bragma](https://devforum.zoom.us/u/bragma)\
**Post date:** [May 29, 2020, 1:31pm UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/1 "2020-05-29T13:31:42Z")

</div>

Hi, in my app I create several video containers and video elements within them. When the meeting enters “MEETING\_STATUS\_DISCONNECTING” state, I destroy all my elements in this order:

1. I call DestroyAllVideoElement() to remove all elements within a container
2. I call DestroyVideoContainer() on all containers

This works well when I end the meeting with the SDK call to Leave().

If I instead I end the meeting with an API call to “DELETE /meetings/{meetingId}” I receive a “MEETING\_STATUS\_DISCONNECTING” state notification, and as explained above I call “DestroyAllVideoElement()”. This freezes my app and causes an exception.

Apart from signaling the bug, I have a question:

- If I want to destroy the container do I need to destroy all elements before or can I directly destroy the container without causing leaks/problems?

Thanks!

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [June 3, 2020, 5:29am UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/2 "2020-06-03T05:29:27Z")

</div>

Hi @bragma,

Thanks for the post. The `DestroyAllVideoElement()` only deletes the corresponding objects inside our SDK, it won’t cause app freeze. Please note that: using `DestroyVideoContainer()` will not trigger `DestroyAllVideoElement()` so you will need to call them separately. If any of them is missing, then it could cause issues.

Hope this helps. Thanks!

---

<div class="post-metadata">

**Author:** ![bragma](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bragma/32/4213_2.png) [@bragma](https://devforum.zoom.us/u/bragma)\
**Post date:** [June 3, 2020, 7:39am UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/3 "2020-06-03T07:39:41Z")

</div>

> [@bragma](#):
>
> DestroyAllVideoElement

Ok thanks @carson.zoom, so I need to understand how to make the call to “DestroyAllVideoElement()” work. As said, the call works when the meeting is terminated with a call to Leave(). It instead does not work when the meeting is terminated by a call to the Zoom API.

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [June 10, 2020, 7:47am UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/4 "2020-06-10T07:47:09Z")

</div>

Hi @bragma,

Thanks for the reply. Please try not to use Zoom API to end/delete Zoom meetings when using Zoom SDK. If you would like to delete a meeting, please end the meeting using Zoom SDK, and then you could call the Zoom API to delete the meeting.

Hope this helps. Thanks!

---

<div class="post-metadata">

**Author:** ![bragma](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bragma/32/4213_2.png) [@bragma](https://devforum.zoom.us/u/bragma)\
**Post date:** [June 10, 2020, 11:05am UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/5 "2020-06-10T11:05:31Z")

</div>

Hi @carson.zoom,  
I’m not sure I can do what I need using just the SDK. I want to stop “unused” sessions from my back-end. This cover several cases, ex: the service administrator wants to terminate a meeting (but he’s not a host), the meeting exceeded the time we want to allow, etc. In this case, I use this API endpoint:

PUT /meetings/{meetingId}/status \<-- end

I think this is the exact scope the API has been created for…  
In any case I think it should behave well with people in meeting using the SDK.

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [June 12, 2020, 6:29am UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/6 "2020-06-12T06:29:44Z")

</div>

Hi @bragma,

Thanks for the reply. For the use case you are mentioning, such as the admin would like to end the meeting remotely or the meeting exceeded the allowed time, you could have a try to have a listener listening to a call from your backend. Once the callback is triggered and the current user is a host, call the leave meeting interface to end the meeting.

Hope this helps. Thanks!

---

<div class="post-metadata">

**Author:** ![bragma](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bragma/32/4213_2.png) [@bragma](https://devforum.zoom.us/u/bragma)\
**Post date:** [June 15, 2020, 8:47am UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/7 "2020-06-15T08:47:08Z")

</div>

Ok, but it is a bit more complex have a mobile app listen for an event from API. It’s not impossible but requires some more infrastructure and have no guarantee that the mobile app will actually receive the message. Ex: the app crashed, is suspended, etc.

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [June 17, 2020, 3:49am UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/8 "2020-06-17T03:49:46Z")

</div>

Understand. Thanks for sharing this. However, using the API to terminate a meeting is not recommended since they are not designed to be used in this way. So we cannot guarantee results and there might be issues happening such as the one you are mentioning in this topic.

Thanks!

---

<div class="post-metadata">

**Author:** ![bragma](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bragma/32/4213_2.png) [@bragma](https://devforum.zoom.us/u/bragma)\
**Post date:** [June 17, 2020, 11:21am UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/9 "2020-06-17T11:21:51Z")

</div>

I do not want to make this longer than needed, but I think there is a specific API endpoint for terminating a training:

> **[Update Meeting Status - Meetings - Zoom API - API Reference](https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingstatus)**
>
> End a meeting by updating its status.
> Scopes: meeting:write:admin meeting:write
> Rate Limit Label: Light
> 
> Authorization
> 
> Flow: authorizationCode
> 
> Author...

The status can only be set to “end” and this terminates a meeting. What’s its correct use case than if not to end a meeting? It seems to be its only purpose. Also you cannot know reliably how many people are still in.

Thanks!

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [June 29, 2020, 4:46pm UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/10 "2020-06-29T16:46:04Z")

</div>

Hey @bragma,

Yes, the [Update Meeting Status API](https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingstatus) will end a live Zoom meeting.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![bragma](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bragma/32/4213_2.png) [@bragma](https://devforum.zoom.us/u/bragma)\
**Post date:** [June 30, 2020, 2:02pm UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/11 "2020-06-30T14:02:56Z")

</div>

Hi @tommy, thanks for answering. Given that the purpose of that API call is to end a running meeting, the fact that is causes clients connected with Windows SDK to misbehave as described above can be considered a bug of the SDK? I think so…

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 1, 2020, 10:05pm UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/12 "2020-07-01T22:05:28Z")

</div>

Hey @bragma,

In your original post, you mentioned using the [Delete Meeting API](https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingdelete).

Just so we are on the same page, does the [Update Meeting Status (End Meeting API)](https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingstatus) cause the errors too?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![bragma](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bragma/32/4213_2.png) [@bragma](https://devforum.zoom.us/u/bragma)\
**Post date:** [July 2, 2020, 11:34pm UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/13 "2020-07-02T23:34:37Z")

</div>

@tommy I have to beg your pardon. I re-read my first post and noticed the error. In my backend code, first I call the “Update Meeting Status (End Meeting)” then the “Delete Meeting” (for scheduled meetings that will not be automatically deleted).

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 6, 2020, 10:57pm UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/14 "2020-07-06T22:57:45Z")

</div>

Hey @bragma,

Gotcha! 🙂 Did you get it working?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![bragma](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bragma/32/4213_2.png) [@bragma](https://devforum.zoom.us/u/bragma)\
**Post date:** [July 7, 2020, 11:08am UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/15 "2020-07-07T11:08:23Z")

</div>

No, still not working. I just made a wrong initial post, but the code I use is as described. My backend calls “Update Meeting Status”, then “Delete Meeting” (the call to “Delete Meeting” is irrilevant here, just told about it to give some context).

The main problem is that the call to “Update Meeting Status” does cause all my connected clients to disconnect, but the all clients crash since the call to “DestroyAllVideoElement” fails with this exception:

System.AccessViolationException: ‘Attempted to read or write protected memory. This is often an indication that other memory is corrupt.’

Notice that the same call has not problem if the meeting is terminated by another participant. The code calls exactly the same method, but without errors.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 9, 2020, 9:09pm UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/16 "2020-07-09T21:09:46Z")

</div>

Gotcha, thanks @bragma.

I will have our engineering team look into this. So I have enough information to send to them, can you share which [SDK](https://marketplace.zoom.us/docs/sdk/native-sdks/introduction) you are using, as well as the version number?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![bragma](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bragma/32/4213_2.png) [@bragma](https://devforum.zoom.us/u/bragma)\
**Post date:** [July 10, 2020, 8:12am UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/17 "2020-07-10T08:12:28Z")

</div>

Hi, I am testing the new SDK but the report is for v4.6.21666.0428, using C# wrapper.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 15, 2020, 9:02pm UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/18 "2020-07-15T21:02:13Z")

</div>

Hey @bragma,

Thanks for sharing the version number! Our engineers our looking into the issue. I will get back to you with updates. (CS-2056)

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 10:42pm UTC](https://devforum.zoom.us/t/destroyallvideoelement-crashes-my-app-when-meeting-is-stopped-from-api/19546/19 "2020-08-21T22:42:42Z")

</div>

Closed on August 21, 2020, 10:42pm UTC


