 
         print("AudioBot audioPlayerDidFinishPlaying: \(flag)")
 
-        AudioBot.cleanPlaying(finish: true)
+        clearForPlaying(finish: true)
         playingFinish?(true)
         playingFinish = nil
+
+        deactiveAudioSessionAndNotifyOthers()
     }
 
     public func audioPlayerDecodeErrorDidOccur(player: AVAudioPlayer, error: NSError?) {
 
         print("AudioBot audioPlayerDecodeErrorDidOccur: \(error)")
 
-        AudioBot.cleanPlaying(finish: true)
+        clearForPlaying(finish: true)
         playingFinish?(false)
         playingFinish = nil
-    }
-}
-
+
+        deactiveAudioSessionAndNotifyOthers()
+    }
+}
+

    public class func stopRecord(finish: (fileURL: NSURL, duration: NSTimeInterval, decibelSamples: [CGFloat]) -> Void) {

        defer {
            cleanRecording()
        }

        guard let audioRecorder = sharedBot.audioRecorder where audioRecorder.recording else {


        print("AudioBot audioRecorderEncodeErrorDidOccur: \(error)")

        clearForRecording()
    }
}

