Skip to content

This iOS module routes audio output depending on device availability using the following priorities: bluetooth, wired headset, speaker. It also notifies interested listeners of audio change events (optional).

Notifications You must be signed in to change notification settings

Jawbone/AudioSessionManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

image

AudioSessionManager

Overview

This simple module routes audio depending on device availability using the following priorities: bluetooth, wired headset, speaker.

It also notifies interested listeners of audio change events (optional).

Requirements

The only requirement to use this module is an ARC-based iOS 6+ project.

Documentation

Initialization

AudioSessionManager is a singleton which can be initialized with a single statement:

// Initialize the audio session...
[[AudioSessionManager sharedInstance] startAndPostNotifications:YES];

Notifications

Two notifications are posted by this library if enabled:

  • kAudioSessionManagerDevicesAvailableChangedNotification - the list of devices (returned by the availableAudioDevices property) has changed
  • kAudioSessionManagerAudioDeviceChangedNotification - the current audio device (returned by the audioDevice property) has changed

Checking the current audio route

NSLog(@"audioRoute is %@", [AudioSessionManager sharedInstance].audioRoute);

Configuring the audio session

Configuring the device for input:

if (![[AudioSessionManager sharedInstance] changeMode:kAudioSessionManagerMode_Record]) {
    // .... handle error ...
}

and output:

if (![[AudioSessionManager sharedInstance] changeMode:kAudioSessionManagerMode_Playback]) {
    // .... handle error ...
}

About

This iOS module routes audio output depending on device availability using the following priorities: bluetooth, wired headset, speaker. It also notifies interested listeners of audio change events (optional).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published