-
-
Notifications
You must be signed in to change notification settings - Fork 48
Input selection + ios BT category fix #926
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4318842
fix: feat: wip: working on input selection and category fixes
michalsek 620098e
fix: feat: wip: working on input selection and category fixes
michalsek 658d740
feat: ios device switch + react hook
michalsek 9f788f5
feat: android noop
michalsek 5b544c8
feat: add docs for input selection
michalsek 6aebfa0
Update packages/react-native-audio-api/src/index.ts
michalsek 61ce535
fix: tsdocs + android resolve
michalsek b7fb814
fix: oldarch spec
michalsek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "label": "React", | ||
| "position": 11, | ||
| "link": { | ||
| "type": "generated-index" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| --- | ||
| sidebar_position: 1 | ||
| --- | ||
|
|
||
| import { IOS } from '@site/src/components/Badges'; | ||
|
|
||
| # useAudioInput | ||
|
|
||
| <br /> | ||
|
|
||
| React hook for managing audio input device selection and monitoring available audio input devices. Current input will be available after first activation of the audio session. Not all connected devices might be listed as available inputs, some might be filtered out as incompatible with current session configuration. | ||
|
|
||
michalsek marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| The `useAudioInput` hook provides an interface for: | ||
| - Retrieving all available audio input devices | ||
| - Getting the currently active input device | ||
| - Switching between different input devices | ||
|
|
||
| <IOS /> **Platform support:** Input device selection is currently only supported on iOS. On Android, `useAudioInput` is implemented as a no-op: the hook will not list or switch input devices, and any selection calls will effectively be ignored. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```tsx | ||
| import React from 'react'; | ||
| import { View, Text, Button } from 'react-native'; | ||
| import { useAudioInput } from 'react-native-audio-api'; | ||
|
|
||
| function AudioInputSelector() { | ||
| const { availableInputs, currentInput, onSelectInput } = useAudioInput(); | ||
|
|
||
| return ( | ||
| <View> | ||
| <Text>Current Input: {currentInput?.name || 'None'}</Text> | ||
|
|
||
| {availableInputs.map((input) => ( | ||
| <Button | ||
| key={input.uid} | ||
| title={`${input.name} (${input.category})`} | ||
| onPress={() => onSelectInput(input)} | ||
| /> | ||
| ))} | ||
| </View> | ||
| ); | ||
| } | ||
| ``` | ||
|
|
||
| ## Return Value | ||
|
|
||
| The hook returns an object with the following properties: | ||
|
|
||
| ### `availableInputs: AudioDeviceInfo[]` | ||
|
|
||
| An array of all available audio input devices. Each device contains: | ||
| - `uid: string` - Unique device identifier | ||
| - `name: string` - Human-readable device name | ||
| - `category: string` - Device category (e.g., "Built-In Microphone", "Bluetooth") | ||
|
|
||
| ### `currentInput: AudioDeviceInfo | null` | ||
|
|
||
| The currently active audio input device, or `null` if no device is selected. | ||
|
|
||
| ### `onSelectInput: (device: AudioDeviceInfo) => Promise<void>` | ||
|
|
||
| Function to programmatically select an audio input device. Takes an `AudioDeviceInfo` object and attempts to set it as the active input device. | ||
|
|
||
| ## Related | ||
|
|
||
| - [AudioManager](/docs/system/audio-manager) - For managing audio sessions and permissions | ||
| - [AudioRecorder](/docs/inputs/audio-recorder) - For capturing audio from the selected input device | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export { default as useAudioInput } from './useAudioInput'; | ||
| export { default as useSystemVolume } from './useSystemVolume'; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.