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
Change the name of AudioDeviceSelector class to AudioSwitch (#56)
* Add modify audio settings permission to manifest
* Move all selector classes to the top level package
* Rename AudioDeviceSelector -> AudioSwitch
* Update changelog
* update gradle.properties
* Change version in changelog to 0.3.0
* change http to https for jfrog oss url
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7-5
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,17 @@
4
4
5
5
Enhancements
6
6
7
-
- Added `AudioDeviceSelector.VERSION` constant so developers can access the version of AudioSwitch at runtime.
8
-
- Added `AudioDeviceSelector.loggingEnabled` property so developers can configure AudioSwitch logging behavior at runtime. By default, AudioSwitch logging is disabled. Reference the following snippet to enable AudioSwitch logging:
7
+
- Changed the name of the `AudioDeviceSelector` class to `AudioSwitch`.
8
+
- Added the [MODIFY_AUDIO_SETTINGS](https://developer.android.com/reference/android/Manifest.permission#MODIFY_AUDIO_SETTINGS) to the library manifest so it can be automatically consumed by applications.
9
+
- Added `AudioSwitch.VERSION` constant so developers can access the version of AudioSwitch at runtime.
10
+
- Added `AudioSwitch.loggingEnabled` property so developers can configure AudioSwitch logging behavior at runtime. By default, AudioSwitch logging is disabled. Reference the following snippet to enable AudioSwitch logging:
Instantiate an instance of the [AudioDeviceSelector](audioswitch/src/main/java/com/twilio/audioswitch/selection/AudioDeviceSelector.kt) class, passing a reference to the application context.
47
+
### AudioSwitch Setup
48
+
Instantiate an instance of the [AudioSwitch](audioswitch/src/main/java/com/twilio/audioswitch/AudioSwitch.kt) class, passing a reference to the application context.
To begin listening for live audio device changes, call the start function and pass a lambda that will receive [AudioDevices](audioswitch/src/main/java/com/twilio/audioswitch/selection/AudioDevice.kt) when they become available.
55
+
To begin listening for live audio device changes, call the start function and pass a lambda that will receive [AudioDevices](audioswitch/src/main/java/com/twilio/audioswitch/AudioDevice.kt) when they become available.
You can also retrieve the available and selected audio devices manually at any time by calling the following properties:
63
63
```kotlin
64
-
val devices:List<AudioDevice> =audioDeviceSelector.availableAudioDevices
65
-
val selectedDevice:AudioDevice?=audioDeviceSelector.selectedAudioDevice
64
+
val devices:List<AudioDevice> =audioSwitch.availableAudioDevices
65
+
val selectedDevice:AudioDevice?=audioSwitch.selectedAudioDevice
66
66
```
67
67
**Note:** Don't forget to stop listening for audio devices when no longer needed in order to prevent a memory leak.
68
68
```kotlin
69
-
audioDeviceSelector.stop()
69
+
audioSwitch.stop()
70
70
```
71
71
72
72
### Select a Device
73
73
Before activating an AudioDevice, it needs to be selected first.
74
74
```kotlin
75
-
devices.find { it isAudioDevice.Speakerphone }?.let { audioDeviceSelector.selectDevice(it) }
75
+
devices.find { it isAudioDevice.Speakerphone }?.let { audioSwitch.selectDevice(it) }
76
76
```
77
77
If no device is selected, then the library will automatically select a device based on the following priority: `BluetoothHeadset -> WiredHeadset -> Earpiece -> Speakerphone`.
78
78
79
79
### Activate a Device
80
80
Activating a device acquires audio focus with [voice communication usage](https://developer.android.com/reference/android/media/AudioAttributes#USAGE_VOICE_COMMUNICATION) and begins routing audio input/output to the selected device.
81
81
```kotlin
82
-
audioDeviceSelector.activate()
82
+
audioSwitch.activate()
83
83
```
84
84
Make sure to revert back to the prior audio state when it makes sense to do so in your app.
85
85
```kotlin
86
-
audioDeviceSelector.deactivate()
86
+
audioSwitch.deactivate()
87
87
```
88
-
**Note:** The `stop()` function will call `deactivate()` before closing AudioDeviceSelector resources.
88
+
**Note:** The `stop()` function will call `deactivate()` before closing AudioSwitch resources.
89
89
90
90
## Bluetooth Support
91
91
92
92
Multiple connected bluetooth headsets are supported.
93
-
- The library will accurately display the up to date active bluetooth headset within the `AudiodDeviceSelector``availableAudioDevices` and `selectedAudioDevice` functions.
93
+
- The library will accurately display the up to date active bluetooth headset within the `AudioSwitch``availableAudioDevices` and `selectedAudioDevice` functions.
94
94
- Other connected headsets are not stored by the library at this moment.
95
95
- In the event of a failure to connecting audio to a bluetooth headset, the library will revert the selected audio device (this is usually the Earpiece on a phone).
96
96
- If a user would like to switch between multiple Bluetooth headsets, then they need to switch the active bluetooth headset from the system Bluetooth settings.
97
-
- The newly activated headset will be propagated to the `AudiodDeviceSelector``availableAudioDevices` and `selectedAudioDevice` functions.
97
+
- The newly activated headset will be propagated to the `AudioSwitch``availableAudioDevices` and `selectedAudioDevice` functions.
98
98
99
99
## Java Compatibility
100
100
@@ -105,11 +105,11 @@ Audioswitch is compatible with apps written in Java that [target Java 8](https:/
105
105
By default, AudioSwitch logging is disabled. Reference the following snippet to enable AudioSwitch logging:
0 commit comments