# Web sdk - Connecting the user with computer audio automatically when joining

**URL:** <https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682>\
**Category:** Web\
**Created:** [December 8, 2018, 7:04pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682 "2018-12-08T19:04:46Z")\
**Posts on this page:** 18\
**Page:** 2

<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:** [March 13, 2020, 4:14pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/21 "2020-03-13T16:14:42Z")

</div>

Hey @vijetha,

A real user needs to start the meeting via the start\_url, or pressing the start meeting button in Zoom, or via the Web SDK.

> [@Is it possible to start the meeting from web sdk like joining meeting?](https://devforum.zoom.us/t/is-it-possible-to-start-the-meeting-from-web-sdk-like-joining-meeting/5772/2):
>
> Hey @tech1, thanks for posting. Yes you can start a meeting via the Web SDK. Just change the role in the meetConfig object to 1 Thanks, Tommy

Starting a meeting cannot be automated.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![netanelisaacs](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/netanelisaacs/32/4785_2.png) [@netanelisaacs](https://devforum.zoom.us/u/netanelisaacs)\
**Post date:** [April 3, 2020, 2:10am UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/22 "2020-04-03T02:10:10Z")

</div>

Hi,

I was able to get the code to work on my page. But not I am getting this error message…

 ![Screen Shot 2020-04-02 at 9.08.50 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/b/b083f1c51a167c147a68b41a097182e1c5c312d4.png)

---

<div class="post-metadata">

**Author:** ![michael\_p.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_p.zoom/32/18105_2.png) [@michael\_p.zoom](https://devforum.zoom.us/u/michael_p.zoom)\
**Post date:** [April 3, 2020, 3:13am UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/23 "2020-04-03T03:13:10Z")

</div>

Hi @netanelisaacs,

Is the meeting ID you used, created under your account? Can you DM me the meeting ID?

---

<div class="post-metadata">

**Author:** ![mrmulshine](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/mrmulshine/32/7327_2.png) [@mrmulshine](https://devforum.zoom.us/u/mrmulshine)\
**Post date:** [April 30, 2020, 1:01am UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/24 "2020-04-30T01:01:48Z")

</div>

How does zoom access computer audio when screen-sharing? Is this done through the Screen Sharing API? 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:** [May 1, 2020, 9:03pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/25 "2020-05-01T21:03:52Z")

</div>

Hey @mrmulshine,

Are you referring to the Zoom App or [Web SDK](https://marketplace.zoom.us/docs/sdk/native-sdks/web)?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![abhishek.bh87](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/abhishek.bh87/32/2964_2.png) [@abhishek.bh87](https://devforum.zoom.us/u/abhishek.bh87)\
**Post date:** [May 3, 2020, 7:41am UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/27 "2020-05-03T07:41:56Z")

</div>

There is better way to do that until an update comes from zoom. This will immediately click the join button:  
var buttonFound=false;  
var t = setInterval(function(){  
var startButton = document.getElementById(“pc-join”);  
if(startButton!=null){  
buttonFound = true;  
startButton.click();  
}  
var startButton = document.getElementById(“pc-join”);  
if(startButton==null && buttonFound){  
clearInterval(t);  
}  
},500);

---

<div class="post-metadata">

**Author:** ![cquibada](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cquibada/32/13063_2.png) [@cquibada](https://devforum.zoom.us/u/cquibada)\
**Post date:** [May 3, 2020, 8:03am UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/28 "2020-05-03T08:03:26Z")

</div>

I think this will not work on mobile browsers. Mobile browsers need gestures to be able to hear the AudioContext.

---

<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:** [May 6, 2020, 7:53pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/29 "2020-05-06T19:53:46Z")

</div>

Thanks for the tip @abhishek.bh87! 🙂

-Tommy

---

<div class="post-metadata">

**Author:** ![harald.glanzer](https://avatars.discourse-cdn.com/v4/letter/h/eada6e/32.png) [@harald.glanzer](https://devforum.zoom.us/u/harald.glanzer)\
**Post date:** [June 10, 2020, 8:22am UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/30 "2020-06-10T08:22:47Z")

</div>

hello people,

unfortunately, zoom keeps changing the element ids, for example what had former the html id ‘pc-join’ is not available anymore with zoom 1.7.8

- everytime when zoom upgrades the websdk version, its likely that our websdk integration breaks
- also, we have troubles with this audio auto-join hack as sometimes no audio can be heard on the other (non-websdk) client side

i know that your priorities had been shifted, but when can we expect websdk support for this audio join?  
should this feature be included in websdk 1.8.0 (scheduled june 2020, as written [here](https://marketplace.zoom.us/docs/guides/stay-up-to-date/upcoming-changes/web-sdk))

regards,  
hari

---

<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 15, 2020, 8:33pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/31 "2020-06-15T20:33:57Z")

</div>

Hey @harald.glanzer,

> [@harald.glanzer](#):
>
> everytime when zoom upgrades the websdk version, its likely that our websdk integration breaks

Currently we do not support customizing the Web SDK so I suggest not relying on the Web SDK DOM elements.

> [@harald.glanzer](#):
>
> also, we have troubles with this audio auto-join hack as sometimes no audio can be heard on the other (non-websdk) client side

Users must click on the audio option for it to work properly.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![martina.muscariello](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/martina.muscariello/32/10530_2.png) [@martina.muscariello](https://devforum.zoom.us/u/martina.muscariello)\
**Post date:** [June 17, 2020, 10:08pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/32 "2020-06-17T22:08:58Z")

</div>

we are using zoom web sdk 1.7.8.  
In our webinars, we would like to autojoin audio without users interaction.  
I understand it is not possible. Right?  
Any suggestion?

---

<div class="post-metadata">

**Author:** ![it17](https://avatars.discourse-cdn.com/v4/letter/i/ea5d25/32.png) [@it17](https://devforum.zoom.us/u/it17)\
**Post date:** [June 17, 2020, 10:09pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/33 "2020-06-17T22:09:02Z")

</div>

we are using zoom web sdk 1.7.8.  
In our webinars, we would like to autojoin audio without users interaction.  
I understand it is not possible. Right?  
Any suggestion?

---

<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 18, 2020, 11:44pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/34 "2020-06-18T23:44:55Z")

</div>

Hey @martina.muscariello, @it17,

The Web SDK requires users to click to join with audio.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![nvivot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/nvivot/32/4489_2.png) [@nvivot](https://devforum.zoom.us/u/nvivot)\
**Post date:** [June 25, 2020, 12:16am UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/35 "2020-06-25T00:16:11Z")

</div>

Hi there,

We faced same problem and could solve this by implementing a DOM discovery system.  
( **please be aware that this is not a perfect solution as it’s based on CSS properties and therefore is strongly exposed to Zoom code modifications between releases** )

With the web sdk, the init() and join() actions will interact and change the DOM of your main zoom HTML component.  
You can therefore listen to DOM modification events and react on it to discover the change you are interested in (this change is the display of the audio join popup)  
Then when such event is discovered, you can interact with the button and perform the click on it by code.

Here is an example in ReactJs:

Here is the function to listen for DOM modification related to the audio join button we wait for:

```
listenForAudioButtonNode(params, callback) {

  new MutationObserver(function(mutations) {
    const el = document.querySelector(params.className);

    if (el) {
      this.disconnect();
      callback(el);
    }
  }).observe(params.parent || document, {
    subtree: true,
    childList: true,
  });
}

```

Here is the function to listen DOM modification on the button itself and perform the programmatic click on it:

```
autoAudioJoin(audioButton) {

  const config = {
    attributes: true,
    childList: true,
    attributeOldValue: true,
    subtree: true
  };

  const canClick = oldValue => {
    return oldValue ===
      'zm-btn zm-btn--primary zm-btn__outline--white zm-btn--lg zm-btn--disabled';
  }

  const isJoined = oldValue => {
    return oldValue === 'display: inline-block;';
  }

  const observer = new MutationObserver(mutations => {
    mutations.forEach(mutation => {
      if (canClick(mutation.oldValue)) {
        // When join button becomes clickable.
        audioButton.click();
      } else if (isJoined(mutation.oldValue)) {
        // When connected to audio.
        observer.disconnect();
      }
    });
  });

  observer.observe(audioButton, config);
}

```

And now you can call first function with second one as callback, before to perform the join with zoom SDK. It’s important do run it before to be sure to react on time to related DOM events.

```
... any code before

this.listenForAudioButtonNode(
  {
    className: '.zm-btn.zm-btn--primary.zm-btn__outline--white.zm-btn--lg',
    parent: document.getElementById('zmmtg-root'), // SETUP your own zoom root DOM element name here
    recursive: false
  },
  element => this.autoAudioJoin(element)
);

// then perform your zoom init & join here
zoom.init({...});

```

That hack is not perfect but still better than any setTimeout or setInterval as:

- it’s fully asynchronous and running in background
- it react on DOM events so you don’t need to setup any timing that may fail or comes too early / too late.

Hope this can help you to temporary unlock your issue until zoom sdk provide more options to customize how to join a meeting.

---

<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 25, 2020, 5:46pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/36 "2020-06-25T17:46:25Z")

</div>

Thanks for sharing this @nvivot! 🙂

-Tommy

---

<div class="post-metadata">

**Author:** ![naeem.ahmedk](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/naeem.ahmedk/32/9688_2.png) [@naeem.ahmedk](https://devforum.zoom.us/u/naeem.ahmedk)\
**Post date:** [November 18, 2020, 7:01pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/37 "2020-11-18T19:01:38Z")

</div>

I sort that out by using the below code and it works awesome. Please call ‘HideJoinAudio’ from success callback of Zmmtg.join().

function HideJoinAudio()  
{

```
        let joinBtn=document.getElementsByClassName("join-audio-by-voip__join-btn")[0];

        if(joinBtn)

        {

            $.wait(JoinAudioAuto, 5);

        }

        else{

            $.wait(OpenJoinAudio, 5);

            $.wait(JoinAudioAuto, 5);

        }

        return;

    }

    function OpenJoinAudio(){

        

        let btn=document.getElementsByClassName("join-audio-container__btn")[0];

        let joinDialog=document.getElementsByClassName("join-dialog")[0];

        

        if(btn && !joinDialog)

        {

            btn.click();

        }

        return;

    }

    function JoinAudioAuto(){

        let btn=document.getElementsByClassName("join-audio-by-voip__join-btn")[0];

        if(btn)

        {

            btn.click();

        }

        return;

    }

    $.wait = function( callback, seconds){

        return window.setTimeout( callback, seconds * 1000 );

    }
```

---

<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:** [November 19, 2020, 5:58pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/38 "2020-11-19T17:58:32Z")

</div>

Thanks for sharing @naeem.ahmedk! 🙂

-Tommy

---

<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:** [November 19, 2020, 5:58pm UTC](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682/39 "2020-11-19T17:58:38Z")

</div>

Closed on November 19, 2020, 5:58pm UTC



[Previous page](https://devforum.zoom.us/t/web-sdk-connecting-the-user-with-computer-audio-automatically-when-joining/2682.md?page=1)
