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

Add source node to audio graph for silent devices #42

Merged
merged 1 commit into from
Dec 18, 2019

Conversation

andi-amzn
Copy link

Description of changes

Add source node to audio graph for silent devices. Without a source node, the WebAudio MediaStreamDestination will not actually contain any audio. The server will not show the attendee as present unless audio data is received. To fix, it is enough to have a gain node attached to the MediaStreamDestinationNode with no input of its own and a gain of 0.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@andi-amzn andi-amzn requested a review from XHatan December 18, 2019 00:41
@@ -249,14 +249,15 @@ export default class DefaultDeviceController implements DeviceControllerBasedMed
static synthesizeAudioDevice(toneHz: number): Device {
const audioContext = DefaultDeviceController.createAudioContext();
const outputNode = audioContext.createMediaStreamDestination();
const gainNode = audioContext.createGain();
gainNode.gain.value = 0.0;
gainNode.connect(outputNode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this gainNode.connect(outputNode) be executed after the following if or it does not matter ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter. It just needs to get hooked up to the outputNode. If using a tone generator then that will then get hitched to the gainNode in the if-block.

@XHatan XHatan merged commit b18be0c into master Dec 18, 2019
@XHatan XHatan deleted the fix-empty-audio-device branch December 18, 2019 01:16
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

Successfully merging this pull request may close these issues.

2 participants