added more documentation and proper AVAudioSession for play file iOS example

This commit is contained in:
Syed Haris Ali
2015-06-30 14:09:12 -07:00
parent f2084dab2a
commit 4d952e2fa5
3 changed files with 58 additions and 22 deletions
@@ -36,6 +36,23 @@
{
[super viewDidLoad];
//
// Setup the AVAudioSession. EZMicrophone will not work properly on iOS
// if you don't do this!
//
AVAudioSession *session = [AVAudioSession sharedInstance];
NSError *error;
[session setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
if (error)
{
NSLog(@"Error setting up audio session category: %@", error.localizedDescription);
}
[session setActive:YES error:&error];
if (error)
{
NSLog(@"Error setting up audio session active: %@", error.localizedDescription);
}
//
// Customizing the audio plot's look
//
@@ -51,6 +68,13 @@
self.player = [EZAudioPlayer audioPlayerWithDelegate:self];
self.player.shouldLoop = YES;
// Override the output to the speaker
[session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&error];
if (error)
{
NSLog(@"Error overriding output to the speaker: %@", error.localizedDescription);
}
//
// Customize UI components
//