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

Video 4601 fix audio input device #487

Merged
merged 5 commits into from
Apr 9, 2021

Conversation

olipyskoty
Copy link
Contributor

Contributing to Twilio

All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.

  • I acknowledge that all my contributions will be made under the project's license.

Pull Request Details

JIRA link(s):

Description

This PR fixes the bug addressed in GitHub Issue #462.

When a user is connected to a room and uses an external microphone (or headphones with a built-in microphone), and then disconnects that mic, the other participants can no longer hear the user despite being unmuted. We fixed this bug by adding a new hook (useRestartAudioTrackOnDeviceChange()) to the VideoProvider. This hook restarts the local audio track whenever there is a device change event and the track's mediaStreamTrack.readyState is equal toended.

Burndown

Before review

  • Updated CHANGELOG.md if necessary
  • Added unit tests if necessary
  • Updated affected documentation
  • Verified locally with npm test
  • Manually sanity tested running locally
  • Included screenshot as PR comment (if needed)
  • Ready for review

Before merge

  • Got one or more +1s
  • Re-tested if necessary

Comment on lines +3 to +4

export default function useRestartAudioTrackOnDeviceChange(localTracks: (LocalAudioTrack | LocalVideoTrack)[]) {
Copy link
Contributor

@timmydoza timmydoza Apr 9, 2021

Choose a reason for hiding this comment

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

I think it would be nice to have a comment here to explain the purpose of the hook. I was thinking something like this:

Suggested change
export default function useRestartAudioTrackOnDeviceChange(localTracks: (LocalAudioTrack | LocalVideoTrack)[]) {
// If a user has published an audio track from an external audio input device and disconnects the device, the published
// audio track will be stopped and the user will no longer be heard be other participants. To prevent this issue, this hook
// will re-acquire a mediaStreamTrack from the system's default audio device when it detects that the published audio device
// has been disconnected.
export default function useRestartAudioTrackOnDeviceChange(localTracks: (LocalAudioTrack | LocalVideoTrack)[]) {

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think that is a good idea! i reformatted the comment but kept your wording. let me know if i should change it back!

@olipyskoty olipyskoty merged commit a0e4b60 into master Apr 9, 2021
@olipyskoty olipyskoty deleted the VIDEO-4601-fix-audio-input-device branch April 9, 2021 16:03
@jszem
Copy link

jszem commented Apr 15, 2021

@timmydoza do you know when this will be released? Thanks

@olipyskoty
Copy link
Contributor Author

Hey @jszem! A new release that includes this bug fix has been published just now. Please let us know if you run into any other issues, or have any questions!

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.

3 participants