-
Notifications
You must be signed in to change notification settings - Fork 53
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
VBLOCKS-3054 Fix echo and default stream not switching #270
Conversation
lib/twilio/audiohelper.ts
Outdated
// this.inputDevice is not null if audio.setInputDevice() was explicitly called | ||
(this.inputDevice && this.inputDevice.deviceId === defaultId) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
I would prefer to have these complex conditions broken out like so:
const defaultId = 'default';
const isInputDeviceSet = this.inputDevice && this.inputDevice.deviceId === defaultId;
const isInputDeviceNotSet = this._defaultInputDeviceStream && this.availableInputDevices.get(defaultId);
It might not eliminate the need for the comments entirely, but it helps explain things and make the code more readable IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. I'll update it. Though I would rename the 2nd one to isDefaultDeviceSet.
@@ -1976,6 +1976,23 @@ describe('PeerConnection', () => { | |||
}).then(done).catch(done); | |||
}); | |||
|
|||
it('Should call setSinkId with \'\' if empty string is first device', done => { | |||
output.audio.setSinkId.returns(Promise.resolve()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, this will cause the function to return the same promise every time. I don't see it affecting anything in this case, but wanted to note it.
lib/twilio/audiohelper.ts
Outdated
// If this.inputDevice is null, and default stream is not null, it means | ||
// this.inputDevice is not null if audio.setInputDevice() was explicitly called | ||
const isInputDeviceSet = this.inputDevice && this.inputDevice.deviceId === defaultId; | ||
// If this.inputDevice is null, and default stream is not null, it means | ||
// the user is using the default stream and did not explicitly call audio.setInputDevice() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// the user is using the default stream and did not explicitly call audio.setInputDevice() | |
// the user is using the default stream and did not explicitly call audio.setInputDevice() |
Formatting nit.
Contributing to Twilio
Pull Request Details
Please see changelog.
Burndown
Before review
npm test
Before merge