Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

localTracks.audioTrack.setEnabled(false) not working #64

Open
ChurikiTenna opened this issue Sep 5, 2022 · 11 comments
Open

localTracks.audioTrack.setEnabled(false) not working #64

ChurikiTenna opened this issue Sep 5, 2022 · 11 comments

Comments

@ChurikiTenna
Copy link

Describe the bug

I have tried the example and everything worked fine but Mute function.

const onMute = async () => {

if (localTracks.audioTrack && localTracks.audioTrack._enabled) {
console.log("onMute true")
await localTracks.audioTrack.setEnabled(false)
} else {
console.log("onMute false")
await localTracks.audioTrack.setEnabled(true)
}
}

When I call onMute, I can see "onMute true" on the console, but it is not muted.

To Reproduce
Steps to reproduce the behavior:

  1. Call onMute during the live

Expected behavior
Mute audio

Desktop (please complete the following information):

  • OS: Mac OS
  • Browser: Chrome
  • Version: 4.13.0
@plutoless
Copy link
Contributor

not muted how? you can still hear audio from remote?

@ChurikiTenna
Copy link
Author

@plutoless
I am testing with two computer close to each other, then both of them get feedback even if both the computer is muted.

@laviedegeorge
Copy link

@ChurikiTenna please have you found a solution for this? cc @plutoless

@plutoless
Copy link
Contributor

@laviedegeorge are you also having this issue? do you have a minimal reproducible project? i can't reproduce from my end.

@laviedegeorge
Copy link

@plutoless I don't have a minimal reproducible project. I am integrating it into an existing product. Please if you have any minimal reproducible project with the mute buttons for audio and video working, can I have a look? Or if possible, I don't mind a call at your own time frame.

@plutoless
Copy link
Contributor

@laviedegeorge you can find our demo here
https://webdemo.agora.io/

@laviedegeorge
Copy link

@plutoless the demo codes are not in react. Also, I have tried using setMuted and setEnabled to mute audio and video but it only mutes on the clients' side but still streams on the remote users' end.

Please note that the remote user is using the Flutter SDK while the client (ME) is using the Web SDK.

@plutoless
Copy link
Contributor

ok we have an internal react demo, let's see if i can find that

@laviedegeorge
Copy link

@plutoless ok thank you. I think I have come across it. (Not sure if it is the correct one) but most of the demos I have seen, do not have the mute functionality.
Also here is a snippet of what I have.

`
const mute = async (type: "audio" | "video") => {
console.log("tracksss", tracks);
const [audio, video] = tracks;

try {
  if (type === "audio") {
    await audio.setMuted(!trackState.audio);
    setTrackState((ps) => {
      return { ...ps, audio: !ps.audio };
    });
  } else if (type === "video") {
    await video.setMuted(!trackState.video);
    console.log("is video muted:", video.muted);

    setTrackState((ps) => {
      return { ...ps, video: !ps.video };
    });
  }
} catch (error) {
  console.error("Error from mute function", error);
}

};
`

@QinZhen001
Copy link
Contributor

hello, when you call setEnabled api there will be sdk log in the console, you can check whether it is correct.
also ensure that the audioTrack is correctly created and usable.If you are interested, you can also refer to: https://github.com/AgoraIO-Community/Agora-RTC-React

@laviedegeorge
Copy link

@QinZhen001 thank you for your suggestion. I forget to mention that I got headway yesterday with the React demo in the examples. Most likely I am doing something wrong but the only difference I can see for now is that the example is using a custom hook. I am currently refactoring my code, let's see if it works. Also, I noticed that https://github.com/AgoraIO-Community/Agora-RTC-React uses the react wrapper agora-rtc-react and the React Demo uses agora-rtc-sdk-ng. Please which of them is preferred for a React project? cc @plutoless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants