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

[feature request] Select audio stream source #55

Open
ythecombinator opened this issue Apr 26, 2018 · 1 comment
Open

[feature request] Select audio stream source #55

ythecombinator opened this issue Apr 26, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@ythecombinator
Copy link
Contributor

ythecombinator commented Apr 26, 2018

In most video/voice messaging apps out there we have an option to select where we want the audio to come from–e.g. Built-in microphone, Bluetooth device etc.

I admit I haven't thought about the implementation details yet, tbh. But initially I think of:

getAvailableAudioSources(): Array<source> - A helper function that returns an array–or an object–of available sources where the first element is always the Built-in microphone and the subsequent ones are alternatives like Bluetooth devices or similar. I haven't modeled the mentioned the source object, but it'd be something with some metadata.

This would be quite helpful:

  • I could check getAvailableAudioSources().length to know wether to show a swap option or not
  • The metadata in each item would allow me to render a UI that better explains this item

For the component, having it just as a prop of OTPublisher–just like cameraPosition–would be something great, e.g.:

audioSource: number - The preferred audio source where valid inputs are indexed values of the getAvailableAudioSources() array.

Resulting in something like:

import {OTPublisher, OTSession, OTSubscriber} from 'opentok-react-native/components';
import {getAvailableAudioSources} from 'opentok-react-native/utils';

class App extends Component {
  constructor(props) {
    super(props);

    this.state = {
      audioSource: 0, // `0` could be a default value
    };
  }

  onChangeAudioSourceButtonPress = (src) => {
    this.setState((state) => ({
      ...state,
      audioSource: src
    }));
  };

  render() {
    const audioSources = getAvailableAudioSources();
    // We could then map audioSources to any UI component–e.g. a list–that would render a list 
    // of options and then call onChangeAudioSourceButtonPress() depending on the selected one 

    return (
      <OTSession apiKey="your-api-key" sessionId="your-session-id" token="your-session-token">
        <OTPublisher
          properties={audioSource: this.state.audioSource}
          style={{ height: 100, width: 100 }}
        />
      </OTSession>
    );
  }
}
@msach22 msach22 added the enhancement New feature or request label Jun 11, 2018
@enricop89
Copy link
Contributor

Unfortunately this is not implemented on Native SDK so not feasible at this point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants