added more documentation and proper AVAudioSession for play file iOS example
This commit is contained in:
+24
@@ -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
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user