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

Be able to configure audio and video constraints in the easyrtc adapter #300

Open
vincentfretin opened this issue Oct 31, 2021 · 6 comments

Comments

@vincentfretin
Copy link
Member

This is currently hard coded

navigator.mediaDevices.getUserMedia({
video: that.easyrtc.videoEnabled,
audio: that.easyrtc.audioEnabled
}).then(

We should be able to specify options here like

audio: {echoCancellation: true, noiseSuppression: true, autoGainControl: true}

instead of audio: true

and for example

video: {mediaSource: "camera", width: { max: 1280, ideal: 640 }, height: { ideal: 360 }, frameRate: 30}

instead of video: true

@vincentfretin
Copy link
Member Author

@Rsquare-14
Copy link

Hello @vincentfretin , I am using the audio streaming as in networked-audio-source.js. There is echo coming up whenever i speak. I am hearing my own voice repeatedly with reducing intensities. Is there any solution for that. I have seen the solution given in easyrtc discussions. But still not able to fix it using that. If there is any implementation for that, Could you share a example in AFrame here please. thanks in advance.

@vincentfretin
Copy link
Member Author

You have an echo without headphones on Chrome even with echoCancellation: true I suppose? This is known issue.
Chrome AEC doesn't work for streams coming directly from the RTCPeerConnection, it is only working if the stream goes through the WebAudio API. See this article https://dev.to/focusedlabs/echo-cancellation-with-web-audio-api-and-chromium-1f8m that link to the Chrome issue. A hack exists to make it work by creating a local RTCPeerConnection and Audio element. You can see the related code in Hubs https://github.com/mozilla/hubs/blob/a99baac8a4f0fdb6eca70041de7666ab55660a58/src/systems/audio-system.js#L28-L122
You need to handle the creation of the THREE.AudioContext yourself though, and properly handle resuming the audio context via a user gesture as well, related code in Hubs https://github.com/mozilla/hubs/blob/a99baac8a4f0fdb6eca70041de7666ab55660a58/src/systems/audio-system.js#L260-L298

This is an area I want to improve in the core of networked-aframe, probably by creating an audio system or put that in the networked-scene component. I did all that in a project two years ago with the janus adapter, but I will also need that again as reusable components in new projects soon. I'll be working on some audio stuff #330, trying resonance audio, and private audio zones in the coming months. I'll try to contribute this work as much as possible to the networked-aframe repo.

@codingsplash
Copy link

@vincentfretin , I have the same issue. More precisely, its not an echo. Its basically the users own voice being heard, like a playback/feedback effect. There should be a way to mute local audio stream. Something similar to this : RocketChat/Rocket.Chat#15018

@vincentfretin
Copy link
Member Author

Yes that's exactly the issue I'm talking about.

@vincentfretin
Copy link
Member Author

FYI For the janus adapter, I put the audio system that handle the AudioContext suspended state on mobiles and Chrome AEC in the janus repo, see
networked-aframe/naf-janus-adapter#54
networked-aframe/naf-janus-adapter#55
networked-aframe/naf-janus-adapter#56

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

No branches or pull requests

3 participants