All Projects → twilio → Audioswitch

twilio / Audioswitch

Licence: apache-2.0
An Android audio management library for real-time communication apps.

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to Audioswitch

Twilio Java
A Java library for communicating with the Twilio REST API and generating TwiML.
Stars: ✭ 371 (+437.68%)
Mutual labels:  twilio, voice
Mixedreality Webrtc
MixedReality-WebRTC is a collection of components to help mixed reality app developers integrate audio and video real-time communication into their application and improve their collaborative experience
Stars: ✭ 568 (+723.19%)
Mutual labels:  audio, webrtc
Twilio Video.js
Twilio’s Programmable Video JavaScript SDK
Stars: ✭ 408 (+491.3%)
Mutual labels:  twilio, webrtc
twilio-voice-notification-app
Reference app built in ReactJS that demonstrates how to leverage Twilio Programmable Voice and Twilio SDKs to create a voice notification system.
Stars: ✭ 21 (-69.57%)
Mutual labels:  twilio, voice
Webrtc
Pure Go implementation of the WebRTC API
Stars: ✭ 8,399 (+12072.46%)
Mutual labels:  audio, webrtc
Skylinkjs
SkylinkJS Javascript WebRTC SDK
Stars: ✭ 269 (+289.86%)
Mutual labels:  audio, webrtc
Twilio Csharp
Twilio C#/.NET Helper Library for .NET Framework 3.5+ and supported .NET Core versions
Stars: ✭ 541 (+684.06%)
Mutual labels:  twilio, voice
twilio-voice.js
Twilio's JavaScript Voice SDK
Stars: ✭ 21 (-69.57%)
Mutual labels:  twilio, voice
Call Forwarding Node
A sample implementation of advanced call forwarding using Twilio, Node.js and Express.js.
Stars: ✭ 6 (-91.3%)
Mutual labels:  twilio, voice
Routr
Routr: Next-generation SIP Server
Stars: ✭ 788 (+1042.03%)
Mutual labels:  twilio, webrtc
vortex
Revolt voice server
Stars: ✭ 61 (-11.59%)
Mutual labels:  webrtc, voice
Android audio talkback demo program
Android下音频对讲演示程序
Stars: ✭ 50 (-27.54%)
Mutual labels:  audio, webrtc
somleng
Open Source Implementation of Twilio's REST API
Stars: ✭ 33 (-52.17%)
Mutual labels:  twilio, voice
Webrtc Tutorial
📚 WebRTC 中文教程
Stars: ✭ 305 (+342.03%)
Mutual labels:  voice, webrtc
twilio-client.js
Twilio’s Programmable Voice JavaScript SDK
Stars: ✭ 63 (-8.7%)
Mutual labels:  twilio, voice
Libjitsi
Advanced Java media library for secure real-time audio/video communication.
Stars: ✭ 536 (+676.81%)
Mutual labels:  audio, webrtc
Twilio Video App Ios
A collaboration application built with the Twilio Video iOS SDK
Stars: ✭ 196 (+184.06%)
Mutual labels:  twilio, webrtc
useful-twilio-functions
A set of useful Twilio Functions.
Stars: ✭ 53 (-23.19%)
Mutual labels:  twilio, voice
Briefing
Secure direct video group chat
Stars: ✭ 710 (+928.99%)
Mutual labels:  audio, webrtc
Vchsm
C++ 11 algorithm implementation for voice conversion using harmonic plus stochastic models
Stars: ✭ 38 (-44.93%)
Mutual labels:  audio, voice

AudioSwitch

CircleCI

An Android audio management library for real-time communication apps.

video-app-screenshots

Features

  • [x] Manage audio focus for typical VoIP and Video conferencing use cases.
  • [x] Manage audio input and output devices.
    • [x] Detect changes in available audio devices
    • [x] Enumerate audio devices
    • [x] Select an audio device

Requirements

Android Studio Version Android API Version Min
3.6+ 16

Documentation

The KDoc for this library can be found here.

Getting Started

To get started using this library, follow the steps below.

Gradle Setup

Maven Central

Ensure that you have mavenCentral listed in your project's buildscript repositories section:

buildscript {
    repositories {
        mavenCentral()
        ...                
    }
}

Add this line as a new Gradle dependency:

implementation 'com.twilio:audioswitch:$version'

Pull requests merged to master result in an artifact being published to JFrog OSS Snapshots. You can access these snapshots by adding the following to your gradle file.

maven {
    url 'https://oss.jfrog.org/artifactory/libs-snapshot/'
}

implementation 'com.twilio:audioswitch:$version-SNAPSHOT'

AudioSwitch Setup

Instantiate an instance of the AudioSwitch class, passing a reference to the application context.

val audioSwitch = AudioSwitch(applicationContext)

Listen for Devices

To begin listening for live audio device changes, call the start function and pass a lambda that will receive AudioDevices when they become available.

audioSwitch.start { audioDevices, selectedDevice ->
    // TODO update UI with audio devices
}

You can also retrieve the available and selected audio devices manually at any time by calling the following properties:

val devices: List<AudioDevice> = audioSwitch.availableAudioDevices
val selectedDevice: AudioDevice? = audioSwitch.selectedAudioDevice

Note: Don't forget to stop listening for audio devices when no longer needed in order to prevent a memory leak.

audioSwitch.stop()

Select a Device

Before activating an AudioDevice, it needs to be selected first.

devices.find { it is AudioDevice.Speakerphone }?.let { audioSwitch.selectDevice(it) }

If no device is selected, then the library will automatically select a device based on the following priority: BluetoothHeadset -> WiredHeadset -> Earpiece -> Speakerphone.

Activate a Device

Activating a device acquires audio focus with voice communication usage and begins routing audio input/output to the selected device.

audioSwitch.activate()

Make sure to revert back to the prior audio state when it makes sense to do so in your app.

audioSwitch.deactivate()

Note: The stop() function will call deactivate() before closing AudioSwitch resources.

Bluetooth Support

Multiple connected bluetooth headsets are supported.

  • The library will accurately display the up to date active bluetooth headset within the AudioSwitch availableAudioDevices and selectedAudioDevice functions.
    • Other connected headsets are not stored by the library at this moment.
  • 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).
  • 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.
    • The newly activated headset will be propagated to the AudioSwitch availableAudioDevices and selectedAudioDevice functions.

Java Compatibility

Audioswitch is compatible with apps written in Java that target Java 8, and follows the recommendations provided in the Kotlin for Java consumption guide. The project includes Java specific unit tests that demonstrate how to use Audioswitch from a Java based application. If you have any Java compatibility questions please open an issue.

Logging

By default, AudioSwitch logging is disabled. Reference the following snippet to enable AudioSwitch logging:

val audioSwitch = AudioSwitch(context, loggingEnabled = true)

audioSwitch.start { _, _ -> }

Permissions

No manifest permissions are required by your application since the required permissions get merged from the manifest file in this library.

Contributing

We welcome and encourage contributions to AudioSwitch! However, pull request (PR) validation requires access to credentials that we cannot provide to external contributors. As a result, the contribution process is as follows:

  1. Submit a PR from a fork with your changes
  2. Our team will review
  3. If the changes are small enough and do not require validation (eg. documentation typo) we will merge your PR directly.
  4. If the changes require integration testing, then, once approved, our team will close your PR and create a new PR from a branch on the main repository and reference your original work.
  5. Our team will handle merging the final PR and releasing a new version with your changes.
  6. (Optional) Submit a PR that adds you to our CONTRIBUTORS file so you show up on the contributors page.

Usage Examples

License

Apache 2.0 license. See LICENSE.txt for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].