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 ability to set input stream #271

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adamduren
Copy link

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

Description

Adds the ability to specify an input audio stream rather than limiting input selection to devices. If there is desire to accept this change I can continue to run through the steps below.

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
  • Ready for review

Before merge

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

Copy link
Contributor

@ryan-rowland ryan-rowland left a comment

Choose a reason for hiding this comment

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

Hi @adamduren, thanks for the PR! This looks like useful functionality. Have you tested thoroughly on your end? I'd be worried about some potential edge cases regarding stream / track management, but otherwise I think this looks great. Left a couple small comments.

Once those and the PR checkpoints are addressed I think we can move forward. 🙂

* @param stream - A media stream to use as input
* @param device - A device to use as input
*/
private _setInputStream(stream: MediaStream, device: MediaDeviceInfo | null): Promise<void> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like we could nix the private method and put this logic in the public setInputStream, and call that above instead?

@@ -317,6 +317,15 @@ class AudioHelper extends EventEmitter {
'Related BugZilla thread: https://bugzilla.mozilla.org/show_bug.cgi?id=1299324'));
}

/**
* Replace the current input steamd with a new MediaStream.
Copy link
Contributor

Choose a reason for hiding this comment

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

sp: steamd -> stream

@adamduren
Copy link
Author

@ryan-rowland given that twilio-voice.js is out what is the best path forward to getting this accepted? Should I create the same PR (with corrections) to the other repo? We have been using this without issue in production. Our use case was to listen to incoming streams to perform DTMF detection inject a pre-recorded message if one is detected.

This is achieved using the WebAudio API to mix the user's selected input along with the AudioNode which can play the pre-recorded message.

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