# Video SDK for Web - Meeting End via Host

**URL:** <https://devforum.zoom.us/t/video-sdk-for-web-meeting-end-via-host/88423>\
**Category:** Web\
**Created:** [May 15, 2023, 6:50pm UTC](https://devforum.zoom.us/t/video-sdk-for-web-meeting-end-via-host/88423 "2023-05-15T18:50:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rs.subk-dev](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@rs.subk-dev](https://devforum.zoom.us/u/rs.subk-dev)\
**Post date:** [May 15, 2023, 6:50pm UTC](https://devforum.zoom.us/t/video-sdk-for-web-meeting-end-via-host/88423/1 "2023-05-15T18:50:57Z")

</div>

**Description**  
We are working on Integrating the Video SDK to our angular app and have used the Sample Web Video SDK App provided by Zoom for our reference.

We have added a button on UI for Host and Participant to end/leave meeting. On click of button we are calling zoomClient.leave(true) if host or zoomClient.leave() if participant.

If the host clicks on the end button the Session ends for everyone however we are unable to identify this event in all other participant browser so that we can exit meeting for each participant.

Is there a event that need to be handled in order to know that host has ended the session from his/her end and the participants are taken out of meeting and could be redirected to other page.

Note: We have handled zoomClient.on(‘user-removed’) event, but this gets called anytime the host or attendee leaves the meeting. It does not provide information if the session has ended or not.

**Browser Console Error**  
No Error in console.

**Which Web Video SDK version?**  
“@zoom1234/videosdk”: “^1.6.0”,

**Video SDK Code Snippets**

Function that is called on click on End Meeting Button

```auto
public async onLeaveSessionClick() {
    try {
      this.loaderService.showLoader();
      await Promise.all([this.toggleSelfVideo(false), this.stopAllParticipantVideo()]);

      this.mediaStream.stopAudio();

      let currentUser = this.participants.find((user) => user.userId === this.selfId);

      //Pass true if host and end session and false if participant and leave session
      if(currentUser?.isHost) {
        await this.zoomClient.leave(true);
      }
      else {
        await this.zoomClient.leave();
      }

      this.loaderService.hideLoader();

      //show ending screen
      this.routingService.routeToPath(`/zoom/${this.taskId}/end`, { queryParamsHandling: 'merge', replaceUrl: true });
    } catch (e) {
      this.loaderService.hideLoader();
      console.error('Error leaving session', e);
    }
  }

```

---

<div class="post-metadata">

**Author:** ![vic.yang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/vic.yang/32/24656_2.png) [@vic.yang](https://devforum.zoom.us/u/vic.yang)\
**Post date:** [May 23, 2023, 7:01am UTC](https://devforum.zoom.us/t/video-sdk-for-web-meeting-end-via-host/88423/3 "2023-05-23T07:01:49Z")

</div>

Hey @rs.subk-dev

Thanks for your feedback.

In Video SDK Web, when the session is ended(user left or host ended), the `connection-change` with `payload.state === ConnectionState.Closed` will be fired.

Thanks  
Vic

---

<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:** [June 22, 2023, 5:02pm UTC](https://devforum.zoom.us/t/video-sdk-for-web-meeting-end-via-host/88423/4 "2023-06-22T17:02:12Z")

</div>

Closed on June 22, 2023, 5:02pm UTC

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