You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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';classAppextendsComponent{constructor(props){super(props);this.state={audioSource: 0,// `0` could be a default value};}onChangeAudioSourceButtonPress=(src)=>{this.setState((state)=>({
...state,audioSource: src}));};render(){constaudioSources=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(<OTSessionapiKey="your-api-key"sessionId="your-session-id"token="your-session-token"><OTPublisherproperties={audioSource: this.state.audioSource}style={{height: 100,width: 100}}/></OTSession>);}}
The text was updated successfully, but these errors were encountered:
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:
This would be quite helpful:
getAvailableAudioSources().length
to know wether to show a swap option or notFor the component, having it just as a prop of
OTPublisher
–just likecameraPosition
–would be something great, e.g.:Resulting in something like:
The text was updated successfully, but these errors were encountered: