Skip to content

Instantly share code, notes, and snippets.

@rfistman
Created April 26, 2018 09:44
Show Gist options
  • Save rfistman/1c63315d6634112eac8b1f7dc9dffe64 to your computer and use it in GitHub Desktop.
Save rfistman/1c63315d6634112eac8b1f7dc9dffe64 to your computer and use it in GitHub Desktop.
trying to figure out if the two iPhone 7 speakers are addressable
NSError *error = nil;
if (![[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryMultiRoute error: &error]) {
NSLog(@"setCategory: %@", error);
}
if (![[AVAudioSession sharedInstance] setActive: YES error: &error]) {
NSLog(@"setActive: %@", error);
}
NSArray<AVAudioSessionPortDescription *> *outputs = AVAudioSession.sharedInstance.currentRoute.outputs;
for (AVAudioSessionPortDescription *portDesc in outputs) {
NSLog(@"-----");
NSLog(@"UID %@", portDesc.UID);
NSLog(@"portName %@", portDesc.portName);
NSLog(@"portType %@", portDesc.portType);
NSLog(@"channels %@", portDesc.channels);
NSLog(@"dataSources %@", portDesc.dataSources);
NSLog(@"selectedDataSource %@", portDesc.selectedDataSource);
NSLog(@"preferredDataSource %@", portDesc.preferredDataSource);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment