m1dugh / native-sound-mixer

MIT License
25 stars 13 forks source link

Zoom audio session not captured correctly #9

Closed cepsong closed 3 years ago

cepsong commented 3 years ago

In Windows, when zoom was launched for a meeting, there will be two audio sessions which can be viewed from the volume mixer, namely Zoom/Zoom Cloud Meetings, and Zoom Meetings/Zoom Meetings- 40minutes (for free user when it is close to session time limit), however, the session that can be captured is only zoom.exe from C:\Users\xxx\AppData\Roaming\Zoom\bin\, but both audio sessions. The result is if anyone is lucky and stars are aligned, then Zoom Meetings thread can be control from this plug-in, but otherwise it would have no control. The audio comes from the later - Zoom Meetings session only. Any idea on how to resolve this? @m1dugh Thanks!

m1dugh commented 3 years ago

Are both audio sessions shown in windows sound-mixer or in native-sound-mixer ? (Sorry I couldn't yet try on my own)

cepsong commented 3 years ago

Hi m1dugh,

Both sessions of Zoom are shown on windows sound mixer (GUI, shown as below), but only one is shown in native-sound-mixer. If we get lucky, then it is the right one, otherwise its volume cannot be controlled. If you are using windows, you can just open Zoom and as free user you can start a meeting, then you will see the two sessions in the windows sound mixer, but the returned results from native-sound-mixer is only one called zoom.exe. There should be a way to detect both sessions if they are both shown in windows sound mixer GUI, right? Thanks! zoom sessions

On 13 Sep 2021, at 2:38 PM, m1dugh @.***> wrote:

Are both audio sessions shown in windows sound-mixer or in native-sound-mixer ? (Sorry I couldn't yet try on my own)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/m1dugh/native-sound-mixer/issues/9#issuecomment-917885620, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATMDTHXD7VSIS7M2WLFCOH3UBWL5FANCNFSM5D2U6YRA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

cepsong commented 3 years ago

Just to add, in this link (https://techswift.org/2020/04/03/how-to-adjust-volume-in-a-zoom-meeting/), under the alternative method to adjust Zoom volume, it also shows the two audio sessions in windows sound mixer. If we can get both of them, we don't have to distinguish them and just turn up/down/off/on both session volume will give us the control. So the question is how to get the ID for both sessions (currently there is only one returned, randomly).

cepsong commented 3 years ago

I just found the instance (audio session) name not captured by native-sound-mixer is "zcefagent.exe" (the captured is always "zoom.exe" only). Not sure why this is not captured, but is it possible to include it manually or hardcoded in an object for volume control of Zoom? Thanks.

m1dugh commented 3 years ago

I have to rework the whole architecture to make it properly work, I should have published it by tomorrow.

m1dugh commented 3 years ago

I published a patch at npm registery (version 3.2.2-BETA.1) adding a name field allowing you to see all audio sessions and making every ids uniques. Patches hasn't been yet published on github and do no longer take session id as persistent, I'll continue on reworking the extension in the upcoming week.

cepsong commented 3 years ago

Thank you! I tried running it on Electron, but it doesn’t seem to run at all. Can you look into it or is there something I need to do to run it in Electron? Thanks.

On 15 Sep 2021, at 4:04 AM, m1dugh @.***> wrote:

I published a patch at npm registery (version 3.2.2-BETA.1) adding a name field allowing you to see all audio sessions and making every ids uniques. Patches hasn't been yet published on github and do no longer take session id as persistent, I'll continue on reworking the extension in the upcoming week.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/m1dugh/native-sound-mixer/issues/9#issuecomment-919473611, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATMDTHWWZLLAQQI5UKIOMR3UB6TDLANCNFSM5D2U6YRA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

m1dugh commented 3 years ago

I'll check that out. I ran the tests locally so i guess it works ( it passed the tests on my computer) in a regular node environment but could you confirm that ?

m1dugh commented 3 years ago

I checked for electron and it seem to be working (at least for windows) I can change the devices and session volume and mute. here is my electron code:

const { app, BrowserWindow } = require('electron')
const SoundMixer = require('native-sound-mixer').default

function createWindow() {
    const win = new BrowserWindow({
        width: 800,
        height: 600
    });

    win.loadFile('index.html');
}

app.whenReady().then(() => {
    const dev = SoundMixer.getDefaultDevice(0);

        dev.volume = .3;
    const session = dev.sessions.filter(({state, name}) => state === 1 && name.startsWith("Zoom"))[0]

    console.log(session.volume)
    session.volume = 1

    createWindow()
})

Do you have the latest version of native-sound-mixer (namely 3.2.2-BETA.1) ?

cepsong commented 3 years ago

I tried it again and this time all seems fine. It is perhaps specific to the PC I tried earlier. Will try to test it out again. Thank you so much for the great work, and look forward to release version soon!

cepsong commented 3 years ago

Just found a bug with the beta version (nonexistent in 3.2.0): if any programs started with the native sound mixer in the background (run after native sound mixer beta), then the audio sessions cannot be captured at all (thus no control is available for that audio session). This problem is specific to the beta version currently. Appreciate it if you can look into it.

On 16 Sep 2021, at 5:17 AM, m1dugh @.***> wrote:

 Closed #9.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

cepsong commented 3 years ago

Just a quick check. I reported the issue of audio session IDs captured only when they are open before native sound fixer is used. I guess it is a code bug of the Beta as there was no such an issue with the previous release versions. Can you confirm this? Look forward to the resolution. Thanks!

I checked for electron and it seem to be working (at least for windows) I can change the devices and session volume and mute. here is my electron code:

const { app, BrowserWindow } = require('electron')
const SoundMixer = require('native-sound-mixer').default

function createWindow() {
  const win = new BrowserWindow({
      width: 800,
      height: 600
  });

  win.loadFile('index.html');
}

app.whenReady().then(() => {
  const dev = SoundMixer.getDefaultDevice(0);

        dev.volume = .3;
  const session = dev.sessions.filter(({state, name}) => state === 1 && name.startsWith("Zoom"))[0]

  console.log(session.volume)
  session.volume = 1

  createWindow()
})

Do you have the latest version of native-sound-mixer (namely 3.2.2-BETA.1) ?

m1dugh commented 3 years ago

I noticed the bug and will fix it as soon as i can (you can expect a stable update by next monday at the very least). This might not show up in the stable version, it is only due to this beta version since it apparently depends mainly on the pc you use for some odd reason.

cepsong commented 3 years ago

This bug is not specific to a PC ad I have tried several PCs with the beta version but all experiencing the same bug/problem (native sound mixer can only capture audio sessions started before itself gets started). Look forward to the stable version! Thanks.

On 17 Sep 2021, at 2:03 PM, m1dugh @.***> wrote:

 I noticed the bug and will fix it as soon as i can (you can expect a stable update by next monday at the very least). This might not show up in the stable version, it is only due to this beta version since it apparently depends mainly on the pc you use for some odd reason.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

m1dugh commented 3 years ago

Noticed that, found the buggy part in the code.

m1dugh commented 3 years ago

Shall be fixed now as of version v3.2.2