@@ -49,28 +49,30 @@ - (BOOL)isPlaying
4949#pragma - mark Public Methods
5050
5151// //// Playing //////
52- - (void )playAudioWithURL : (NSURL *)url error : (NSError **)error
52+ - (BOOL )playAudioWithURL : (NSURL *)url error : (NSError **)error
5353{
5454 [self stopPlaying ];
5555 [self stopRecording ];
5656 error = nil ;
5757
5858 [[AVAudioSession sharedInstance ] setCategory: AVAudioSessionCategoryPlayback error: error];
5959 if (error) {
60- return ;
60+ return NO ;
6161 }
6262 [[AVAudioSession sharedInstance ] setMode: AVAudioSessionModeSpokenAudio error: error];
6363 if (error) {
64- return ;
64+ return NO ;
6565 }
6666
6767 error = nil ;
6868 self.currentPlayer = [self audioPlayerWithURL: url error: error];
6969 if (error) {
70- return ;
70+ return NO ;
7171 }
7272
7373 [self .currentPlayer play ];
74+
75+ return YES ;
7476}
7577
7678- (void )pausePlaying
@@ -119,30 +121,32 @@ - (NSURL *)currentPlayerURL
119121}
120122
121123// //// Recording //////
122- - (void )recordAudioToURL : (NSURL *)url error : (NSError **)error
124+ - (BOOL )recordAudioToURL : (NSURL *)url error : (NSError **)error
123125{
124126 [self stopRecording ];
125127 [self stopPlaying ];
126128
127129 [[AVAudioSession sharedInstance ] setCategory: AVAudioSessionCategoryRecord error: error];
128130 if (error) {
129- return ;
131+ return NO ;
130132 }
131133 [[AVAudioSession sharedInstance ] setMode: AVAudioSessionModeSpokenAudio error: error];
132134 if (error) {
133- return ;
135+ return NO ;
134136 }
135137
136138 self.currentRecorder = [self audioRecorderWithURL: url error: error];
137139
138140 if (error) {
139- return ;
141+ return NO ;
140142 }
141143
142144 self.currentRecorder .meteringEnabled = YES ;
143145 self.recordDecibelTimer = [NSTimer scheduledTimerWithTimeInterval: 0.03 target: self selector: @selector (updateDecibelRecording: ) userInfo: nil repeats: YES ];
144146
145147 [self .currentRecorder record ];
148+
149+ return YES ;
146150}
147151
148152- (void )stopRecording
@@ -179,9 +183,9 @@ - (NSURL *)currentRecorderURL
179183
180184#pragma - mark Private Methods
181185
182- - (void )deactivateSession : (NSError **)error
186+ - (BOOL )deactivateSession : (NSError **)error
183187{
184- [[AVAudioSession sharedInstance ] setActive: NO withOptions: AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error: error];
188+ return [[AVAudioSession sharedInstance ] setActive: NO withOptions: AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error: error];
185189}
186190
187191- (AVPlayer *)audioPlayerWithURL : (NSURL *)url error : (NSError **)error
0 commit comments